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