document-model 2.4.0 → 2.5.0-test.0

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