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