document-model 2.4.1 → 2.5.0-test.0

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