document-model 1.1.0-debug.1 → 1.1.0-debug.2

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