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