document-model 2.4.1 → 2.5.0-test.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 (637) hide show
  1. package/dist/index.d.ts +18 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +13 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/{browser/src → src}/document/actions/creators.d.ts +4 -2
  6. package/dist/src/document/actions/creators.d.ts.map +1 -0
  7. package/dist/{node/src/document/actions/creators.d.ts → src/document/actions/creators.js} +18 -8
  8. package/dist/src/document/actions/creators.js.map +1 -0
  9. package/dist/src/document/actions/operations.d.ts +23 -0
  10. package/dist/src/document/actions/operations.d.ts.map +1 -0
  11. package/dist/src/document/actions/operations.js +131 -0
  12. package/dist/src/document/actions/operations.js.map +1 -0
  13. package/dist/src/document/actions/types.d.ts +16 -0
  14. package/dist/src/document/actions/types.d.ts.map +1 -0
  15. package/dist/src/document/actions/types.js +7 -0
  16. package/dist/src/document/actions/types.js.map +1 -0
  17. package/dist/{browser/src → src}/document/object.d.ts +17 -14
  18. package/dist/src/document/object.d.ts.map +1 -0
  19. package/dist/{node/src/document/object.d.ts → src/document/object.js} +93 -29
  20. package/dist/src/document/object.js.map +1 -0
  21. package/dist/src/document/reducer.d.ts +49 -0
  22. package/dist/src/document/reducer.d.ts.map +1 -0
  23. package/dist/src/document/reducer.js +342 -0
  24. package/dist/src/document/reducer.js.map +1 -0
  25. package/dist/{browser/src → src}/document/schema/types.d.ts +2 -1
  26. package/dist/src/document/schema/types.d.ts.map +1 -0
  27. package/dist/src/document/schema/types.js +2 -0
  28. package/dist/src/document/schema/types.js.map +1 -0
  29. package/dist/{browser/src → src}/document/schema/zod.d.ts +30 -47
  30. package/dist/src/document/schema/zod.d.ts.map +1 -0
  31. package/dist/src/document/schema/zod.js +113 -0
  32. package/dist/src/document/schema/zod.js.map +1 -0
  33. package/dist/{node/src → src}/document/signal.d.ts +10 -9
  34. package/dist/src/document/signal.d.ts.map +1 -0
  35. package/dist/src/document/signal.js +2 -0
  36. package/dist/src/document/signal.js.map +1 -0
  37. package/dist/src/document/types.d.ts +345 -0
  38. package/dist/src/document/types.d.ts.map +1 -0
  39. package/dist/src/document/types.js +2 -0
  40. package/dist/src/document/types.js.map +1 -0
  41. package/dist/src/document/utils/base.d.ts +83 -0
  42. package/dist/src/document/utils/base.d.ts.map +1 -0
  43. package/dist/src/document/utils/base.js +331 -0
  44. package/dist/src/document/utils/base.js.map +1 -0
  45. package/dist/src/document/utils/browser.d.ts +18 -0
  46. package/dist/src/document/utils/browser.d.ts.map +1 -0
  47. package/dist/src/document/utils/browser.js +54 -0
  48. package/dist/src/document/utils/browser.js.map +1 -0
  49. package/dist/src/document/utils/crypto.d.ts +11 -0
  50. package/dist/src/document/utils/crypto.d.ts.map +1 -0
  51. package/dist/src/document/utils/crypto.js +80 -0
  52. package/dist/src/document/utils/crypto.js.map +1 -0
  53. package/dist/src/document/utils/document-helpers.d.ts +78 -0
  54. package/dist/src/document/utils/document-helpers.d.ts.map +1 -0
  55. package/dist/src/document/utils/document-helpers.js +411 -0
  56. package/dist/src/document/utils/document-helpers.js.map +1 -0
  57. package/dist/src/document/utils/errors.d.ts +10 -0
  58. package/dist/src/document/utils/errors.d.ts.map +1 -0
  59. package/dist/src/document/utils/errors.js +19 -0
  60. package/dist/src/document/utils/errors.js.map +1 -0
  61. package/dist/{node/src → src}/document/utils/file.d.ts +10 -8
  62. package/dist/src/document/utils/file.d.ts.map +1 -0
  63. package/dist/src/document/utils/file.js +158 -0
  64. package/dist/src/document/utils/file.js.map +1 -0
  65. package/dist/src/document/utils/node.d.ts +18 -0
  66. package/dist/src/document/utils/node.d.ts.map +1 -0
  67. package/dist/src/document/utils/node.js +62 -0
  68. package/dist/src/document/utils/node.js.map +1 -0
  69. package/dist/src/document/utils/validation.d.ts +3 -0
  70. package/dist/src/document/utils/validation.d.ts.map +1 -0
  71. package/dist/src/document/utils/validation.js +23 -0
  72. package/dist/src/document/utils/validation.js.map +1 -0
  73. package/dist/src/document-model/custom/reducers/header.d.ts +3 -0
  74. package/dist/src/document-model/custom/reducers/header.d.ts.map +1 -0
  75. package/dist/src/document-model/custom/reducers/header.js +23 -0
  76. package/dist/src/document-model/custom/reducers/header.js.map +1 -0
  77. package/dist/src/document-model/custom/reducers/module.d.ts +3 -0
  78. package/dist/src/document-model/custom/reducers/module.d.ts.map +1 -0
  79. package/dist/src/document-model/custom/reducers/module.js +41 -0
  80. package/dist/src/document-model/custom/reducers/module.js.map +1 -0
  81. package/dist/src/document-model/custom/reducers/operation-error.d.ts +3 -0
  82. package/dist/src/document-model/custom/reducers/operation-error.d.ts.map +1 -0
  83. package/dist/src/document-model/custom/reducers/operation-error.js +94 -0
  84. package/dist/src/document-model/custom/reducers/operation-error.js.map +1 -0
  85. package/dist/src/document-model/custom/reducers/operation-example.d.ts +3 -0
  86. package/dist/src/document-model/custom/reducers/operation-example.d.ts.map +1 -0
  87. package/dist/src/document-model/custom/reducers/operation-example.js +53 -0
  88. package/dist/src/document-model/custom/reducers/operation-example.js.map +1 -0
  89. package/dist/src/document-model/custom/reducers/operation.d.ts +3 -0
  90. package/dist/src/document-model/custom/reducers/operation.d.ts.map +1 -0
  91. package/dist/src/document-model/custom/reducers/operation.js +125 -0
  92. package/dist/src/document-model/custom/reducers/operation.js.map +1 -0
  93. package/dist/src/document-model/custom/reducers/state.d.ts +3 -0
  94. package/dist/src/document-model/custom/reducers/state.d.ts.map +1 -0
  95. package/dist/src/document-model/custom/reducers/state.js +71 -0
  96. package/dist/src/document-model/custom/reducers/state.js.map +1 -0
  97. package/dist/src/document-model/custom/reducers/versioning.d.ts +8 -0
  98. package/dist/src/document-model/custom/reducers/versioning.d.ts.map +1 -0
  99. package/dist/src/document-model/custom/reducers/versioning.js +23 -0
  100. package/dist/src/document-model/custom/reducers/versioning.js.map +1 -0
  101. package/dist/{browser/src → src}/document-model/custom/utils.d.ts +4 -3
  102. package/dist/src/document-model/custom/utils.d.ts.map +1 -0
  103. package/dist/src/document-model/custom/utils.js +105 -0
  104. package/dist/src/document-model/custom/utils.js.map +1 -0
  105. package/dist/src/document-model/gen/actions.d.ts +16 -0
  106. package/dist/src/document-model/gen/actions.d.ts.map +1 -0
  107. package/dist/src/document-model/gen/actions.js +8 -0
  108. package/dist/src/document-model/gen/actions.js.map +1 -0
  109. package/dist/src/document-model/gen/constants.d.ts +7 -0
  110. package/dist/src/document-model/gen/constants.d.ts.map +1 -0
  111. package/dist/src/document-model/gen/constants.js +34 -0
  112. package/dist/src/document-model/gen/constants.js.map +1 -0
  113. package/dist/src/document-model/gen/creators.d.ts +8 -0
  114. package/dist/src/document-model/gen/creators.d.ts.map +1 -0
  115. package/dist/src/document-model/gen/creators.js +8 -0
  116. package/dist/src/document-model/gen/creators.js.map +1 -0
  117. package/dist/src/document-model/gen/document-model.d.ts +3 -0
  118. package/dist/src/document-model/gen/document-model.d.ts.map +1 -0
  119. package/dist/src/document-model/gen/document-model.js +542 -0
  120. package/dist/src/document-model/gen/document-model.js.map +1 -0
  121. package/dist/src/document-model/gen/header/actions.d.ts +10 -0
  122. package/dist/src/document-model/gen/header/actions.d.ts.map +1 -0
  123. package/dist/src/document-model/gen/header/actions.js +2 -0
  124. package/dist/src/document-model/gen/header/actions.js.map +1 -0
  125. package/dist/{node/src → src}/document-model/gen/header/creators.d.ts +3 -2
  126. package/dist/src/document-model/gen/header/creators.d.ts.map +1 -0
  127. package/dist/src/document-model/gen/header/creators.js +10 -0
  128. package/dist/src/document-model/gen/header/creators.js.map +1 -0
  129. package/dist/src/document-model/gen/header/object.d.ts +13 -0
  130. package/dist/src/document-model/gen/header/object.d.ts.map +1 -0
  131. package/dist/src/document-model/gen/header/object.js +23 -0
  132. package/dist/src/document-model/gen/header/object.js.map +1 -0
  133. package/dist/{node/src → src}/document-model/gen/header/operations.d.ts +3 -2
  134. package/dist/src/document-model/gen/header/operations.d.ts.map +1 -0
  135. package/dist/src/document-model/gen/header/operations.js +2 -0
  136. package/dist/src/document-model/gen/header/operations.js.map +1 -0
  137. package/dist/src/document-model/gen/module/actions.d.ts +9 -0
  138. package/dist/src/document-model/gen/module/actions.d.ts.map +1 -0
  139. package/dist/src/document-model/gen/module/actions.js +2 -0
  140. package/dist/src/document-model/gen/module/actions.js.map +1 -0
  141. package/dist/{node/src → src}/document-model/gen/module/creators.d.ts +3 -2
  142. package/dist/src/document-model/gen/module/creators.d.ts.map +1 -0
  143. package/dist/src/document-model/gen/module/creators.js +9 -0
  144. package/dist/src/document-model/gen/module/creators.js.map +1 -0
  145. package/dist/src/document-model/gen/module/object.d.ts +12 -0
  146. package/dist/src/document-model/gen/module/object.d.ts.map +1 -0
  147. package/dist/src/document-model/gen/module/object.js +20 -0
  148. package/dist/src/document-model/gen/module/object.js.map +1 -0
  149. package/dist/{browser/src → src}/document-model/gen/module/operations.d.ts +3 -2
  150. package/dist/src/document-model/gen/module/operations.d.ts.map +1 -0
  151. package/dist/src/document-model/gen/module/operations.js +2 -0
  152. package/dist/src/document-model/gen/module/operations.js.map +1 -0
  153. package/dist/src/document-model/gen/object.d.ts +29 -0
  154. package/dist/src/document-model/gen/object.d.ts.map +1 -0
  155. package/dist/src/document-model/gen/object.js +46 -0
  156. package/dist/src/document-model/gen/object.js.map +1 -0
  157. package/dist/src/document-model/gen/operation/actions.d.ts +14 -0
  158. package/dist/src/document-model/gen/operation/actions.d.ts.map +1 -0
  159. package/dist/src/document-model/gen/operation/actions.js +2 -0
  160. package/dist/src/document-model/gen/operation/actions.js.map +1 -0
  161. package/dist/{browser/src → src}/document-model/gen/operation/creators.d.ts +3 -2
  162. package/dist/src/document-model/gen/operation/creators.d.ts.map +1 -0
  163. package/dist/src/document-model/gen/operation/creators.js +20 -0
  164. package/dist/src/document-model/gen/operation/creators.js.map +1 -0
  165. package/dist/{node/src → src}/document-model/gen/operation/object.d.ts +7 -5
  166. package/dist/src/document-model/gen/operation/object.d.ts.map +1 -0
  167. package/dist/src/document-model/gen/operation/object.js +35 -0
  168. package/dist/src/document-model/gen/operation/object.js.map +1 -0
  169. package/dist/{node/src → src}/document-model/gen/operation/operations.d.ts +3 -2
  170. package/dist/src/document-model/gen/operation/operations.d.ts.map +1 -0
  171. package/dist/src/document-model/gen/operation/operations.js +2 -0
  172. package/dist/src/document-model/gen/operation/operations.js.map +1 -0
  173. package/dist/src/document-model/gen/operation-error/actions.d.ts +11 -0
  174. package/dist/src/document-model/gen/operation-error/actions.d.ts.map +1 -0
  175. package/dist/src/document-model/gen/operation-error/actions.js +2 -0
  176. package/dist/src/document-model/gen/operation-error/actions.js.map +1 -0
  177. package/dist/{node/src → src}/document-model/gen/operation-error/creators.d.ts +3 -2
  178. package/dist/src/document-model/gen/operation-error/creators.d.ts.map +1 -0
  179. package/dist/src/document-model/gen/operation-error/creators.js +17 -0
  180. package/dist/src/document-model/gen/operation-error/creators.js.map +1 -0
  181. package/dist/{node/src → src}/document-model/gen/operation-error/object.d.ts +7 -5
  182. package/dist/src/document-model/gen/operation-error/object.d.ts.map +1 -0
  183. package/dist/src/document-model/gen/operation-error/object.js +26 -0
  184. package/dist/src/document-model/gen/operation-error/object.js.map +1 -0
  185. package/dist/{browser/src → src}/document-model/gen/operation-error/operations.d.ts +3 -2
  186. package/dist/src/document-model/gen/operation-error/operations.d.ts.map +1 -0
  187. package/dist/src/document-model/gen/operation-error/operations.js +2 -0
  188. package/dist/src/document-model/gen/operation-error/operations.js.map +1 -0
  189. package/dist/src/document-model/gen/operation-example/actions.d.ts +8 -0
  190. package/dist/src/document-model/gen/operation-example/actions.d.ts.map +1 -0
  191. package/dist/src/document-model/gen/operation-example/actions.js +2 -0
  192. package/dist/src/document-model/gen/operation-example/actions.js.map +1 -0
  193. package/dist/{browser/src → src}/document-model/gen/operation-example/creators.d.ts +3 -2
  194. package/dist/src/document-model/gen/operation-example/creators.d.ts.map +1 -0
  195. package/dist/src/document-model/gen/operation-example/creators.js +14 -0
  196. package/dist/src/document-model/gen/operation-example/creators.js.map +1 -0
  197. package/dist/src/document-model/gen/operation-example/object.d.ts +12 -0
  198. package/dist/src/document-model/gen/operation-example/object.d.ts.map +1 -0
  199. package/dist/src/document-model/gen/operation-example/object.js +17 -0
  200. package/dist/src/document-model/gen/operation-example/object.js.map +1 -0
  201. package/dist/{browser/src → src}/document-model/gen/operation-example/operations.d.ts +3 -2
  202. package/dist/src/document-model/gen/operation-example/operations.d.ts.map +1 -0
  203. package/dist/src/document-model/gen/operation-example/operations.js +2 -0
  204. package/dist/src/document-model/gen/operation-example/operations.js.map +1 -0
  205. package/dist/src/document-model/gen/reducer.d.ts +5 -0
  206. package/dist/src/document-model/gen/reducer.d.ts.map +1 -0
  207. package/dist/src/document-model/gen/reducer.js +193 -0
  208. package/dist/src/document-model/gen/reducer.js.map +1 -0
  209. package/dist/{browser/src → src}/document-model/gen/schema/types.d.ts +6 -1
  210. package/dist/src/document-model/gen/schema/types.d.ts.map +1 -0
  211. package/dist/src/document-model/gen/schema/types.js +2 -0
  212. package/dist/src/document-model/gen/schema/types.js.map +1 -0
  213. package/dist/src/document-model/gen/schema/zod.d.ts +454 -0
  214. package/dist/src/document-model/gen/schema/zod.d.ts.map +1 -0
  215. package/dist/src/document-model/gen/schema/zod.js +394 -0
  216. package/dist/src/document-model/gen/schema/zod.js.map +1 -0
  217. package/dist/src/document-model/gen/state/actions.d.ts +10 -0
  218. package/dist/src/document-model/gen/state/actions.d.ts.map +1 -0
  219. package/dist/src/document-model/gen/state/actions.js +2 -0
  220. package/dist/src/document-model/gen/state/actions.js.map +1 -0
  221. package/dist/{browser/src → src}/document-model/gen/state/creators.d.ts +3 -2
  222. package/dist/src/document-model/gen/state/creators.d.ts.map +1 -0
  223. package/dist/src/document-model/gen/state/creators.js +10 -0
  224. package/dist/src/document-model/gen/state/creators.js.map +1 -0
  225. package/dist/src/document-model/gen/state/object.d.ts +13 -0
  226. package/dist/src/document-model/gen/state/object.d.ts.map +1 -0
  227. package/dist/src/document-model/gen/state/object.js +23 -0
  228. package/dist/src/document-model/gen/state/object.js.map +1 -0
  229. package/dist/{browser/src → src}/document-model/gen/state/operations.d.ts +3 -2
  230. package/dist/src/document-model/gen/state/operations.d.ts.map +1 -0
  231. package/dist/src/document-model/gen/state/operations.js +2 -0
  232. package/dist/src/document-model/gen/state/operations.js.map +1 -0
  233. package/dist/src/document-model/gen/types.d.ts +7 -0
  234. package/dist/src/document-model/gen/types.d.ts.map +1 -0
  235. package/dist/src/document-model/gen/types.js +2 -0
  236. package/dist/src/document-model/gen/types.js.map +1 -0
  237. package/dist/src/document-model/gen/utils.d.ts +11 -0
  238. package/dist/src/document-model/gen/utils.d.ts.map +1 -0
  239. package/dist/src/document-model/gen/utils.js +30 -0
  240. package/dist/src/document-model/gen/utils.js.map +1 -0
  241. package/dist/src/document-model/gen/versioning/actions.d.ts +9 -0
  242. package/dist/src/document-model/gen/versioning/actions.d.ts.map +1 -0
  243. package/dist/src/document-model/gen/versioning/actions.js +2 -0
  244. package/dist/src/document-model/gen/versioning/actions.js.map +1 -0
  245. package/dist/{browser/src → src}/document-model/gen/versioning/creators.d.ts +3 -2
  246. package/dist/src/document-model/gen/versioning/creators.d.ts.map +1 -0
  247. package/dist/src/document-model/gen/versioning/creators.js +13 -0
  248. package/dist/src/document-model/gen/versioning/creators.js.map +1 -0
  249. package/dist/src/document-model/gen/versioning/object.d.ts +13 -0
  250. package/dist/src/document-model/gen/versioning/object.d.ts.map +1 -0
  251. package/dist/src/document-model/gen/versioning/object.js +20 -0
  252. package/dist/src/document-model/gen/versioning/object.js.map +1 -0
  253. package/dist/{browser/src → src}/document-model/gen/versioning/operations.d.ts +3 -2
  254. package/dist/src/document-model/gen/versioning/operations.d.ts.map +1 -0
  255. package/dist/src/document-model/gen/versioning/operations.js +2 -0
  256. package/dist/src/document-model/gen/versioning/operations.js.map +1 -0
  257. package/dist/src/document-model/module.d.ts +3 -0
  258. package/dist/src/document-model/module.d.ts.map +1 -0
  259. package/dist/src/document-model/module.js +13 -0
  260. package/dist/src/document-model/module.js.map +1 -0
  261. package/dist/src/document-model/types.d.ts +4 -0
  262. package/dist/src/document-model/types.d.ts.map +1 -0
  263. package/dist/src/document-model/types.js +2 -0
  264. package/dist/src/document-model/types.js.map +1 -0
  265. package/dist/test/document/crypto.test.d.ts +2 -0
  266. package/dist/test/document/crypto.test.d.ts.map +1 -0
  267. package/dist/test/document/crypto.test.js +181 -0
  268. package/dist/test/document/crypto.test.js.map +1 -0
  269. package/dist/test/document/event-vs-command.test.d.ts +2 -0
  270. package/dist/test/document/event-vs-command.test.d.ts.map +1 -0
  271. package/dist/test/document/event-vs-command.test.js +169 -0
  272. package/dist/test/document/event-vs-command.test.js.map +1 -0
  273. package/dist/test/document/local.test.d.ts +2 -0
  274. package/dist/test/document/local.test.d.ts.map +1 -0
  275. package/dist/test/document/local.test.js +248 -0
  276. package/dist/test/document/local.test.js.map +1 -0
  277. package/dist/test/document/object.test.d.ts +2 -0
  278. package/dist/test/document/object.test.d.ts.map +1 -0
  279. package/dist/test/document/object.test.js +13 -0
  280. package/dist/test/document/object.test.js.map +1 -0
  281. package/dist/test/document/operation-id.test.d.ts +2 -0
  282. package/dist/test/document/operation-id.test.d.ts.map +1 -0
  283. package/dist/test/document/operation-id.test.js +159 -0
  284. package/dist/test/document/operation-id.test.js.map +1 -0
  285. package/dist/test/document/prune.test.d.ts +2 -0
  286. package/dist/test/document/prune.test.d.ts.map +1 -0
  287. package/dist/test/document/prune.test.js +177 -0
  288. package/dist/test/document/prune.test.js.map +1 -0
  289. package/dist/test/document/reducer.test.d.ts +2 -0
  290. package/dist/test/document/reducer.test.d.ts.map +1 -0
  291. package/dist/test/document/reducer.test.js +270 -0
  292. package/dist/test/document/reducer.test.js.map +1 -0
  293. package/dist/test/document/skip-operations.test.d.ts +2 -0
  294. package/dist/test/document/skip-operations.test.d.ts.map +1 -0
  295. package/dist/test/document/skip-operations.test.js +442 -0
  296. package/dist/test/document/skip-operations.test.js.map +1 -0
  297. package/dist/test/document/undo-redo.test.d.ts +2 -0
  298. package/dist/test/document/undo-redo.test.d.ts.map +1 -0
  299. package/dist/test/document/undo-redo.test.js +377 -0
  300. package/dist/test/document/undo-redo.test.js.map +1 -0
  301. package/dist/test/document/utils.test.d.ts +2 -0
  302. package/dist/test/document/utils.test.d.ts.map +1 -0
  303. package/dist/test/document/utils.test.js +152 -0
  304. package/dist/test/document/utils.test.js.map +1 -0
  305. package/dist/test/document-helpers/addUndo.test.d.ts +2 -0
  306. package/dist/test/document-helpers/addUndo.test.d.ts.map +1 -0
  307. package/dist/test/document-helpers/addUndo.test.js +120 -0
  308. package/dist/test/document-helpers/addUndo.test.js.map +1 -0
  309. package/dist/test/document-helpers/attachBranch.test.d.ts +2 -0
  310. package/dist/test/document-helpers/attachBranch.test.d.ts.map +1 -0
  311. package/dist/test/document-helpers/attachBranch.test.js +364 -0
  312. package/dist/test/document-helpers/attachBranch.test.js.map +1 -0
  313. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts +2 -0
  314. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts.map +1 -0
  315. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js +252 -0
  316. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js.map +1 -0
  317. package/dist/test/document-helpers/conflictResolution.test.d.ts +2 -0
  318. package/dist/test/document-helpers/conflictResolution.test.d.ts.map +1 -0
  319. package/dist/test/document-helpers/conflictResolution.test.js +109 -0
  320. package/dist/test/document-helpers/conflictResolution.test.js.map +1 -0
  321. package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts +2 -0
  322. package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts.map +1 -0
  323. package/dist/test/document-helpers/filterDuplicatedOperations.test.js +126 -0
  324. package/dist/test/document-helpers/filterDuplicatedOperations.test.js.map +1 -0
  325. package/dist/test/document-helpers/garbageCollect.test.d.ts +2 -0
  326. package/dist/test/document-helpers/garbageCollect.test.d.ts.map +1 -0
  327. package/dist/test/document-helpers/garbageCollect.test.js +136 -0
  328. package/dist/test/document-helpers/garbageCollect.test.js.map +1 -0
  329. package/dist/test/document-helpers/groupOperationsByScope.test.d.ts +2 -0
  330. package/dist/test/document-helpers/groupOperationsByScope.test.d.ts.map +1 -0
  331. package/dist/test/document-helpers/groupOperationsByScope.test.js +98 -0
  332. package/dist/test/document-helpers/groupOperationsByScope.test.js.map +1 -0
  333. package/dist/test/document-helpers/merge.test.d.ts +2 -0
  334. package/dist/test/document-helpers/merge.test.d.ts.map +1 -0
  335. package/dist/test/document-helpers/merge.test.js +906 -0
  336. package/dist/test/document-helpers/merge.test.js.map +1 -0
  337. package/dist/test/document-helpers/nextSkipNumber.test.d.ts +2 -0
  338. package/dist/test/document-helpers/nextSkipNumber.test.d.ts.map +1 -0
  339. package/dist/test/document-helpers/nextSkipNumber.test.js +135 -0
  340. package/dist/test/document-helpers/nextSkipNumber.test.js.map +1 -0
  341. package/dist/test/document-helpers/prepareOperations.test.d.ts +2 -0
  342. package/dist/test/document-helpers/prepareOperations.test.d.ts.map +1 -0
  343. package/dist/test/document-helpers/prepareOperations.test.js +304 -0
  344. package/dist/test/document-helpers/prepareOperations.test.js.map +1 -0
  345. package/dist/test/document-helpers/removeExistingOperations.test.d.ts +2 -0
  346. package/dist/test/document-helpers/removeExistingOperations.test.d.ts.map +1 -0
  347. package/dist/test/document-helpers/removeExistingOperations.test.js +150 -0
  348. package/dist/test/document-helpers/removeExistingOperations.test.js.map +1 -0
  349. package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts +2 -0
  350. package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts.map +1 -0
  351. package/dist/test/document-helpers/reshuffleByTimestamp.test.js +148 -0
  352. package/dist/test/document-helpers/reshuffleByTimestamp.test.js.map +1 -0
  353. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts +2 -0
  354. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts.map +1 -0
  355. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js +200 -0
  356. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js.map +1 -0
  357. package/dist/test/document-helpers/skipHeaderOperations.test.d.ts +2 -0
  358. package/dist/test/document-helpers/skipHeaderOperations.test.d.ts.map +1 -0
  359. package/dist/test/document-helpers/skipHeaderOperations.test.js +74 -0
  360. package/dist/test/document-helpers/skipHeaderOperations.test.js.map +1 -0
  361. package/dist/test/document-helpers/sortOperations.test.d.ts +2 -0
  362. package/dist/test/document-helpers/sortOperations.test.d.ts.map +1 -0
  363. package/dist/test/document-helpers/sortOperations.test.js +101 -0
  364. package/dist/test/document-helpers/sortOperations.test.js.map +1 -0
  365. package/dist/test/document-helpers/split.test.d.ts +2 -0
  366. package/dist/test/document-helpers/split.test.d.ts.map +1 -0
  367. package/dist/test/document-helpers/split.test.js +121 -0
  368. package/dist/test/document-helpers/split.test.js.map +1 -0
  369. package/dist/{browser/test → test}/document-helpers/utils.d.ts +2 -1
  370. package/dist/test/document-helpers/utils.d.ts.map +1 -0
  371. package/dist/test/document-helpers/utils.js +22 -0
  372. package/dist/test/document-helpers/utils.js.map +1 -0
  373. package/dist/test/document-model/object.test.d.ts +2 -0
  374. package/dist/test/document-model/object.test.d.ts.map +1 -0
  375. package/dist/test/document-model/object.test.js +243 -0
  376. package/dist/test/document-model/object.test.js.map +1 -0
  377. package/dist/test/document-model/replay.test.d.ts +2 -0
  378. package/dist/test/document-model/replay.test.d.ts.map +1 -0
  379. package/dist/test/document-model/replay.test.js +149 -0
  380. package/dist/test/document-model/replay.test.js.map +1 -0
  381. package/dist/test/document-model/skip-operations.test.d.ts +2 -0
  382. package/dist/test/document-model/skip-operations.test.d.ts.map +1 -0
  383. package/dist/test/document-model/skip-operations.test.js +220 -0
  384. package/dist/test/document-model/skip-operations.test.js.map +1 -0
  385. package/dist/test/document-model/validation.test.d.ts +2 -0
  386. package/dist/test/document-model/validation.test.d.ts.map +1 -0
  387. package/dist/test/document-model/validation.test.js +258 -0
  388. package/dist/test/document-model/validation.test.js.map +1 -0
  389. package/dist/test/document-model/zip.test.d.ts +2 -0
  390. package/dist/test/document-model/zip.test.d.ts.map +1 -0
  391. package/dist/test/document-model/zip.test.js +80 -0
  392. package/dist/test/document-model/zip.test.js.map +1 -0
  393. package/dist/test/helpers.d.ts +31 -0
  394. package/dist/test/helpers.d.ts.map +1 -0
  395. package/dist/test/helpers.js +71 -0
  396. package/dist/test/helpers.js.map +1 -0
  397. package/dist/tsconfig.tsbuildinfo +1 -0
  398. package/dist/vitest.config.d.ts +3 -0
  399. package/dist/vitest.config.d.ts.map +1 -0
  400. package/dist/vitest.config.js +13 -0
  401. package/dist/vitest.config.js.map +1 -0
  402. package/package.json +27 -53
  403. package/dist/browser/cjs/document-model.js +0 -20
  404. package/dist/browser/cjs/document-model.js.map +0 -1
  405. package/dist/browser/cjs/document.js +0 -15
  406. package/dist/browser/cjs/document.js.map +0 -1
  407. package/dist/browser/cjs/index.js +0 -14
  408. package/dist/browser/cjs/index.js.map +0 -1
  409. package/dist/browser/cjs/internal/index-DyKphRZa.js +0 -2215
  410. package/dist/browser/cjs/internal/index-DyKphRZa.js.map +0 -1
  411. package/dist/browser/cjs/internal/index-y9w_m1Lo.js +0 -57
  412. package/dist/browser/cjs/internal/index-y9w_m1Lo.js.map +0 -1
  413. package/dist/browser/cjs/internal/object-Dbc1GbBl.js +0 -2694
  414. package/dist/browser/cjs/internal/object-Dbc1GbBl.js.map +0 -1
  415. package/dist/browser/cjs/package.json +0 -1
  416. package/dist/browser/document-model.d.ts +0 -2
  417. package/dist/browser/document.d.ts +0 -2
  418. package/dist/browser/es/document-model.js +0 -20
  419. package/dist/browser/es/document-model.js.map +0 -1
  420. package/dist/browser/es/document.js +0 -15
  421. package/dist/browser/es/document.js.map +0 -1
  422. package/dist/browser/es/index.js +0 -14
  423. package/dist/browser/es/index.js.map +0 -1
  424. package/dist/browser/es/internal/index-BI16PNmr.js +0 -58
  425. package/dist/browser/es/internal/index-BI16PNmr.js.map +0 -1
  426. package/dist/browser/es/internal/index-CiQX4huJ.js +0 -2216
  427. package/dist/browser/es/internal/index-CiQX4huJ.js.map +0 -1
  428. package/dist/browser/es/internal/object-BTIqCvb-.js +0 -2695
  429. package/dist/browser/es/internal/object-BTIqCvb-.js.map +0 -1
  430. package/dist/browser/es/package.json +0 -1
  431. package/dist/browser/index.d.ts +0 -6
  432. package/dist/browser/src/document/actions/index.d.ts +0 -14
  433. package/dist/browser/src/document/actions/types.d.ts +0 -15
  434. package/dist/browser/src/document/index.d.ts +0 -6
  435. package/dist/browser/src/document/reducer.d.ts +0 -65
  436. package/dist/browser/src/document/schema/index.d.ts +0 -2
  437. package/dist/browser/src/document/signal.d.ts +0 -29
  438. package/dist/browser/src/document/types.d.ts +0 -271
  439. package/dist/browser/src/document/utils/base.d.ts +0 -87
  440. package/dist/browser/src/document/utils/crypto.d.ts +0 -9
  441. package/dist/browser/src/document/utils/document-helpers.d.ts +0 -73
  442. package/dist/browser/src/document/utils/file.d.ts +0 -48
  443. package/dist/browser/src/document/utils/index.d.ts +0 -6
  444. package/dist/browser/src/document/utils/node.d.ts +0 -9
  445. package/dist/browser/src/document/utils/validation.d.ts +0 -2
  446. package/dist/browser/src/document-model/custom/reducers/header.d.ts +0 -2
  447. package/dist/browser/src/document-model/custom/reducers/module.d.ts +0 -2
  448. package/dist/browser/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  449. package/dist/browser/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  450. package/dist/browser/src/document-model/custom/reducers/operation.d.ts +0 -2
  451. package/dist/browser/src/document-model/custom/reducers/state.d.ts +0 -2
  452. package/dist/browser/src/document-model/custom/reducers/versioning.d.ts +0 -2
  453. package/dist/browser/src/document-model/gen/actions.d.ts +0 -15
  454. package/dist/browser/src/document-model/gen/creators.d.ts +0 -7
  455. package/dist/browser/src/document-model/gen/document-model.d.ts +0 -2
  456. package/dist/browser/src/document-model/gen/header/actions.d.ts +0 -9
  457. package/dist/browser/src/document-model/gen/header/creators.d.ts +0 -8
  458. package/dist/browser/src/document-model/gen/header/object.d.ts +0 -12
  459. package/dist/browser/src/document-model/gen/header/operations.d.ts +0 -10
  460. package/dist/browser/src/document-model/gen/index.d.ts +0 -5
  461. package/dist/browser/src/document-model/gen/module/actions.d.ts +0 -8
  462. package/dist/browser/src/document-model/gen/module/creators.d.ts +0 -7
  463. package/dist/browser/src/document-model/gen/module/object.d.ts +0 -11
  464. package/dist/browser/src/document-model/gen/object.d.ts +0 -28
  465. package/dist/browser/src/document-model/gen/operation/actions.d.ts +0 -13
  466. package/dist/browser/src/document-model/gen/operation/object.d.ts +0 -16
  467. package/dist/browser/src/document-model/gen/operation/operations.d.ts +0 -14
  468. package/dist/browser/src/document-model/gen/operation-error/actions.d.ts +0 -10
  469. package/dist/browser/src/document-model/gen/operation-error/creators.d.ts +0 -9
  470. package/dist/browser/src/document-model/gen/operation-error/object.d.ts +0 -13
  471. package/dist/browser/src/document-model/gen/operation-example/actions.d.ts +0 -7
  472. package/dist/browser/src/document-model/gen/operation-example/object.d.ts +0 -10
  473. package/dist/browser/src/document-model/gen/reducer.d.ts +0 -5
  474. package/dist/browser/src/document-model/gen/schema/index.d.ts +0 -2
  475. package/dist/browser/src/document-model/gen/schema/zod.d.ts +0 -453
  476. package/dist/browser/src/document-model/gen/state/actions.d.ts +0 -9
  477. package/dist/browser/src/document-model/gen/state/object.d.ts +0 -12
  478. package/dist/browser/src/document-model/gen/types.d.ts +0 -8
  479. package/dist/browser/src/document-model/gen/utils.d.ts +0 -6
  480. package/dist/browser/src/document-model/gen/versioning/actions.d.ts +0 -8
  481. package/dist/browser/src/document-model/gen/versioning/object.d.ts +0 -11
  482. package/dist/browser/src/document-model/index.d.ts +0 -76
  483. package/dist/browser/src/index.d.ts +0 -24
  484. package/dist/browser/test/document/crypto.test.d.ts +0 -1
  485. package/dist/browser/test/document/event-vs-command.test.d.ts +0 -1
  486. package/dist/browser/test/document/local.test.d.ts +0 -1
  487. package/dist/browser/test/document/object.test.d.ts +0 -1
  488. package/dist/browser/test/document/operation-id.test.d.ts +0 -1
  489. package/dist/browser/test/document/prune.test.d.ts +0 -1
  490. package/dist/browser/test/document/reducer.test.d.ts +0 -1
  491. package/dist/browser/test/document/skip-operations.test.d.ts +0 -1
  492. package/dist/browser/test/document/undo-redo.test.d.ts +0 -1
  493. package/dist/browser/test/document/utils.test.d.ts +0 -1
  494. package/dist/browser/test/document-helpers/addUndo.test.d.ts +0 -1
  495. package/dist/browser/test/document-helpers/attachBranch.test.d.ts +0 -1
  496. package/dist/browser/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts +0 -1
  497. package/dist/browser/test/document-helpers/conflictResolution.test.d.ts +0 -1
  498. package/dist/browser/test/document-helpers/filterDuplicatedOperations.test.d.ts +0 -1
  499. package/dist/browser/test/document-helpers/garbageCollect.test.d.ts +0 -1
  500. package/dist/browser/test/document-helpers/groupOperationsByScope.test.d.ts +0 -1
  501. package/dist/browser/test/document-helpers/merge.test.d.ts +0 -1
  502. package/dist/browser/test/document-helpers/nextSkipNumber.test.d.ts +0 -1
  503. package/dist/browser/test/document-helpers/prepareOperations.test.d.ts +0 -1
  504. package/dist/browser/test/document-helpers/removeExistingOperations.test.d.ts +0 -1
  505. package/dist/browser/test/document-helpers/reshuffleByTimestamp.test.d.ts +0 -1
  506. package/dist/browser/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts +0 -1
  507. package/dist/browser/test/document-helpers/skipHeaderOperations.test.d.ts +0 -1
  508. package/dist/browser/test/document-helpers/sortOperations.test.d.ts +0 -1
  509. package/dist/browser/test/document-helpers/split.test.d.ts +0 -1
  510. package/dist/browser/test/document-model/object.test.d.ts +0 -1
  511. package/dist/browser/test/document-model/replay.test.d.ts +0 -1
  512. package/dist/browser/test/document-model/skip-operations.test.d.ts +0 -1
  513. package/dist/browser/test/document-model/validation.test.d.ts +0 -1
  514. package/dist/browser/test/document-model/zip.test.d.ts +0 -1
  515. package/dist/browser/test/helpers.d.ts +0 -39
  516. package/dist/browser/vite.config.d.ts +0 -2
  517. package/dist/browser/vitest.config.d.ts +0 -2
  518. package/dist/node/cjs/document-model.js +0 -24
  519. package/dist/node/cjs/document-model.js.map +0 -1
  520. package/dist/node/cjs/document.js +0 -15
  521. package/dist/node/cjs/document.js.map +0 -1
  522. package/dist/node/cjs/index.js +0 -14
  523. package/dist/node/cjs/index.js.map +0 -1
  524. package/dist/node/cjs/internal/index-CLCVBs4I.js +0 -57
  525. package/dist/node/cjs/internal/index-CLCVBs4I.js.map +0 -1
  526. package/dist/node/cjs/internal/index-Cp37sm40.js +0 -2219
  527. package/dist/node/cjs/internal/index-Cp37sm40.js.map +0 -1
  528. package/dist/node/cjs/internal/object-ByNZ3G_j.js +0 -2480
  529. package/dist/node/cjs/internal/object-ByNZ3G_j.js.map +0 -1
  530. package/dist/node/cjs/package.json +0 -1
  531. package/dist/node/document-model.d.ts +0 -2
  532. package/dist/node/document.d.ts +0 -2
  533. package/dist/node/es/document-model.js +0 -24
  534. package/dist/node/es/document-model.js.map +0 -1
  535. package/dist/node/es/document.js +0 -15
  536. package/dist/node/es/document.js.map +0 -1
  537. package/dist/node/es/index.js +0 -14
  538. package/dist/node/es/index.js.map +0 -1
  539. package/dist/node/es/internal/index-BXfMlE4L.js +0 -58
  540. package/dist/node/es/internal/index-BXfMlE4L.js.map +0 -1
  541. package/dist/node/es/internal/index-ppDSDiFU.js +0 -2220
  542. package/dist/node/es/internal/index-ppDSDiFU.js.map +0 -1
  543. package/dist/node/es/internal/object-C8sca9DR.js +0 -2481
  544. package/dist/node/es/internal/object-C8sca9DR.js.map +0 -1
  545. package/dist/node/es/package.json +0 -1
  546. package/dist/node/index.d.ts +0 -6
  547. package/dist/node/src/document/actions/index.d.ts +0 -14
  548. package/dist/node/src/document/actions/types.d.ts +0 -15
  549. package/dist/node/src/document/index.d.ts +0 -6
  550. package/dist/node/src/document/reducer.d.ts +0 -65
  551. package/dist/node/src/document/schema/index.d.ts +0 -2
  552. package/dist/node/src/document/schema/types.d.ts +0 -176
  553. package/dist/node/src/document/schema/zod.d.ts +0 -116
  554. package/dist/node/src/document/types.d.ts +0 -271
  555. package/dist/node/src/document/utils/base.d.ts +0 -87
  556. package/dist/node/src/document/utils/crypto.d.ts +0 -9
  557. package/dist/node/src/document/utils/document-helpers.d.ts +0 -73
  558. package/dist/node/src/document/utils/index.d.ts +0 -6
  559. package/dist/node/src/document/utils/node.d.ts +0 -9
  560. package/dist/node/src/document/utils/validation.d.ts +0 -2
  561. package/dist/node/src/document-model/custom/reducers/header.d.ts +0 -2
  562. package/dist/node/src/document-model/custom/reducers/module.d.ts +0 -2
  563. package/dist/node/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  564. package/dist/node/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  565. package/dist/node/src/document-model/custom/reducers/operation.d.ts +0 -2
  566. package/dist/node/src/document-model/custom/reducers/state.d.ts +0 -2
  567. package/dist/node/src/document-model/custom/reducers/versioning.d.ts +0 -2
  568. package/dist/node/src/document-model/custom/utils.d.ts +0 -7
  569. package/dist/node/src/document-model/gen/actions.d.ts +0 -15
  570. package/dist/node/src/document-model/gen/creators.d.ts +0 -7
  571. package/dist/node/src/document-model/gen/document-model.d.ts +0 -2
  572. package/dist/node/src/document-model/gen/header/actions.d.ts +0 -9
  573. package/dist/node/src/document-model/gen/header/object.d.ts +0 -12
  574. package/dist/node/src/document-model/gen/index.d.ts +0 -5
  575. package/dist/node/src/document-model/gen/module/actions.d.ts +0 -8
  576. package/dist/node/src/document-model/gen/module/object.d.ts +0 -11
  577. package/dist/node/src/document-model/gen/module/operations.d.ts +0 -9
  578. package/dist/node/src/document-model/gen/object.d.ts +0 -28
  579. package/dist/node/src/document-model/gen/operation/actions.d.ts +0 -13
  580. package/dist/node/src/document-model/gen/operation/creators.d.ts +0 -12
  581. package/dist/node/src/document-model/gen/operation-error/actions.d.ts +0 -10
  582. package/dist/node/src/document-model/gen/operation-error/operations.d.ts +0 -11
  583. package/dist/node/src/document-model/gen/operation-example/actions.d.ts +0 -7
  584. package/dist/node/src/document-model/gen/operation-example/creators.d.ts +0 -6
  585. package/dist/node/src/document-model/gen/operation-example/object.d.ts +0 -10
  586. package/dist/node/src/document-model/gen/operation-example/operations.d.ts +0 -8
  587. package/dist/node/src/document-model/gen/reducer.d.ts +0 -5
  588. package/dist/node/src/document-model/gen/schema/index.d.ts +0 -2
  589. package/dist/node/src/document-model/gen/schema/types.d.ts +0 -453
  590. package/dist/node/src/document-model/gen/schema/zod.d.ts +0 -453
  591. package/dist/node/src/document-model/gen/state/actions.d.ts +0 -9
  592. package/dist/node/src/document-model/gen/state/creators.d.ts +0 -8
  593. package/dist/node/src/document-model/gen/state/object.d.ts +0 -12
  594. package/dist/node/src/document-model/gen/state/operations.d.ts +0 -10
  595. package/dist/node/src/document-model/gen/types.d.ts +0 -8
  596. package/dist/node/src/document-model/gen/utils.d.ts +0 -6
  597. package/dist/node/src/document-model/gen/versioning/actions.d.ts +0 -8
  598. package/dist/node/src/document-model/gen/versioning/creators.d.ts +0 -7
  599. package/dist/node/src/document-model/gen/versioning/object.d.ts +0 -11
  600. package/dist/node/src/document-model/gen/versioning/operations.d.ts +0 -9
  601. package/dist/node/src/document-model/index.d.ts +0 -76
  602. package/dist/node/src/index.d.ts +0 -24
  603. package/dist/node/test/document/crypto.test.d.ts +0 -1
  604. package/dist/node/test/document/event-vs-command.test.d.ts +0 -1
  605. package/dist/node/test/document/local.test.d.ts +0 -1
  606. package/dist/node/test/document/object.test.d.ts +0 -1
  607. package/dist/node/test/document/operation-id.test.d.ts +0 -1
  608. package/dist/node/test/document/prune.test.d.ts +0 -1
  609. package/dist/node/test/document/reducer.test.d.ts +0 -1
  610. package/dist/node/test/document/skip-operations.test.d.ts +0 -1
  611. package/dist/node/test/document/undo-redo.test.d.ts +0 -1
  612. package/dist/node/test/document/utils.test.d.ts +0 -1
  613. package/dist/node/test/document-helpers/addUndo.test.d.ts +0 -1
  614. package/dist/node/test/document-helpers/attachBranch.test.d.ts +0 -1
  615. package/dist/node/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts +0 -1
  616. package/dist/node/test/document-helpers/conflictResolution.test.d.ts +0 -1
  617. package/dist/node/test/document-helpers/filterDuplicatedOperations.test.d.ts +0 -1
  618. package/dist/node/test/document-helpers/garbageCollect.test.d.ts +0 -1
  619. package/dist/node/test/document-helpers/groupOperationsByScope.test.d.ts +0 -1
  620. package/dist/node/test/document-helpers/merge.test.d.ts +0 -1
  621. package/dist/node/test/document-helpers/nextSkipNumber.test.d.ts +0 -1
  622. package/dist/node/test/document-helpers/prepareOperations.test.d.ts +0 -1
  623. package/dist/node/test/document-helpers/removeExistingOperations.test.d.ts +0 -1
  624. package/dist/node/test/document-helpers/reshuffleByTimestamp.test.d.ts +0 -1
  625. package/dist/node/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts +0 -1
  626. package/dist/node/test/document-helpers/skipHeaderOperations.test.d.ts +0 -1
  627. package/dist/node/test/document-helpers/sortOperations.test.d.ts +0 -1
  628. package/dist/node/test/document-helpers/split.test.d.ts +0 -1
  629. package/dist/node/test/document-helpers/utils.d.ts +0 -7
  630. package/dist/node/test/document-model/object.test.d.ts +0 -1
  631. package/dist/node/test/document-model/replay.test.d.ts +0 -1
  632. package/dist/node/test/document-model/skip-operations.test.d.ts +0 -1
  633. package/dist/node/test/document-model/validation.test.d.ts +0 -1
  634. package/dist/node/test/document-model/zip.test.d.ts +0 -1
  635. package/dist/node/test/helpers.d.ts +0 -39
  636. package/dist/node/vite.config.d.ts +0 -2
  637. package/dist/node/vitest.config.d.ts +0 -2
@@ -1,2216 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- var _a;
5
- import { c as createReducer, i as isBaseAction, a as createExtendedState, b as createDocument, s as saveToFile, d as saveToFileHandle, l as loadFromFile, e as loadFromInput, f as createAction, B as BaseDocument, g as applyMixins, h as BaseActions } from "./object-BTIqCvb-.js";
6
- import "mutative";
7
- import "jszip";
8
- import { z } from "zod";
9
- const SPLIT_LOWER_UPPER_RE = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu");
10
- const SPLIT_UPPER_UPPER_RE = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu");
11
- const SPLIT_SEPARATE_NUMBER_RE = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u");
12
- const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
13
- const SPLIT_REPLACE_VALUE = "$1\0$2";
14
- const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
15
- function split(value) {
16
- let result = value.trim();
17
- result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
18
- result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
19
- let start = 0;
20
- let end = result.length;
21
- while (result.charAt(start) === "\0")
22
- start++;
23
- if (start === end)
24
- return [];
25
- while (result.charAt(end - 1) === "\0")
26
- end--;
27
- return result.slice(start, end).split(/\0/g);
28
- }
29
- function splitSeparateNumbers(value) {
30
- const words = split(value);
31
- for (let i = 0; i < words.length; i++) {
32
- const word = words[i];
33
- const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
34
- if (match) {
35
- const offset = match.index + (match[1] ?? match[2]).length;
36
- words.splice(i, 1, word.slice(0, offset), word.slice(offset));
37
- }
38
- }
39
- return words;
40
- }
41
- function pascalCase(input, options) {
42
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
43
- const lower = lowerFactory(options == null ? void 0 : options.locale);
44
- const upper = upperFactory(options == null ? void 0 : options.locale);
45
- const transform = pascalCaseTransformFactory(lower, upper);
46
- return prefix + words.map(transform).join("") + suffix;
47
- }
48
- function lowerFactory(locale) {
49
- return (input) => input.toLocaleLowerCase(locale);
50
- }
51
- function upperFactory(locale) {
52
- return (input) => input.toLocaleUpperCase(locale);
53
- }
54
- function pascalCaseTransformFactory(lower, upper) {
55
- return (word, index) => {
56
- const char0 = word[0];
57
- const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
58
- return initial + lower(word.slice(1));
59
- };
60
- }
61
- function splitPrefixSuffix(input, options = {}) {
62
- const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
63
- const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
64
- const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
65
- let prefixIndex = 0;
66
- let suffixIndex = input.length;
67
- while (prefixIndex < input.length) {
68
- const char = input.charAt(prefixIndex);
69
- if (!prefixCharacters.includes(char))
70
- break;
71
- prefixIndex++;
72
- }
73
- while (suffixIndex > prefixIndex) {
74
- const index = suffixIndex - 1;
75
- const char = input.charAt(index);
76
- if (!suffixCharacters.includes(char))
77
- break;
78
- suffixIndex = index;
79
- }
80
- return [
81
- input.slice(0, prefixIndex),
82
- splitFn(input.slice(prefixIndex, suffixIndex)),
83
- input.slice(suffixIndex)
84
- ];
85
- }
86
- function validateInitialState(initialState, allowEmptyState = false) {
87
- const errors = [];
88
- if (allowEmptyState && initialState === "") return errors;
89
- try {
90
- const state = JSON.parse(initialState);
91
- if (!allowEmptyState && !Object.keys(state).length) {
92
- errors.push({
93
- message: "Initial state cannot be empty",
94
- details: {
95
- initialState
96
- }
97
- });
98
- }
99
- } catch {
100
- errors.push({
101
- message: "Invalid initial state",
102
- details: {
103
- initialState
104
- }
105
- });
106
- }
107
- return errors;
108
- }
109
- function validateStateSchemaName(schema, documentName, scope = "", allowEmptySchema = true) {
110
- const errors = [];
111
- if (!allowEmptySchema && !schema) {
112
- errors.push({
113
- message: "State schema is required",
114
- details: {
115
- schema
116
- }
117
- });
118
- return errors;
119
- }
120
- if (allowEmptySchema && !schema) return errors;
121
- const expectedTypeName = `type ${pascalCase(documentName)}${pascalCase(scope)}State`;
122
- if (!schema.includes(expectedTypeName)) {
123
- errors.push({
124
- message: `Invalid state schema name. Expected ${expectedTypeName}`,
125
- details: {
126
- schema
127
- }
128
- });
129
- }
130
- return errors;
131
- }
132
- function validateModules(modules) {
133
- const errors = [];
134
- if (!modules.length) {
135
- errors.push({
136
- message: "Modules are required",
137
- details: {
138
- modules
139
- }
140
- });
141
- }
142
- const modulesError = modules.reduce(
143
- (acc, mod) => [...acc, ...validateModule(mod)],
144
- []
145
- );
146
- return [...errors, ...modulesError];
147
- }
148
- function validateModule(mod) {
149
- const errors = [];
150
- if (!mod.name) {
151
- errors.push({
152
- message: "Module name is required",
153
- details: {
154
- module: mod
155
- }
156
- });
157
- }
158
- if (!mod.operations.length) {
159
- errors.push({
160
- message: "Module operations are required",
161
- details: {
162
- module: mod
163
- }
164
- });
165
- }
166
- const operationErrors = mod.operations.reduce(
167
- (acc, operation) => [...acc, ...validateModuleOperation(operation)],
168
- []
169
- );
170
- return [...errors, ...operationErrors];
171
- }
172
- function validateModuleOperation(operation) {
173
- const errors = [];
174
- if (!operation.name) {
175
- errors.push({
176
- message: "Operation name is required",
177
- details: {
178
- operation
179
- }
180
- });
181
- }
182
- if (!operation.schema) {
183
- errors.push({
184
- message: "Operation schema is required",
185
- details: {
186
- operation
187
- }
188
- });
189
- }
190
- return errors;
191
- }
192
- const customUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
193
- __proto__: null,
194
- validateInitialState,
195
- validateModule,
196
- validateModuleOperation,
197
- validateModules,
198
- validateStateSchemaName
199
- }, Symbol.toStringTag, { value: "Module" }));
200
- const documentModel = {
201
- id: "powerhouse/document-model",
202
- name: "DocumentModel",
203
- extension: "phdm",
204
- description: "The Powerhouse Document Model describes the state and operations of a document type.",
205
- author: {
206
- name: "Powerhouse",
207
- website: "https://www.powerhouse.inc/"
208
- },
209
- specifications: [
210
- {
211
- version: 1,
212
- changeLog: [],
213
- modules: [
214
- {
215
- name: "header",
216
- operations: [
217
- {
218
- name: "SetModelName",
219
- id: "",
220
- description: "",
221
- schema: "",
222
- template: "",
223
- reducer: "",
224
- examples: [],
225
- errors: [],
226
- scope: "global"
227
- },
228
- {
229
- name: "SetModelId",
230
- id: "",
231
- description: "",
232
- schema: "",
233
- template: "",
234
- reducer: "",
235
- examples: [],
236
- errors: [],
237
- scope: "global"
238
- },
239
- {
240
- name: "SetModelExtension",
241
- id: "",
242
- description: "",
243
- schema: "",
244
- template: "",
245
- reducer: "",
246
- examples: [],
247
- errors: [],
248
- scope: "global"
249
- },
250
- {
251
- name: "SetModelDescription",
252
- id: "",
253
- description: "",
254
- schema: "",
255
- template: "",
256
- reducer: "",
257
- examples: [],
258
- errors: [],
259
- scope: "global"
260
- },
261
- {
262
- name: "SetAuthorName",
263
- id: "",
264
- description: "",
265
- schema: "",
266
- template: "",
267
- reducer: "",
268
- examples: [],
269
- errors: [],
270
- scope: "global"
271
- },
272
- {
273
- name: "SetAuthorWebsite",
274
- id: "",
275
- description: "",
276
- schema: "",
277
- template: "",
278
- reducer: "",
279
- examples: [],
280
- errors: [],
281
- scope: "global"
282
- }
283
- ],
284
- id: "",
285
- description: ""
286
- },
287
- {
288
- name: "versioning",
289
- operations: [
290
- {
291
- name: "AddChangeLogItem",
292
- id: "",
293
- description: "",
294
- schema: "",
295
- template: "",
296
- reducer: "",
297
- examples: [],
298
- errors: [],
299
- scope: "global"
300
- },
301
- {
302
- name: "UpdateChangeLogItem",
303
- id: "",
304
- description: "",
305
- schema: "",
306
- template: "",
307
- reducer: "",
308
- examples: [],
309
- errors: [],
310
- scope: "global"
311
- },
312
- {
313
- name: "DeleteChangeLogItem",
314
- id: "",
315
- description: "",
316
- schema: "",
317
- template: "",
318
- reducer: "",
319
- examples: [],
320
- errors: [],
321
- scope: "global"
322
- },
323
- {
324
- name: "ReorderChangeLogItems",
325
- id: "",
326
- description: "",
327
- schema: "",
328
- template: "",
329
- reducer: "",
330
- examples: [],
331
- errors: [],
332
- scope: "global"
333
- },
334
- {
335
- name: "ReleaseNewVersion",
336
- schema: null,
337
- id: "",
338
- description: "",
339
- template: "",
340
- reducer: "",
341
- examples: [],
342
- errors: [],
343
- scope: "global"
344
- }
345
- ],
346
- id: "",
347
- description: ""
348
- },
349
- {
350
- name: "module",
351
- operations: [
352
- {
353
- name: "AddModule",
354
- id: "",
355
- description: "",
356
- schema: "",
357
- template: "",
358
- reducer: "",
359
- examples: [],
360
- errors: [],
361
- scope: "global"
362
- },
363
- {
364
- name: "SetModuleName",
365
- id: "",
366
- description: "",
367
- schema: "",
368
- template: "",
369
- reducer: "",
370
- examples: [],
371
- errors: [],
372
- scope: "global"
373
- },
374
- {
375
- name: "SetModuleDescription",
376
- id: "",
377
- description: "",
378
- schema: "",
379
- template: "",
380
- reducer: "",
381
- examples: [],
382
- errors: [],
383
- scope: "global"
384
- },
385
- {
386
- name: "DeleteModule",
387
- id: "",
388
- description: "",
389
- schema: "",
390
- template: "",
391
- reducer: "",
392
- examples: [],
393
- errors: [],
394
- scope: "global"
395
- },
396
- {
397
- name: "ReorderModules",
398
- id: "",
399
- description: "",
400
- schema: "",
401
- template: "",
402
- reducer: "",
403
- examples: [],
404
- errors: [],
405
- scope: "global"
406
- }
407
- ],
408
- id: "",
409
- description: ""
410
- },
411
- {
412
- name: "operation-error",
413
- operations: [
414
- {
415
- name: "AddOperationError",
416
- id: "",
417
- description: "",
418
- schema: "",
419
- template: "",
420
- reducer: "",
421
- examples: [],
422
- errors: [],
423
- scope: "global"
424
- },
425
- {
426
- name: "SetOperationErrorCode",
427
- id: "",
428
- description: "",
429
- schema: "",
430
- template: "",
431
- reducer: "",
432
- examples: [],
433
- errors: [],
434
- scope: "global"
435
- },
436
- {
437
- name: "SetOperationErrorName",
438
- id: "",
439
- description: "",
440
- schema: "",
441
- template: "",
442
- reducer: "",
443
- examples: [],
444
- errors: [],
445
- scope: "global"
446
- },
447
- {
448
- name: "SetOperationErrorDescription",
449
- id: "",
450
- description: "",
451
- schema: "",
452
- template: "",
453
- reducer: "",
454
- examples: [],
455
- errors: [],
456
- scope: "global"
457
- },
458
- {
459
- name: "SetOperationErrorTemplate",
460
- id: "",
461
- description: "",
462
- schema: "",
463
- template: "",
464
- reducer: "",
465
- examples: [],
466
- errors: [],
467
- scope: "global"
468
- },
469
- {
470
- name: "DeleteOperationError",
471
- id: "",
472
- description: "",
473
- schema: "",
474
- template: "",
475
- reducer: "",
476
- examples: [],
477
- errors: [],
478
- scope: "global"
479
- },
480
- {
481
- name: "ReorderOperationErrors",
482
- id: "",
483
- description: "",
484
- schema: "",
485
- template: "",
486
- reducer: "",
487
- examples: [],
488
- errors: [],
489
- scope: "global"
490
- }
491
- ],
492
- id: "",
493
- description: ""
494
- },
495
- {
496
- name: "operation-example",
497
- operations: [
498
- {
499
- name: "AddOperationExample",
500
- id: "",
501
- description: "",
502
- schema: "",
503
- template: "",
504
- reducer: "",
505
- examples: [],
506
- errors: [],
507
- scope: "global"
508
- },
509
- {
510
- name: "UpdateOperationExample",
511
- id: "",
512
- description: "",
513
- schema: "",
514
- template: "",
515
- reducer: "",
516
- examples: [],
517
- errors: [],
518
- scope: "global"
519
- },
520
- {
521
- name: "DeleteOperationExample",
522
- id: "",
523
- description: "",
524
- schema: "",
525
- template: "",
526
- reducer: "",
527
- examples: [],
528
- errors: [],
529
- scope: "global"
530
- },
531
- {
532
- name: "ReorderOperationExamples",
533
- id: "",
534
- description: "",
535
- schema: "",
536
- template: "",
537
- reducer: "",
538
- examples: [],
539
- errors: [],
540
- scope: "global"
541
- }
542
- ],
543
- id: "",
544
- description: ""
545
- },
546
- {
547
- name: "operation",
548
- operations: [
549
- {
550
- name: "AddOperation",
551
- id: "",
552
- description: "",
553
- schema: "",
554
- template: "",
555
- reducer: "",
556
- examples: [],
557
- errors: [],
558
- scope: "global"
559
- },
560
- {
561
- name: "SetOperationName",
562
- id: "",
563
- description: "",
564
- schema: "",
565
- template: "",
566
- reducer: "",
567
- examples: [],
568
- errors: [],
569
- scope: "global"
570
- },
571
- {
572
- name: "SetOperationSchema",
573
- id: "",
574
- description: "",
575
- schema: "",
576
- template: "",
577
- reducer: "",
578
- examples: [],
579
- errors: [],
580
- scope: "global"
581
- },
582
- {
583
- name: "SetOperationDescription",
584
- id: "",
585
- description: "",
586
- schema: "",
587
- template: "",
588
- reducer: "",
589
- examples: [],
590
- errors: [],
591
- scope: "global"
592
- },
593
- {
594
- name: "SetOperationTemplate",
595
- id: "",
596
- description: "",
597
- schema: "",
598
- template: "",
599
- reducer: "",
600
- examples: [],
601
- errors: [],
602
- scope: "global"
603
- },
604
- {
605
- name: "SetOperationReducer",
606
- id: "",
607
- description: "",
608
- schema: "",
609
- template: "",
610
- reducer: "",
611
- examples: [],
612
- errors: [],
613
- scope: "global"
614
- },
615
- {
616
- name: "MoveOperation",
617
- id: "",
618
- description: "",
619
- schema: "",
620
- template: "",
621
- reducer: "",
622
- examples: [],
623
- errors: [],
624
- scope: "global"
625
- },
626
- {
627
- name: "DeleteOperation",
628
- id: "",
629
- description: "",
630
- schema: "",
631
- template: "",
632
- reducer: "",
633
- examples: [],
634
- errors: [],
635
- scope: "global"
636
- },
637
- {
638
- name: "ReorderModuleOperations",
639
- id: "",
640
- description: "",
641
- schema: "",
642
- template: "",
643
- reducer: "",
644
- examples: [],
645
- errors: [],
646
- scope: "global"
647
- }
648
- ],
649
- id: "",
650
- description: ""
651
- },
652
- {
653
- name: "state",
654
- operations: [
655
- {
656
- name: "SetStateSchema",
657
- id: "",
658
- description: "",
659
- schema: "",
660
- template: "",
661
- reducer: "",
662
- examples: [],
663
- errors: [],
664
- scope: "global"
665
- },
666
- {
667
- name: "SetInitialState",
668
- id: "",
669
- description: "",
670
- schema: "",
671
- template: "",
672
- reducer: "",
673
- examples: [],
674
- errors: [],
675
- scope: "global"
676
- },
677
- {
678
- name: "AddStateExample",
679
- id: "",
680
- description: "",
681
- schema: "",
682
- template: "",
683
- reducer: "",
684
- examples: [],
685
- errors: [],
686
- scope: "global"
687
- },
688
- {
689
- name: "UpdateStateExample",
690
- id: "",
691
- description: "",
692
- schema: "",
693
- template: "",
694
- reducer: "",
695
- examples: [],
696
- errors: [],
697
- scope: "global"
698
- },
699
- {
700
- name: "DeleteStateExample",
701
- id: "",
702
- description: "",
703
- schema: "",
704
- template: "",
705
- reducer: "",
706
- examples: [],
707
- errors: [],
708
- scope: "global"
709
- },
710
- {
711
- name: "ReorderStateExamples",
712
- id: "",
713
- description: "",
714
- schema: "",
715
- template: "",
716
- reducer: "",
717
- examples: [],
718
- errors: [],
719
- scope: "global"
720
- }
721
- ],
722
- id: "",
723
- description: ""
724
- }
725
- ],
726
- state: {
727
- global: {
728
- schema: "",
729
- initialValue: '{\n "id": "",\n "name": "",\n "extension": "",\n "description": "",\n "author": {\n "name": "",\n "website": ""\n },\n "specifications": [\n {\n "version": 1,\n "changeLog": [],\n "state": {\n "schema": "",\n "initialValue": "",\n "examples": []\n },\n "modules": []\n }\n ]\n}',
730
- examples: []
731
- },
732
- local: {
733
- schema: "",
734
- initialValue: `{}`,
735
- examples: []
736
- }
737
- }
738
- }
739
- ]
740
- };
741
- const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
742
- const definedNonNullAnySchema = z.any().refine((v) => isDefinedNonNullAny(v));
743
- function AddChangeLogItemInputSchema() {
744
- return z.object({
745
- __typename: z.literal("AddChangeLogItemInput").optional(),
746
- content: z.string(),
747
- id: z.string(),
748
- insertBefore: z.string().nullable()
749
- });
750
- }
751
- function AddModuleInputSchema() {
752
- return z.object({
753
- description: z.string().nullish(),
754
- id: z.string(),
755
- name: z.string()
756
- });
757
- }
758
- function AddOperationErrorInputSchema() {
759
- return z.object({
760
- errorCode: z.string().nullish(),
761
- errorDescription: z.string().nullish(),
762
- errorName: z.string().nullish(),
763
- errorTemplate: z.string().nullish(),
764
- id: z.string(),
765
- operationId: z.string()
766
- });
767
- }
768
- function AddOperationExampleInputSchema() {
769
- return z.object({
770
- example: z.string(),
771
- id: z.string(),
772
- operationId: z.string()
773
- });
774
- }
775
- function AddOperationInputSchema() {
776
- return z.object({
777
- description: z.string().nullish(),
778
- id: z.string(),
779
- moduleId: z.string(),
780
- name: z.string(),
781
- reducer: z.string().nullish(),
782
- schema: z.string().nullish(),
783
- template: z.string().nullish(),
784
- scope: OperationScopeSchema().nullish()
785
- });
786
- }
787
- function AddStateExampleInputSchema() {
788
- return z.object({
789
- scope: z.string(),
790
- example: z.string(),
791
- id: z.string(),
792
- insertBefore: z.string().nullish()
793
- });
794
- }
795
- function AuthorSchema() {
796
- return z.object({
797
- __typename: z.literal("Author").optional(),
798
- name: z.string(),
799
- website: z.string().nullable()
800
- });
801
- }
802
- function CodeExampleSchema() {
803
- return z.object({
804
- __typename: z.literal("CodeExample").optional(),
805
- id: z.string(),
806
- value: z.string()
807
- });
808
- }
809
- function DeleteChangeLogItemInputSchema() {
810
- return z.object({
811
- __typename: z.literal("DeleteChangeLogItemInput").optional(),
812
- id: z.string()
813
- });
814
- }
815
- function DeleteModuleInputSchema() {
816
- return z.object({
817
- id: z.string()
818
- });
819
- }
820
- function DeleteOperationErrorInputSchema() {
821
- return z.object({
822
- id: z.string()
823
- });
824
- }
825
- function DeleteOperationExampleInputSchema() {
826
- return z.object({
827
- id: z.string()
828
- });
829
- }
830
- function DeleteOperationInputSchema() {
831
- return z.object({
832
- id: z.string()
833
- });
834
- }
835
- function DeleteStateExampleInputSchema() {
836
- return z.object({
837
- scope: z.string(),
838
- id: z.string()
839
- });
840
- }
841
- function OperationScopeSchema() {
842
- return z.literal("global").or(z.literal("local"));
843
- }
844
- function DocumentModelInputSchema() {
845
- return z.union([
846
- AddChangeLogItemInputSchema(),
847
- AddModuleInputSchema(),
848
- AddOperationErrorInputSchema(),
849
- AddOperationExampleInputSchema(),
850
- AddOperationInputSchema(),
851
- AddStateExampleInputSchema(),
852
- DeleteChangeLogItemInputSchema(),
853
- DeleteModuleInputSchema(),
854
- DeleteOperationErrorInputSchema(),
855
- DeleteOperationExampleInputSchema(),
856
- DeleteOperationInputSchema(),
857
- DeleteStateExampleInputSchema(),
858
- MoveOperationInputSchema(),
859
- ReorderChangeLogItemsInputSchema(),
860
- ReorderModuleOperationsInputSchema(),
861
- ReorderModulesInputSchema(),
862
- ReorderOperationErrorsInputSchema(),
863
- ReorderOperationExamplesInputSchema(),
864
- ReorderStateExamplesInputSchema(),
865
- SetAuthorNameInputSchema(),
866
- SetAuthorWebsiteInputSchema(),
867
- SetInitialStateInputSchema(),
868
- SetModelDescriptionInputSchema(),
869
- SetModelExtensionInputSchema(),
870
- SetModelIdInputSchema(),
871
- SetModelNameInputSchema(),
872
- SetModuleDescriptionInputSchema(),
873
- SetModuleNameInputSchema(),
874
- SetOperationDescriptionInputSchema(),
875
- SetOperationErrorCodeInputSchema(),
876
- SetOperationErrorDescriptionInputSchema(),
877
- SetOperationErrorNameInputSchema(),
878
- SetOperationErrorTemplateInputSchema(),
879
- SetOperationNameInputSchema(),
880
- SetOperationReducerInputSchema(),
881
- SetOperationSchemaInputSchema(),
882
- SetOperationTemplateInputSchema(),
883
- SetStateSchemaInputSchema(),
884
- UpdateChangeLogItemInputSchema(),
885
- UpdateOperationExampleInputSchema(),
886
- UpdateStateExampleInputSchema()
887
- ]);
888
- }
889
- function DocumentModelStateSchema() {
890
- return z.object({
891
- __typename: z.literal("DocumentModelState").optional(),
892
- author: AuthorSchema(),
893
- description: z.string(),
894
- extension: z.string(),
895
- id: z.string(),
896
- name: z.string(),
897
- specifications: z.array(DocumentSpecificationSchema())
898
- });
899
- }
900
- function DocumentSpecificationSchema() {
901
- return z.object({
902
- __typename: z.literal("DocumentSpecification").optional(),
903
- changeLog: z.array(z.string()),
904
- modules: z.array(ModuleSchema()),
905
- state: ScopeStateSchema(),
906
- version: z.number()
907
- });
908
- }
909
- function ModuleSchema() {
910
- return z.object({
911
- __typename: z.literal("Module").optional(),
912
- description: z.string().nullable(),
913
- id: z.string(),
914
- name: z.string(),
915
- operations: z.array(OperationSchema())
916
- });
917
- }
918
- function MoveOperationInputSchema() {
919
- return z.object({
920
- newModuleId: z.string(),
921
- operationId: z.string()
922
- });
923
- }
924
- function OperationSchema() {
925
- return z.object({
926
- __typename: z.literal("Operation").optional(),
927
- description: z.string().nullable(),
928
- errors: z.array(OperationErrorSchema()),
929
- examples: z.array(CodeExampleSchema()),
930
- id: z.string(),
931
- name: z.string().nullable(),
932
- reducer: z.string().nullable(),
933
- schema: z.string().nullable(),
934
- template: z.string().nullable(),
935
- scope: OperationScopeSchema()
936
- });
937
- }
938
- function OperationErrorSchema() {
939
- return z.object({
940
- __typename: z.literal("OperationError").optional(),
941
- code: z.string().nullable(),
942
- description: z.string().nullable(),
943
- id: z.string(),
944
- name: z.string().nullable(),
945
- template: z.string().nullable()
946
- });
947
- }
948
- function ReorderChangeLogItemsInputSchema() {
949
- return z.object({
950
- __typename: z.literal("ReorderChangeLogItemsInput").optional(),
951
- order: z.array(z.string())
952
- });
953
- }
954
- function ReorderModuleOperationsInputSchema() {
955
- return z.object({
956
- moduleId: z.string(),
957
- order: z.array(z.string())
958
- });
959
- }
960
- function ReorderModulesInputSchema() {
961
- return z.object({
962
- order: z.array(z.string())
963
- });
964
- }
965
- function ReorderOperationErrorsInputSchema() {
966
- return z.object({
967
- operationId: z.string(),
968
- order: z.array(z.string())
969
- });
970
- }
971
- function ReorderOperationExamplesInputSchema() {
972
- return z.object({
973
- operationId: z.string(),
974
- order: z.array(z.string())
975
- });
976
- }
977
- function ReorderStateExamplesInputSchema() {
978
- return z.object({
979
- scope: z.string(),
980
- order: z.array(z.string())
981
- });
982
- }
983
- function SetAuthorNameInputSchema() {
984
- return z.object({
985
- authorName: z.string()
986
- });
987
- }
988
- function SetAuthorWebsiteInputSchema() {
989
- return z.object({
990
- authorWebsite: z.string()
991
- });
992
- }
993
- function SetInitialStateInputSchema() {
994
- return z.object({
995
- scope: z.string(),
996
- initialValue: z.string()
997
- });
998
- }
999
- function SetModelDescriptionInputSchema() {
1000
- return z.object({
1001
- description: z.string()
1002
- });
1003
- }
1004
- function SetModelExtensionInputSchema() {
1005
- return z.object({
1006
- extension: z.string()
1007
- });
1008
- }
1009
- function SetModelIdInputSchema() {
1010
- return z.object({
1011
- id: z.string()
1012
- });
1013
- }
1014
- function SetModelNameInputSchema() {
1015
- return z.object({
1016
- name: z.string()
1017
- });
1018
- }
1019
- function SetModuleDescriptionInputSchema() {
1020
- return z.object({
1021
- description: z.string().nullish(),
1022
- id: z.string()
1023
- });
1024
- }
1025
- function SetModuleNameInputSchema() {
1026
- return z.object({
1027
- id: z.string(),
1028
- name: z.string().nullish()
1029
- });
1030
- }
1031
- function SetOperationDescriptionInputSchema() {
1032
- return z.object({
1033
- description: z.string().nullish(),
1034
- id: z.string()
1035
- });
1036
- }
1037
- function SetOperationErrorCodeInputSchema() {
1038
- return z.object({
1039
- errorCode: z.string().nullish(),
1040
- id: z.string()
1041
- });
1042
- }
1043
- function SetOperationErrorDescriptionInputSchema() {
1044
- return z.object({
1045
- errorDescription: z.string().nullish(),
1046
- id: z.string()
1047
- });
1048
- }
1049
- function SetOperationErrorNameInputSchema() {
1050
- return z.object({
1051
- errorName: z.string().nullish(),
1052
- id: z.string()
1053
- });
1054
- }
1055
- function SetOperationErrorTemplateInputSchema() {
1056
- return z.object({
1057
- errorTemplate: z.string().nullish(),
1058
- id: z.string()
1059
- });
1060
- }
1061
- function SetOperationNameInputSchema() {
1062
- return z.object({
1063
- id: z.string(),
1064
- name: z.string().nullish()
1065
- });
1066
- }
1067
- function SetOperationScopeInputSchema() {
1068
- return z.object({
1069
- id: z.string(),
1070
- scope: OperationScopeSchema()
1071
- });
1072
- }
1073
- function SetOperationReducerInputSchema() {
1074
- return z.object({
1075
- id: z.string(),
1076
- reducer: z.string().nullish()
1077
- });
1078
- }
1079
- function SetOperationSchemaInputSchema() {
1080
- return z.object({
1081
- id: z.string(),
1082
- schema: z.string().nullish()
1083
- });
1084
- }
1085
- function SetOperationTemplateInputSchema() {
1086
- return z.object({
1087
- id: z.string(),
1088
- template: z.string().nullish()
1089
- });
1090
- }
1091
- function SetStateSchemaInputSchema() {
1092
- return z.object({
1093
- scope: z.string(),
1094
- schema: z.string()
1095
- });
1096
- }
1097
- function StateSchema() {
1098
- return z.object({
1099
- __typename: z.literal("State").optional(),
1100
- examples: z.array(CodeExampleSchema()),
1101
- initialValue: z.string(),
1102
- schema: z.string()
1103
- });
1104
- }
1105
- function ScopeStateSchema() {
1106
- return z.object({
1107
- global: StateSchema(),
1108
- local: StateSchema()
1109
- });
1110
- }
1111
- function UpdateChangeLogItemInputSchema() {
1112
- return z.object({
1113
- __typename: z.literal("UpdateChangeLogItemInput").optional(),
1114
- id: z.string(),
1115
- newContent: z.string()
1116
- });
1117
- }
1118
- function UpdateOperationExampleInputSchema() {
1119
- return z.object({
1120
- example: z.string(),
1121
- id: z.string()
1122
- });
1123
- }
1124
- function UpdateStateExampleInputSchema() {
1125
- return z.object({
1126
- scope: z.string(),
1127
- id: z.string(),
1128
- newExample: z.string()
1129
- });
1130
- }
1131
- const zod = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1132
- __proto__: null,
1133
- AddChangeLogItemInputSchema,
1134
- AddModuleInputSchema,
1135
- AddOperationErrorInputSchema,
1136
- AddOperationExampleInputSchema,
1137
- AddOperationInputSchema,
1138
- AddStateExampleInputSchema,
1139
- AuthorSchema,
1140
- CodeExampleSchema,
1141
- DeleteChangeLogItemInputSchema,
1142
- DeleteModuleInputSchema,
1143
- DeleteOperationErrorInputSchema,
1144
- DeleteOperationExampleInputSchema,
1145
- DeleteOperationInputSchema,
1146
- DeleteStateExampleInputSchema,
1147
- DocumentModelInputSchema,
1148
- DocumentModelStateSchema,
1149
- DocumentSpecificationSchema,
1150
- ModuleSchema,
1151
- MoveOperationInputSchema,
1152
- OperationErrorSchema,
1153
- OperationSchema,
1154
- OperationScopeSchema,
1155
- ReorderChangeLogItemsInputSchema,
1156
- ReorderModuleOperationsInputSchema,
1157
- ReorderModulesInputSchema,
1158
- ReorderOperationErrorsInputSchema,
1159
- ReorderOperationExamplesInputSchema,
1160
- ReorderStateExamplesInputSchema,
1161
- ScopeStateSchema,
1162
- SetAuthorNameInputSchema,
1163
- SetAuthorWebsiteInputSchema,
1164
- SetInitialStateInputSchema,
1165
- SetModelDescriptionInputSchema,
1166
- SetModelExtensionInputSchema,
1167
- SetModelIdInputSchema,
1168
- SetModelNameInputSchema,
1169
- SetModuleDescriptionInputSchema,
1170
- SetModuleNameInputSchema,
1171
- SetOperationDescriptionInputSchema,
1172
- SetOperationErrorCodeInputSchema,
1173
- SetOperationErrorDescriptionInputSchema,
1174
- SetOperationErrorNameInputSchema,
1175
- SetOperationErrorTemplateInputSchema,
1176
- SetOperationNameInputSchema,
1177
- SetOperationReducerInputSchema,
1178
- SetOperationSchemaInputSchema,
1179
- SetOperationScopeInputSchema,
1180
- SetOperationTemplateInputSchema,
1181
- SetStateSchemaInputSchema,
1182
- StateSchema,
1183
- UpdateChangeLogItemInputSchema,
1184
- UpdateOperationExampleInputSchema,
1185
- UpdateStateExampleInputSchema,
1186
- definedNonNullAnySchema,
1187
- isDefinedNonNullAny
1188
- }, Symbol.toStringTag, { value: "Module" }));
1189
- const reducer$7 = {
1190
- setModelNameOperation(state, action) {
1191
- state.name = action.input.name;
1192
- },
1193
- setModelIdOperation(state, action) {
1194
- state.id = action.input.id;
1195
- },
1196
- setModelExtensionOperation(state, action) {
1197
- state.extension = action.input.extension;
1198
- },
1199
- setModelDescriptionOperation(state, action) {
1200
- state.description = action.input.description;
1201
- },
1202
- setAuthorNameOperation(state, action) {
1203
- state.author = state.author || { name: "", website: null };
1204
- state.author.name = action.input.authorName;
1205
- },
1206
- setAuthorWebsiteOperation(state, action) {
1207
- state.author = state.author || { name: "", website: null };
1208
- state.author.website = action.input.authorWebsite;
1209
- }
1210
- };
1211
- const reducer$6 = {
1212
- addChangeLogItemOperation(state, action) {
1213
- throw new Error('Reducer "addChangeLogItemOperation" not yet implemented');
1214
- },
1215
- updateChangeLogItemOperation(state, action) {
1216
- throw new Error(
1217
- 'Reducer "updateChangeLogItemOperation" not yet implemented'
1218
- );
1219
- },
1220
- deleteChangeLogItemOperation(state, action) {
1221
- throw new Error(
1222
- 'Reducer "deleteChangeLogItemOperation" not yet implemented'
1223
- );
1224
- },
1225
- reorderChangeLogItemsOperation(state, action) {
1226
- throw new Error(
1227
- 'Reducer "reorderChangeLogItemsOperation" not yet implemented'
1228
- );
1229
- },
1230
- releaseNewVersionOperation(state, action) {
1231
- throw new Error('Reducer "releaseNewVersionOperation" not yet implemented');
1232
- }
1233
- };
1234
- const moduleSorter = (order) => {
1235
- const mapping = {};
1236
- order.forEach((key, index) => mapping[key] = index);
1237
- return (a, b) => (mapping[b.id] || 999999) - (mapping[a.id] || 999999);
1238
- };
1239
- const reducer$5 = {
1240
- addModuleOperation(state, action) {
1241
- const latestSpec = state.specifications[state.specifications.length - 1];
1242
- latestSpec.modules.push({
1243
- id: action.input.id,
1244
- name: action.input.name,
1245
- description: action.input.description || "",
1246
- operations: []
1247
- });
1248
- },
1249
- setModuleNameOperation(state, action) {
1250
- const latestSpec = state.specifications[state.specifications.length - 1];
1251
- for (let i = 0; i < latestSpec.modules.length; i++) {
1252
- if (latestSpec.modules[i].id === action.input.id) {
1253
- latestSpec.modules[i].name = action.input.name || "";
1254
- }
1255
- }
1256
- },
1257
- setModuleDescriptionOperation(state, action) {
1258
- const latestSpec = state.specifications[state.specifications.length - 1];
1259
- for (let i = 0; i < latestSpec.modules.length; i++) {
1260
- if (latestSpec.modules[i].id === action.input.id) {
1261
- latestSpec.modules[i].description = action.input.description || "";
1262
- }
1263
- }
1264
- },
1265
- deleteModuleOperation(state, action) {
1266
- const latestSpec = state.specifications[state.specifications.length - 1];
1267
- latestSpec.modules = latestSpec.modules.filter(
1268
- (m) => m.id != action.input.id
1269
- );
1270
- },
1271
- reorderModulesOperation(state, action) {
1272
- const latestSpec = state.specifications[state.specifications.length - 1];
1273
- latestSpec.modules.sort(moduleSorter(action.input.order));
1274
- }
1275
- };
1276
- const errorSorter = (order) => {
1277
- const mapping = {};
1278
- order.forEach((key, index) => mapping[key] = index);
1279
- return (a, b) => (mapping[b.id] || 999999) - (mapping[a.id] || 999999);
1280
- };
1281
- const reducer$4 = {
1282
- addOperationErrorOperation(state, action) {
1283
- const latestSpec = state.specifications[state.specifications.length - 1];
1284
- for (let i = 0; i < latestSpec.modules.length; i++) {
1285
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1286
- if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
1287
- latestSpec.modules[i].operations[j].errors.push({
1288
- id: action.input.id,
1289
- name: action.input.errorName || "",
1290
- code: action.input.errorCode || "",
1291
- description: action.input.errorDescription || "",
1292
- template: action.input.errorTemplate || ""
1293
- });
1294
- }
1295
- }
1296
- }
1297
- },
1298
- setOperationErrorCodeOperation(state, action) {
1299
- const latestSpec = state.specifications[state.specifications.length - 1];
1300
- for (let i = 0; i < latestSpec.modules.length; i++) {
1301
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1302
- for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
1303
- if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) {
1304
- latestSpec.modules[i].operations[j].errors[k].code = action.input.errorCode || "";
1305
- }
1306
- }
1307
- }
1308
- }
1309
- },
1310
- setOperationErrorNameOperation(state, action) {
1311
- const latestSpec = state.specifications[state.specifications.length - 1];
1312
- for (let i = 0; i < latestSpec.modules.length; i++) {
1313
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1314
- for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
1315
- if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) {
1316
- latestSpec.modules[i].operations[j].errors[k].name = action.input.errorName || "";
1317
- }
1318
- }
1319
- }
1320
- }
1321
- },
1322
- setOperationErrorDescriptionOperation(state, action) {
1323
- const latestSpec = state.specifications[state.specifications.length - 1];
1324
- for (let i = 0; i < latestSpec.modules.length; i++) {
1325
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1326
- for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
1327
- if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) {
1328
- latestSpec.modules[i].operations[j].errors[k].description = action.input.errorDescription || "";
1329
- }
1330
- }
1331
- }
1332
- }
1333
- },
1334
- setOperationErrorTemplateOperation(state, action) {
1335
- const latestSpec = state.specifications[state.specifications.length - 1];
1336
- for (let i = 0; i < latestSpec.modules.length; i++) {
1337
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1338
- for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
1339
- if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) {
1340
- latestSpec.modules[i].operations[j].errors[k].template = action.input.errorTemplate || "";
1341
- }
1342
- }
1343
- }
1344
- }
1345
- },
1346
- deleteOperationErrorOperation(state, action) {
1347
- const latestSpec = state.specifications[state.specifications.length - 1];
1348
- for (let i = 0; i < latestSpec.modules.length; i++) {
1349
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1350
- latestSpec.modules[i].operations[j].errors = latestSpec.modules[i].operations[j].errors.filter((e) => e.id != action.input.id);
1351
- }
1352
- }
1353
- },
1354
- reorderOperationErrorsOperation(state, action) {
1355
- const latestSpec = state.specifications[state.specifications.length - 1];
1356
- for (let i = 0; i < latestSpec.modules.length; i++) {
1357
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1358
- if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
1359
- latestSpec.modules[i].operations[j].errors.sort(
1360
- errorSorter(action.input.order)
1361
- );
1362
- }
1363
- }
1364
- }
1365
- }
1366
- };
1367
- const exampleSorter$1 = (order) => {
1368
- const mapping = {};
1369
- order.forEach((key, index) => mapping[key] = index);
1370
- return (a, b) => (mapping[b.id] || 999999) - (mapping[a.id] || 999999);
1371
- };
1372
- const reducer$3 = {
1373
- addOperationExampleOperation(state, action) {
1374
- const latestSpec = state.specifications[state.specifications.length - 1];
1375
- for (let i = 0; i < latestSpec.modules.length; i++) {
1376
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1377
- if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
1378
- latestSpec.modules[i].operations[j].examples.push({
1379
- id: action.input.id,
1380
- value: action.input.example
1381
- });
1382
- }
1383
- }
1384
- }
1385
- },
1386
- updateOperationExampleOperation(state, action) {
1387
- const latestSpec = state.specifications[state.specifications.length - 1];
1388
- for (let i = 0; i < latestSpec.modules.length; i++) {
1389
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1390
- for (let k = 0; k < latestSpec.modules[i].operations[j].examples.length; k++) {
1391
- if (latestSpec.modules[i].operations[j].examples[k].id == action.input.id) {
1392
- latestSpec.modules[i].operations[j].examples[k].value = action.input.example;
1393
- }
1394
- }
1395
- }
1396
- }
1397
- },
1398
- deleteOperationExampleOperation(state, action) {
1399
- const latestSpec = state.specifications[state.specifications.length - 1];
1400
- for (let i = 0; i < latestSpec.modules.length; i++) {
1401
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1402
- latestSpec.modules[i].operations[j].examples = latestSpec.modules[i].operations[j].examples.filter((e) => e.id != action.input.id);
1403
- }
1404
- }
1405
- },
1406
- reorderOperationExamplesOperation(state, action) {
1407
- const latestSpec = state.specifications[state.specifications.length - 1];
1408
- for (let i = 0; i < latestSpec.modules.length; i++) {
1409
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1410
- if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
1411
- latestSpec.modules[i].operations[j].examples.sort(
1412
- exampleSorter$1(action.input.order)
1413
- );
1414
- }
1415
- }
1416
- }
1417
- }
1418
- };
1419
- const operationSorter = (order) => {
1420
- const mapping = {};
1421
- order.forEach((key, index) => mapping[key] = index);
1422
- return (a, b) => (mapping[b.id] || 999999) - (mapping[a.id] || 999999);
1423
- };
1424
- const reducer$2 = {
1425
- addOperationOperation(state, action) {
1426
- const latestSpec = state.specifications[state.specifications.length - 1];
1427
- for (let i = 0; i < latestSpec.modules.length; i++) {
1428
- if (latestSpec.modules[i].id == action.input.moduleId) {
1429
- latestSpec.modules[i].operations.push({
1430
- id: action.input.id,
1431
- name: action.input.name,
1432
- description: action.input.description || "",
1433
- schema: action.input.schema || "",
1434
- template: action.input.template || action.input.description || "",
1435
- reducer: action.input.reducer || "",
1436
- errors: [],
1437
- examples: [],
1438
- scope: action.input.scope || "global"
1439
- });
1440
- }
1441
- }
1442
- },
1443
- setOperationNameOperation(state, action) {
1444
- const latestSpec = state.specifications[state.specifications.length - 1];
1445
- for (let i = 0; i < latestSpec.modules.length; i++) {
1446
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1447
- if (latestSpec.modules[i].operations[j].id == action.input.id) {
1448
- latestSpec.modules[i].operations[j].name = action.input.name || "";
1449
- }
1450
- }
1451
- }
1452
- },
1453
- setOperationScopeOperation(state, action) {
1454
- const latestSpec = state.specifications[state.specifications.length - 1];
1455
- for (let i = 0; i < latestSpec.modules.length; i++) {
1456
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1457
- if (latestSpec.modules[i].operations[j].id == action.input.id) {
1458
- latestSpec.modules[i].operations[j].scope = action.input.scope || "global";
1459
- }
1460
- }
1461
- }
1462
- },
1463
- setOperationSchemaOperation(state, action) {
1464
- const latestSpec = state.specifications[state.specifications.length - 1];
1465
- for (let i = 0; i < latestSpec.modules.length; i++) {
1466
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1467
- if (latestSpec.modules[i].operations[j].id == action.input.id) {
1468
- latestSpec.modules[i].operations[j].schema = action.input.schema || "";
1469
- }
1470
- }
1471
- }
1472
- },
1473
- setOperationDescriptionOperation(state, action) {
1474
- const latestSpec = state.specifications[state.specifications.length - 1];
1475
- for (let i = 0; i < latestSpec.modules.length; i++) {
1476
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1477
- if (latestSpec.modules[i].operations[j].id == action.input.id) {
1478
- latestSpec.modules[i].operations[j].description = action.input.description || "";
1479
- }
1480
- }
1481
- }
1482
- },
1483
- setOperationTemplateOperation(state, action) {
1484
- const latestSpec = state.specifications[state.specifications.length - 1];
1485
- for (let i = 0; i < latestSpec.modules.length; i++) {
1486
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1487
- if (latestSpec.modules[i].operations[j].id == action.input.id) {
1488
- latestSpec.modules[i].operations[j].template = action.input.template || "";
1489
- }
1490
- }
1491
- }
1492
- },
1493
- setOperationReducerOperation(state, action) {
1494
- const latestSpec = state.specifications[state.specifications.length - 1];
1495
- for (let i = 0; i < latestSpec.modules.length; i++) {
1496
- for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
1497
- if (latestSpec.modules[i].operations[j].id == action.input.id) {
1498
- latestSpec.modules[i].operations[j].reducer = action.input.reducer || "";
1499
- }
1500
- }
1501
- }
1502
- },
1503
- moveOperationOperation(state, action) {
1504
- const moveOperations = [];
1505
- const latestSpec = state.specifications[state.specifications.length - 1];
1506
- for (let i = 0; i < latestSpec.modules.length; i++) {
1507
- latestSpec.modules[i].operations = latestSpec.modules[i].operations.filter((operation) => {
1508
- if (operation.id == action.input.operationId) {
1509
- moveOperations.push(operation);
1510
- return false;
1511
- }
1512
- return true;
1513
- });
1514
- }
1515
- for (let i = 0; i < latestSpec.modules.length; i++) {
1516
- if (latestSpec.modules[i].id == action.input.newModuleId) {
1517
- latestSpec.modules[i].operations.push(...moveOperations);
1518
- }
1519
- }
1520
- },
1521
- deleteOperationOperation(state, action) {
1522
- const latestSpec = state.specifications[state.specifications.length - 1];
1523
- for (let i = 0; i < latestSpec.modules.length; i++) {
1524
- latestSpec.modules[i].operations = latestSpec.modules[i].operations.filter((operation) => operation.id != action.input.id);
1525
- }
1526
- },
1527
- reorderModuleOperationsOperation(state, action) {
1528
- const latestSpec = state.specifications[state.specifications.length - 1];
1529
- for (let i = 0; i < latestSpec.modules.length; i++) {
1530
- if (latestSpec.modules[i].id == action.input.moduleId) {
1531
- latestSpec.modules[i].operations.sort(
1532
- operationSorter(action.input.order)
1533
- );
1534
- }
1535
- }
1536
- }
1537
- };
1538
- const exampleSorter = (order) => {
1539
- const mapping = {};
1540
- order.forEach((key, index) => mapping[key] = index);
1541
- return (a, b) => (mapping[b.id] || 999999) - (mapping[a.id] || 999999);
1542
- };
1543
- const reducer$1 = {
1544
- setStateSchemaOperation(state, action) {
1545
- const latestSpec = state.specifications[state.specifications.length - 1];
1546
- if (Object.keys(latestSpec.state).includes(action.input.scope)) {
1547
- latestSpec.state[action.input.scope].schema = action.input.schema;
1548
- } else {
1549
- throw new Error(`Invalid scope: ${action.input.scope}`);
1550
- }
1551
- },
1552
- setInitialStateOperation(state, action) {
1553
- const latestSpec = state.specifications[state.specifications.length - 1];
1554
- if (Object.keys(latestSpec.state).includes(action.input.scope)) {
1555
- latestSpec.state[action.input.scope].initialValue = action.input.initialValue;
1556
- } else {
1557
- throw new Error(`Invalid scope: ${action.input.scope}`);
1558
- }
1559
- },
1560
- addStateExampleOperation(state, action) {
1561
- const latestSpec = state.specifications[state.specifications.length - 1];
1562
- if (Object.keys(latestSpec.state).includes(action.input.scope)) {
1563
- latestSpec.state[action.input.scope].examples.push({
1564
- id: action.input.id,
1565
- value: action.input.example
1566
- });
1567
- } else {
1568
- throw new Error(`Invalid scope: ${action.input.scope}`);
1569
- }
1570
- },
1571
- updateStateExampleOperation(state, action) {
1572
- const latestSpec = state.specifications[state.specifications.length - 1];
1573
- if (!Object.keys(latestSpec.state).includes(action.input.scope)) {
1574
- throw new Error(`Invalid scope: ${action.input.scope}`);
1575
- }
1576
- const examples = latestSpec.state[action.input.scope].examples;
1577
- for (let i = 0; i < examples.length; i++) {
1578
- if (examples[i].id == action.input.id) {
1579
- examples[i].value = action.input.newExample;
1580
- }
1581
- }
1582
- },
1583
- deleteStateExampleOperation(state, action) {
1584
- const latestSpec = state.specifications[state.specifications.length - 1];
1585
- if (Object.keys(latestSpec.state).includes(action.input.scope)) {
1586
- latestSpec.state[action.input.scope].examples = latestSpec.state[action.input.scope].examples.filter((e) => e.id != action.input.id);
1587
- } else {
1588
- throw new Error(`Invalid scope: ${action.input.scope}`);
1589
- }
1590
- },
1591
- reorderStateExamplesOperation(state, action) {
1592
- const latestSpec = state.specifications[state.specifications.length - 1];
1593
- if (Object.keys(latestSpec.state).includes(action.input.scope)) {
1594
- latestSpec.state[action.input.scope].examples.sort(
1595
- exampleSorter(action.input.order)
1596
- );
1597
- } else {
1598
- throw new Error(`Invalid scope: ${action.input.scope}`);
1599
- }
1600
- }
1601
- };
1602
- const stateReducer = (state, action) => {
1603
- if (isBaseAction(action)) {
1604
- return state;
1605
- }
1606
- switch (action.type) {
1607
- case "SET_MODEL_NAME":
1608
- SetModelNameInputSchema().parse(action.input);
1609
- reducer$7.setModelNameOperation(state.global, action);
1610
- break;
1611
- case "SET_MODEL_ID":
1612
- SetModelIdInputSchema().parse(action.input);
1613
- reducer$7.setModelIdOperation(state.global, action);
1614
- break;
1615
- case "SET_MODEL_EXTENSION":
1616
- SetModelExtensionInputSchema().parse(action.input);
1617
- reducer$7.setModelExtensionOperation(state.global, action);
1618
- break;
1619
- case "SET_MODEL_DESCRIPTION":
1620
- SetModelDescriptionInputSchema().parse(action.input);
1621
- reducer$7.setModelDescriptionOperation(state.global, action);
1622
- break;
1623
- case "SET_AUTHOR_NAME":
1624
- SetAuthorNameInputSchema().parse(action.input);
1625
- reducer$7.setAuthorNameOperation(state.global, action);
1626
- break;
1627
- case "SET_AUTHOR_WEBSITE":
1628
- SetAuthorWebsiteInputSchema().parse(action.input);
1629
- reducer$7.setAuthorWebsiteOperation(state.global, action);
1630
- break;
1631
- case "ADD_CHANGE_LOG_ITEM":
1632
- AddChangeLogItemInputSchema().parse(action.input);
1633
- reducer$6.addChangeLogItemOperation(state.global, action);
1634
- break;
1635
- case "UPDATE_CHANGE_LOG_ITEM":
1636
- UpdateChangeLogItemInputSchema().parse(action.input);
1637
- reducer$6.updateChangeLogItemOperation(state.global, action);
1638
- break;
1639
- case "DELETE_CHANGE_LOG_ITEM":
1640
- DeleteChangeLogItemInputSchema().parse(action.input);
1641
- reducer$6.deleteChangeLogItemOperation(state.global, action);
1642
- break;
1643
- case "REORDER_CHANGE_LOG_ITEMS":
1644
- ReorderChangeLogItemsInputSchema().parse(action.input);
1645
- reducer$6.reorderChangeLogItemsOperation(state.global, action);
1646
- break;
1647
- case "RELEASE_NEW_VERSION":
1648
- if (Object.keys(action.input).length > 0)
1649
- throw new Error("Expected empty input for action RELEASE_NEW_VERSION");
1650
- reducer$6.releaseNewVersionOperation(state.global, action);
1651
- break;
1652
- case "ADD_MODULE":
1653
- AddModuleInputSchema().parse(action.input);
1654
- reducer$5.addModuleOperation(state.global, action);
1655
- break;
1656
- case "SET_MODULE_NAME":
1657
- SetModuleNameInputSchema().parse(action.input);
1658
- reducer$5.setModuleNameOperation(state.global, action);
1659
- break;
1660
- case "SET_MODULE_DESCRIPTION":
1661
- SetModuleDescriptionInputSchema().parse(action.input);
1662
- reducer$5.setModuleDescriptionOperation(state.global, action);
1663
- break;
1664
- case "DELETE_MODULE":
1665
- DeleteModuleInputSchema().parse(action.input);
1666
- reducer$5.deleteModuleOperation(state.global, action);
1667
- break;
1668
- case "REORDER_MODULES":
1669
- ReorderModulesInputSchema().parse(action.input);
1670
- reducer$5.reorderModulesOperation(state.global, action);
1671
- break;
1672
- case "ADD_OPERATION_ERROR":
1673
- AddOperationErrorInputSchema().parse(action.input);
1674
- reducer$4.addOperationErrorOperation(state.global, action);
1675
- break;
1676
- case "SET_OPERATION_ERROR_CODE":
1677
- SetOperationErrorCodeInputSchema().parse(action.input);
1678
- reducer$4.setOperationErrorCodeOperation(
1679
- state.global,
1680
- action
1681
- );
1682
- break;
1683
- case "SET_OPERATION_ERROR_NAME":
1684
- SetOperationErrorNameInputSchema().parse(action.input);
1685
- reducer$4.setOperationErrorNameOperation(
1686
- state.global,
1687
- action
1688
- );
1689
- break;
1690
- case "SET_OPERATION_ERROR_DESCRIPTION":
1691
- SetOperationErrorDescriptionInputSchema().parse(action.input);
1692
- reducer$4.setOperationErrorDescriptionOperation(
1693
- state.global,
1694
- action
1695
- );
1696
- break;
1697
- case "SET_OPERATION_ERROR_TEMPLATE":
1698
- SetOperationErrorTemplateInputSchema().parse(action.input);
1699
- reducer$4.setOperationErrorTemplateOperation(
1700
- state.global,
1701
- action
1702
- );
1703
- break;
1704
- case "DELETE_OPERATION_ERROR":
1705
- DeleteOperationErrorInputSchema().parse(action.input);
1706
- reducer$4.deleteOperationErrorOperation(state.global, action);
1707
- break;
1708
- case "REORDER_OPERATION_ERRORS":
1709
- ReorderOperationErrorsInputSchema().parse(action.input);
1710
- reducer$4.reorderOperationErrorsOperation(
1711
- state.global,
1712
- action
1713
- );
1714
- break;
1715
- case "ADD_OPERATION_EXAMPLE":
1716
- AddOperationExampleInputSchema().parse(action.input);
1717
- reducer$3.addOperationExampleOperation(
1718
- state.global,
1719
- action
1720
- );
1721
- break;
1722
- case "UPDATE_OPERATION_EXAMPLE":
1723
- UpdateOperationExampleInputSchema().parse(action.input);
1724
- reducer$3.updateOperationExampleOperation(
1725
- state.global,
1726
- action
1727
- );
1728
- break;
1729
- case "DELETE_OPERATION_EXAMPLE":
1730
- DeleteOperationExampleInputSchema().parse(action.input);
1731
- reducer$3.deleteOperationExampleOperation(
1732
- state.global,
1733
- action
1734
- );
1735
- break;
1736
- case "REORDER_OPERATION_EXAMPLES":
1737
- ReorderOperationExamplesInputSchema().parse(action.input);
1738
- reducer$3.reorderOperationExamplesOperation(
1739
- state.global,
1740
- action
1741
- );
1742
- break;
1743
- case "ADD_OPERATION":
1744
- AddOperationInputSchema().parse(action.input);
1745
- reducer$2.addOperationOperation(state.global, action);
1746
- break;
1747
- case "SET_OPERATION_NAME":
1748
- SetOperationNameInputSchema().parse(action.input);
1749
- reducer$2.setOperationNameOperation(state.global, action);
1750
- break;
1751
- case "SET_OPERATION_SCOPE":
1752
- SetOperationScopeInputSchema().parse(action.input);
1753
- reducer$2.setOperationScopeOperation(state.global, action);
1754
- break;
1755
- case "SET_OPERATION_SCHEMA":
1756
- SetOperationSchemaInputSchema().parse(action.input);
1757
- reducer$2.setOperationSchemaOperation(state.global, action);
1758
- break;
1759
- case "SET_OPERATION_DESCRIPTION":
1760
- SetOperationDescriptionInputSchema().parse(action.input);
1761
- reducer$2.setOperationDescriptionOperation(state.global, action);
1762
- break;
1763
- case "SET_OPERATION_TEMPLATE":
1764
- SetOperationTemplateInputSchema().parse(action.input);
1765
- reducer$2.setOperationTemplateOperation(state.global, action);
1766
- break;
1767
- case "SET_OPERATION_REDUCER":
1768
- SetOperationReducerInputSchema().parse(action.input);
1769
- reducer$2.setOperationReducerOperation(state.global, action);
1770
- break;
1771
- case "MOVE_OPERATION":
1772
- MoveOperationInputSchema().parse(action.input);
1773
- reducer$2.moveOperationOperation(state.global, action);
1774
- break;
1775
- case "DELETE_OPERATION":
1776
- DeleteOperationInputSchema().parse(action.input);
1777
- reducer$2.deleteOperationOperation(state.global, action);
1778
- break;
1779
- case "REORDER_MODULE_OPERATIONS":
1780
- ReorderModuleOperationsInputSchema().parse(action.input);
1781
- reducer$2.reorderModuleOperationsOperation(state.global, action);
1782
- break;
1783
- case "SET_STATE_SCHEMA":
1784
- SetStateSchemaInputSchema().parse(action.input);
1785
- reducer$1.setStateSchemaOperation(state.global, action);
1786
- break;
1787
- case "SET_INITIAL_STATE":
1788
- SetInitialStateInputSchema().parse(action.input);
1789
- reducer$1.setInitialStateOperation(state.global, action);
1790
- break;
1791
- case "ADD_STATE_EXAMPLE":
1792
- AddStateExampleInputSchema().parse(action.input);
1793
- reducer$1.addStateExampleOperation(state.global, action);
1794
- break;
1795
- case "UPDATE_STATE_EXAMPLE":
1796
- UpdateStateExampleInputSchema().parse(action.input);
1797
- reducer$1.updateStateExampleOperation(state.global, action);
1798
- break;
1799
- case "DELETE_STATE_EXAMPLE":
1800
- DeleteStateExampleInputSchema().parse(action.input);
1801
- reducer$1.deleteStateExampleOperation(state.global, action);
1802
- break;
1803
- case "REORDER_STATE_EXAMPLES":
1804
- ReorderStateExamplesInputSchema().parse(action.input);
1805
- reducer$1.reorderStateExamplesOperation(state.global, action);
1806
- break;
1807
- default:
1808
- return state;
1809
- }
1810
- };
1811
- const reducer = createReducer(stateReducer);
1812
- const initialGlobalState = {
1813
- id: "",
1814
- name: "",
1815
- extension: "",
1816
- description: "",
1817
- author: {
1818
- name: "",
1819
- website: ""
1820
- },
1821
- specifications: [
1822
- {
1823
- version: 1,
1824
- changeLog: [],
1825
- state: {
1826
- global: {
1827
- schema: "",
1828
- initialValue: "",
1829
- examples: []
1830
- },
1831
- local: {
1832
- schema: "",
1833
- initialValue: "",
1834
- examples: []
1835
- }
1836
- },
1837
- modules: []
1838
- }
1839
- ]
1840
- };
1841
- const initialLocalState = {};
1842
- const utils$1 = {
1843
- fileExtension: "phdm",
1844
- createState(state) {
1845
- return {
1846
- global: { ...initialGlobalState, ...state == null ? void 0 : state.global },
1847
- local: { ...initialLocalState, ...state == null ? void 0 : state.local }
1848
- };
1849
- },
1850
- createExtendedState(extendedState) {
1851
- return createExtendedState(
1852
- { ...extendedState, documentType: "powerhouse/document-model" },
1853
- utils$1.createState
1854
- );
1855
- },
1856
- createDocument(state) {
1857
- return createDocument(
1858
- utils$1.createExtendedState(state),
1859
- utils$1.createState
1860
- );
1861
- },
1862
- saveToFile(document, path, name) {
1863
- return saveToFile(document, path, "phdm", name);
1864
- },
1865
- saveToFileHandle(document, input) {
1866
- return saveToFileHandle(document, input);
1867
- },
1868
- loadFromFile(path) {
1869
- return loadFromFile(path, reducer);
1870
- },
1871
- loadFromInput(input) {
1872
- return loadFromInput(input, reducer);
1873
- }
1874
- };
1875
- const setModelName = (input) => createAction("SET_MODEL_NAME", { ...input });
1876
- const setModelId = (input) => createAction("SET_MODEL_ID", { ...input });
1877
- const setModelExtension = (input) => createAction("SET_MODEL_EXTENSION", { ...input });
1878
- const setModelDescription = (input) => createAction("SET_MODEL_DESCRIPTION", {
1879
- ...input
1880
- });
1881
- const setAuthorName = (input) => createAction("SET_AUTHOR_NAME", { ...input });
1882
- const setAuthorWebsite = (input) => createAction("SET_AUTHOR_WEBSITE", { ...input });
1883
- class DocumentModel_Header extends BaseDocument {
1884
- setModelName(input, options) {
1885
- return this.dispatch(setModelName(input), options);
1886
- }
1887
- setModelId(input, options) {
1888
- return this.dispatch(setModelId(input), options);
1889
- }
1890
- setModelExtension(input, options) {
1891
- return this.dispatch(setModelExtension(input), options);
1892
- }
1893
- setModelDescription(input, options) {
1894
- return this.dispatch(setModelDescription(input), options);
1895
- }
1896
- setAuthorName(input, options) {
1897
- return this.dispatch(setAuthorName(input), options);
1898
- }
1899
- setAuthorWebsite(input, options) {
1900
- return this.dispatch(setAuthorWebsite(input), options);
1901
- }
1902
- }
1903
- const addChangeLogItem = (input) => createAction("ADD_CHANGE_LOG_ITEM", { ...input });
1904
- const updateChangeLogItem = (input) => createAction("UPDATE_CHANGE_LOG_ITEM", {
1905
- ...input
1906
- });
1907
- const deleteChangeLogItem = (input) => createAction("DELETE_CHANGE_LOG_ITEM", {
1908
- ...input
1909
- });
1910
- const reorderChangeLogItems = (input) => createAction("REORDER_CHANGE_LOG_ITEMS", {
1911
- ...input
1912
- });
1913
- const releaseNewVersion = () => createAction("RELEASE_NEW_VERSION");
1914
- class DocumentModel_Versioning extends BaseDocument {
1915
- addChangeLogItem(input, options) {
1916
- return this.dispatch(addChangeLogItem(input), options);
1917
- }
1918
- updateChangeLogItem(input, options) {
1919
- return this.dispatch(updateChangeLogItem(input), options);
1920
- }
1921
- deleteChangeLogItem(input, options) {
1922
- return this.dispatch(deleteChangeLogItem(input), options);
1923
- }
1924
- reorderChangeLogItems(input, options) {
1925
- return this.dispatch(reorderChangeLogItems(input), options);
1926
- }
1927
- releaseNewVersion(options) {
1928
- return this.dispatch(releaseNewVersion(), options);
1929
- }
1930
- }
1931
- const addModule = (input) => createAction("ADD_MODULE", { ...input });
1932
- const setModuleName = (input) => createAction("SET_MODULE_NAME", { ...input });
1933
- const setModuleDescription = (input) => createAction("SET_MODULE_DESCRIPTION", {
1934
- ...input
1935
- });
1936
- const deleteModule = (input) => createAction("DELETE_MODULE", { ...input });
1937
- const reorderModules = (input) => createAction("REORDER_MODULES", { ...input });
1938
- class DocumentModel_Module extends BaseDocument {
1939
- addModule(input, options) {
1940
- return this.dispatch(addModule(input), options);
1941
- }
1942
- setModuleName(input, options) {
1943
- return this.dispatch(setModuleName(input), options);
1944
- }
1945
- setModuleDescription(input, options) {
1946
- return this.dispatch(setModuleDescription(input), options);
1947
- }
1948
- deleteModule(input, options) {
1949
- return this.dispatch(deleteModule(input), options);
1950
- }
1951
- reorderModules(input, options) {
1952
- return this.dispatch(reorderModules(input), options);
1953
- }
1954
- }
1955
- const addOperationError = (input) => createAction("ADD_OPERATION_ERROR", { ...input });
1956
- const setOperationErrorCode = (input) => createAction("SET_OPERATION_ERROR_CODE", {
1957
- ...input
1958
- });
1959
- const setOperationErrorName = (input) => createAction("SET_OPERATION_ERROR_NAME", {
1960
- ...input
1961
- });
1962
- const setOperationErrorDescription = (input) => createAction(
1963
- "SET_OPERATION_ERROR_DESCRIPTION",
1964
- { ...input }
1965
- );
1966
- const setOperationErrorTemplate = (input) => createAction(
1967
- "SET_OPERATION_ERROR_TEMPLATE",
1968
- { ...input }
1969
- );
1970
- const deleteOperationError = (input) => createAction("DELETE_OPERATION_ERROR", {
1971
- ...input
1972
- });
1973
- const reorderOperationErrors = (input) => createAction("REORDER_OPERATION_ERRORS", {
1974
- ...input
1975
- });
1976
- class DocumentModel_OperationError extends BaseDocument {
1977
- addOperationError(input, options) {
1978
- return this.dispatch(addOperationError(input), options);
1979
- }
1980
- setOperationErrorCode(input, options) {
1981
- return this.dispatch(setOperationErrorCode(input), options);
1982
- }
1983
- setOperationErrorName(input, options) {
1984
- return this.dispatch(setOperationErrorName(input), options);
1985
- }
1986
- setOperationErrorDescription(input, options) {
1987
- return this.dispatch(setOperationErrorDescription(input), options);
1988
- }
1989
- setOperationErrorTemplate(input, options) {
1990
- return this.dispatch(setOperationErrorTemplate(input), options);
1991
- }
1992
- deleteOperationError(input, options) {
1993
- return this.dispatch(deleteOperationError(input), options);
1994
- }
1995
- reorderOperationErrors(input, options) {
1996
- return this.dispatch(reorderOperationErrors(input), options);
1997
- }
1998
- }
1999
- const addOperationExample = (input) => createAction("ADD_OPERATION_EXAMPLE", {
2000
- ...input
2001
- });
2002
- const updateOperationExample = (input) => createAction("UPDATE_OPERATION_EXAMPLE", {
2003
- ...input
2004
- });
2005
- const deleteOperationExample = (input) => createAction("DELETE_OPERATION_EXAMPLE", {
2006
- ...input
2007
- });
2008
- const reorderOperationExamples = (input) => createAction("REORDER_OPERATION_EXAMPLES", {
2009
- ...input
2010
- });
2011
- class DocumentModel_OperationExample extends BaseDocument {
2012
- addOperationExample(input, options) {
2013
- return this.dispatch(addOperationExample(input), options);
2014
- }
2015
- updateOperationExample(input, options) {
2016
- return this.dispatch(updateOperationExample(input), options);
2017
- }
2018
- deleteOperationExample(input, options) {
2019
- return this.dispatch(deleteOperationExample(input), options);
2020
- }
2021
- reorderOperationExamples(input, options) {
2022
- return this.dispatch(reorderOperationExamples(input), options);
2023
- }
2024
- }
2025
- const addOperation = (input) => createAction("ADD_OPERATION", { ...input });
2026
- const setOperationName = (input) => createAction("SET_OPERATION_NAME", { ...input });
2027
- const setOperationScope = (input) => createAction("SET_OPERATION_SCOPE", { ...input });
2028
- const setOperationSchema = (input) => createAction("SET_OPERATION_SCHEMA", { ...input });
2029
- const setOperationDescription = (input) => createAction("SET_OPERATION_DESCRIPTION", {
2030
- ...input
2031
- });
2032
- const setOperationTemplate = (input) => createAction("SET_OPERATION_TEMPLATE", {
2033
- ...input
2034
- });
2035
- const setOperationReducer = (input) => createAction("SET_OPERATION_REDUCER", {
2036
- ...input
2037
- });
2038
- const moveOperation = (input) => createAction("MOVE_OPERATION", { ...input });
2039
- const deleteOperation = (input) => createAction("DELETE_OPERATION", { ...input });
2040
- const reorderModuleOperations = (input) => createAction("REORDER_MODULE_OPERATIONS", {
2041
- ...input
2042
- });
2043
- class DocumentModel_Operation extends BaseDocument {
2044
- addOperation(input, options) {
2045
- return this.dispatch(addOperation(input), options);
2046
- }
2047
- setOperationName(input, options) {
2048
- return this.dispatch(setOperationName(input), options);
2049
- }
2050
- setOperationScope(input, options) {
2051
- return this.dispatch(setOperationScope(input), options);
2052
- }
2053
- setOperationSchema(input, options) {
2054
- return this.dispatch(setOperationSchema(input), options);
2055
- }
2056
- setOperationDescription(input, options) {
2057
- return this.dispatch(setOperationDescription(input), options);
2058
- }
2059
- setOperationTemplate(input, options) {
2060
- return this.dispatch(setOperationTemplate(input), options);
2061
- }
2062
- setOperationReducer(input, options) {
2063
- return this.dispatch(setOperationReducer(input), options);
2064
- }
2065
- moveOperation(input, options) {
2066
- return this.dispatch(moveOperation(input), options);
2067
- }
2068
- deleteOperation(input, options) {
2069
- return this.dispatch(deleteOperation(input), options);
2070
- }
2071
- reorderModuleOperations(input, options) {
2072
- return this.dispatch(reorderModuleOperations(input), options);
2073
- }
2074
- }
2075
- const setStateSchema = (input) => createAction("SET_STATE_SCHEMA", { ...input });
2076
- const setInitialState = (input) => createAction("SET_INITIAL_STATE", { ...input });
2077
- const addStateExample = (input) => createAction("ADD_STATE_EXAMPLE", { ...input });
2078
- const updateStateExample = (input) => createAction("UPDATE_STATE_EXAMPLE", { ...input });
2079
- const deleteStateExample = (input) => createAction("DELETE_STATE_EXAMPLE", { ...input });
2080
- const reorderStateExamples = (input) => createAction("REORDER_STATE_EXAMPLES", {
2081
- ...input
2082
- });
2083
- class DocumentModel_State extends BaseDocument {
2084
- setStateSchema(input, options) {
2085
- return this.dispatch(setStateSchema(input), options);
2086
- }
2087
- setInitialState(input, options) {
2088
- return this.dispatch(setInitialState(input), options);
2089
- }
2090
- addStateExample(input, options) {
2091
- return this.dispatch(addStateExample(input), options);
2092
- }
2093
- updateStateExample(input, options) {
2094
- return this.dispatch(updateStateExample(input), options);
2095
- }
2096
- deleteStateExample(input, options) {
2097
- return this.dispatch(deleteStateExample(input), options);
2098
- }
2099
- reorderStateExamples(input, options) {
2100
- return this.dispatch(reorderStateExamples(input), options);
2101
- }
2102
- }
2103
- let DocumentModel$1 = (_a = class extends BaseDocument {
2104
- constructor(initialState, dispatch) {
2105
- super(reducer, utils$1.createDocument(initialState), dispatch);
2106
- }
2107
- saveToFile(path, name) {
2108
- return super.saveToFile(path, _a.fileExtension, name);
2109
- }
2110
- loadFromFile(path) {
2111
- return super.loadFromFile(path);
2112
- }
2113
- static async fromFile(path) {
2114
- const document = new this();
2115
- await document.loadFromFile(path);
2116
- return document;
2117
- }
2118
- }, __publicField(_a, "fileExtension", "phdm"), _a);
2119
- applyMixins(DocumentModel$1, [
2120
- DocumentModel_Header,
2121
- DocumentModel_Versioning,
2122
- DocumentModel_Module,
2123
- DocumentModel_OperationError,
2124
- DocumentModel_OperationExample,
2125
- DocumentModel_Operation,
2126
- DocumentModel_State
2127
- ]);
2128
- const DocumentModelActions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2129
- __proto__: null,
2130
- addChangeLogItem,
2131
- addModule,
2132
- addOperation,
2133
- addOperationError,
2134
- addOperationExample,
2135
- addStateExample,
2136
- deleteChangeLogItem,
2137
- deleteModule,
2138
- deleteOperation,
2139
- deleteOperationError,
2140
- deleteOperationExample,
2141
- deleteStateExample,
2142
- moveOperation,
2143
- releaseNewVersion,
2144
- reorderChangeLogItems,
2145
- reorderModuleOperations,
2146
- reorderModules,
2147
- reorderOperationErrors,
2148
- reorderOperationExamples,
2149
- reorderStateExamples,
2150
- setAuthorName,
2151
- setAuthorWebsite,
2152
- setInitialState,
2153
- setModelDescription,
2154
- setModelExtension,
2155
- setModelId,
2156
- setModelName,
2157
- setModuleDescription,
2158
- setModuleName,
2159
- setOperationDescription,
2160
- setOperationErrorCode,
2161
- setOperationErrorDescription,
2162
- setOperationErrorName,
2163
- setOperationErrorTemplate,
2164
- setOperationName,
2165
- setOperationReducer,
2166
- setOperationSchema,
2167
- setOperationScope,
2168
- setOperationTemplate,
2169
- setStateSchema,
2170
- updateChangeLogItem,
2171
- updateOperationExample,
2172
- updateStateExample
2173
- }, Symbol.toStringTag, { value: "Module" }));
2174
- const Document = DocumentModel$1;
2175
- const utils = { ...utils$1, ...customUtils };
2176
- const actions = { ...BaseActions, ...DocumentModelActions };
2177
- const module = {
2178
- Document,
2179
- reducer,
2180
- actions,
2181
- utils,
2182
- documentModel
2183
- };
2184
- const DocumentModel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2185
- __proto__: null,
2186
- Document,
2187
- DocumentModel: DocumentModel$1,
2188
- actions,
2189
- documentModel,
2190
- module,
2191
- reducer,
2192
- utils,
2193
- validateInitialState,
2194
- validateModule,
2195
- validateModuleOperation,
2196
- validateModules,
2197
- validateStateSchemaName,
2198
- z: zod
2199
- }, Symbol.toStringTag, { value: "Module" }));
2200
- export {
2201
- DocumentModel as D,
2202
- DocumentModel$1 as a,
2203
- Document as b,
2204
- actions as c,
2205
- documentModel as d,
2206
- validateStateSchemaName as e,
2207
- validateModules as f,
2208
- validateModule as g,
2209
- validateModuleOperation as h,
2210
- module as m,
2211
- reducer as r,
2212
- utils as u,
2213
- validateInitialState as v,
2214
- zod as z
2215
- };
2216
- //# sourceMappingURL=index-CiQX4huJ.js.map