document-model 1.0.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 (163) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +197 -0
  3. package/dist/browser/document-model.cjs +1 -0
  4. package/dist/browser/document-model.d.ts +1 -0
  5. package/dist/browser/document-model.js +17 -0
  6. package/dist/browser/document.cjs +1 -0
  7. package/dist/browser/document.d.ts +1 -0
  8. package/dist/browser/document.js +15 -0
  9. package/dist/browser/index-1aa6b70c.js +1 -0
  10. package/dist/browser/index-47a38d27.mjs +1776 -0
  11. package/dist/browser/index-71473ecd.js +22 -0
  12. package/dist/browser/index-ede882c4.mjs +29 -0
  13. package/dist/browser/index.cjs +1 -0
  14. package/dist/browser/index.d.ts +3 -0
  15. package/dist/browser/index.js +18 -0
  16. package/dist/browser/object-38724dbb.js +1 -0
  17. package/dist/browser/object-916a56cd.mjs +641 -0
  18. package/dist/browser/src/document/actions/creators.d.ts +46 -0
  19. package/dist/browser/src/document/actions/index.d.ts +10 -0
  20. package/dist/browser/src/document/actions/types.d.ts +9 -0
  21. package/dist/browser/src/document/index.d.ts +5 -0
  22. package/dist/browser/src/document/object.d.ts +118 -0
  23. package/dist/browser/src/document/reducer.d.ts +15 -0
  24. package/dist/browser/src/document/schema/index.d.ts +2 -0
  25. package/dist/browser/src/document/schema/types.d.ts +168 -0
  26. package/dist/browser/src/document/schema/zod.d.ts +72 -0
  27. package/dist/browser/src/document/types.d.ts +154 -0
  28. package/dist/browser/src/document/utils/base.d.ts +55 -0
  29. package/dist/browser/src/document/utils/file.d.ts +47 -0
  30. package/dist/browser/src/document/utils/index.d.ts +2 -0
  31. package/dist/browser/src/document/utils/node.d.ts +9 -0
  32. package/dist/browser/src/document-model/custom/reducers/header.d.ts +2 -0
  33. package/dist/browser/src/document-model/custom/reducers/module.d.ts +2 -0
  34. package/dist/browser/src/document-model/custom/reducers/operation-error.d.ts +2 -0
  35. package/dist/browser/src/document-model/custom/reducers/operation-example.d.ts +2 -0
  36. package/dist/browser/src/document-model/custom/reducers/operation.d.ts +2 -0
  37. package/dist/browser/src/document-model/custom/reducers/state.d.ts +2 -0
  38. package/dist/browser/src/document-model/custom/reducers/versioning.d.ts +7 -0
  39. package/dist/browser/src/document-model/custom/utils.d.ts +1 -0
  40. package/dist/browser/src/document-model/gen/actions.d.ts +15 -0
  41. package/dist/browser/src/document-model/gen/creators.d.ts +7 -0
  42. package/dist/browser/src/document-model/gen/document-model.d.ts +2 -0
  43. package/dist/browser/src/document-model/gen/header/actions.d.ts +9 -0
  44. package/dist/browser/src/document-model/gen/header/creators.d.ts +8 -0
  45. package/dist/browser/src/document-model/gen/header/object.d.ts +11 -0
  46. package/dist/browser/src/document-model/gen/header/operations.d.ts +10 -0
  47. package/dist/browser/src/document-model/gen/index.d.ts +5 -0
  48. package/dist/browser/src/document-model/gen/module/actions.d.ts +8 -0
  49. package/dist/browser/src/document-model/gen/module/creators.d.ts +7 -0
  50. package/dist/browser/src/document-model/gen/module/object.d.ts +10 -0
  51. package/dist/browser/src/document-model/gen/module/operations.d.ts +9 -0
  52. package/dist/browser/src/document-model/gen/object.d.ts +28 -0
  53. package/dist/browser/src/document-model/gen/operation/actions.d.ts +12 -0
  54. package/dist/browser/src/document-model/gen/operation/creators.d.ts +11 -0
  55. package/dist/browser/src/document-model/gen/operation/object.d.ts +14 -0
  56. package/dist/browser/src/document-model/gen/operation/operations.d.ts +13 -0
  57. package/dist/browser/src/document-model/gen/operation-error/actions.d.ts +10 -0
  58. package/dist/browser/src/document-model/gen/operation-error/creators.d.ts +9 -0
  59. package/dist/browser/src/document-model/gen/operation-error/object.d.ts +12 -0
  60. package/dist/browser/src/document-model/gen/operation-error/operations.d.ts +11 -0
  61. package/dist/browser/src/document-model/gen/operation-example/actions.d.ts +7 -0
  62. package/dist/browser/src/document-model/gen/operation-example/creators.d.ts +6 -0
  63. package/dist/browser/src/document-model/gen/operation-example/object.d.ts +9 -0
  64. package/dist/browser/src/document-model/gen/operation-example/operations.d.ts +8 -0
  65. package/dist/browser/src/document-model/gen/reducer.d.ts +3 -0
  66. package/dist/browser/src/document-model/gen/schema/index.d.ts +2 -0
  67. package/dist/browser/src/document-model/gen/schema/types.d.ts +435 -0
  68. package/dist/browser/src/document-model/gen/schema/zod.d.ts +428 -0
  69. package/dist/browser/src/document-model/gen/state/actions.d.ts +9 -0
  70. package/dist/browser/src/document-model/gen/state/creators.d.ts +8 -0
  71. package/dist/browser/src/document-model/gen/state/object.d.ts +11 -0
  72. package/dist/browser/src/document-model/gen/state/operations.d.ts +10 -0
  73. package/dist/browser/src/document-model/gen/types.d.ts +8 -0
  74. package/dist/browser/src/document-model/gen/utils.d.ts +4 -0
  75. package/dist/browser/src/document-model/gen/versioning/actions.d.ts +8 -0
  76. package/dist/browser/src/document-model/gen/versioning/creators.d.ts +7 -0
  77. package/dist/browser/src/document-model/gen/versioning/object.d.ts +10 -0
  78. package/dist/browser/src/document-model/gen/versioning/operations.d.ts +9 -0
  79. package/dist/browser/src/document-model/index.d.ts +73 -0
  80. package/dist/browser/src/index.d.ts +25 -0
  81. package/dist/browser/src/index.doc.d.ts +20 -0
  82. package/dist/browser/vite.config.d.ts +2 -0
  83. package/dist/node/document-model.cjs +1 -0
  84. package/dist/node/document-model.d.ts +1 -0
  85. package/dist/node/document-model.js +20 -0
  86. package/dist/node/document.cjs +1 -0
  87. package/dist/node/document.d.ts +1 -0
  88. package/dist/node/document.js +18 -0
  89. package/dist/node/index-03f82dde.mjs +29 -0
  90. package/dist/node/index-0b695055.js +1 -0
  91. package/dist/node/index-78a1221c.mjs +1779 -0
  92. package/dist/node/index-fbaffded.js +22 -0
  93. package/dist/node/index.cjs +1 -0
  94. package/dist/node/index.d.ts +3 -0
  95. package/dist/node/index.js +21 -0
  96. package/dist/node/object-b1510be8.js +1 -0
  97. package/dist/node/object-bdb7f8c6.mjs +654 -0
  98. package/dist/node/src/document/actions/creators.d.ts +46 -0
  99. package/dist/node/src/document/actions/index.d.ts +10 -0
  100. package/dist/node/src/document/actions/types.d.ts +9 -0
  101. package/dist/node/src/document/index.d.ts +5 -0
  102. package/dist/node/src/document/object.d.ts +118 -0
  103. package/dist/node/src/document/reducer.d.ts +15 -0
  104. package/dist/node/src/document/schema/index.d.ts +2 -0
  105. package/dist/node/src/document/schema/types.d.ts +168 -0
  106. package/dist/node/src/document/schema/zod.d.ts +72 -0
  107. package/dist/node/src/document/types.d.ts +154 -0
  108. package/dist/node/src/document/utils/base.d.ts +55 -0
  109. package/dist/node/src/document/utils/file.d.ts +47 -0
  110. package/dist/node/src/document/utils/index.d.ts +2 -0
  111. package/dist/node/src/document/utils/node.d.ts +9 -0
  112. package/dist/node/src/document-model/custom/reducers/header.d.ts +2 -0
  113. package/dist/node/src/document-model/custom/reducers/module.d.ts +2 -0
  114. package/dist/node/src/document-model/custom/reducers/operation-error.d.ts +2 -0
  115. package/dist/node/src/document-model/custom/reducers/operation-example.d.ts +2 -0
  116. package/dist/node/src/document-model/custom/reducers/operation.d.ts +2 -0
  117. package/dist/node/src/document-model/custom/reducers/state.d.ts +2 -0
  118. package/dist/node/src/document-model/custom/reducers/versioning.d.ts +7 -0
  119. package/dist/node/src/document-model/custom/utils.d.ts +1 -0
  120. package/dist/node/src/document-model/gen/actions.d.ts +15 -0
  121. package/dist/node/src/document-model/gen/creators.d.ts +7 -0
  122. package/dist/node/src/document-model/gen/document-model.d.ts +2 -0
  123. package/dist/node/src/document-model/gen/header/actions.d.ts +9 -0
  124. package/dist/node/src/document-model/gen/header/creators.d.ts +8 -0
  125. package/dist/node/src/document-model/gen/header/object.d.ts +11 -0
  126. package/dist/node/src/document-model/gen/header/operations.d.ts +10 -0
  127. package/dist/node/src/document-model/gen/index.d.ts +5 -0
  128. package/dist/node/src/document-model/gen/module/actions.d.ts +8 -0
  129. package/dist/node/src/document-model/gen/module/creators.d.ts +7 -0
  130. package/dist/node/src/document-model/gen/module/object.d.ts +10 -0
  131. package/dist/node/src/document-model/gen/module/operations.d.ts +9 -0
  132. package/dist/node/src/document-model/gen/object.d.ts +28 -0
  133. package/dist/node/src/document-model/gen/operation/actions.d.ts +12 -0
  134. package/dist/node/src/document-model/gen/operation/creators.d.ts +11 -0
  135. package/dist/node/src/document-model/gen/operation/object.d.ts +14 -0
  136. package/dist/node/src/document-model/gen/operation/operations.d.ts +13 -0
  137. package/dist/node/src/document-model/gen/operation-error/actions.d.ts +10 -0
  138. package/dist/node/src/document-model/gen/operation-error/creators.d.ts +9 -0
  139. package/dist/node/src/document-model/gen/operation-error/object.d.ts +12 -0
  140. package/dist/node/src/document-model/gen/operation-error/operations.d.ts +11 -0
  141. package/dist/node/src/document-model/gen/operation-example/actions.d.ts +7 -0
  142. package/dist/node/src/document-model/gen/operation-example/creators.d.ts +6 -0
  143. package/dist/node/src/document-model/gen/operation-example/object.d.ts +9 -0
  144. package/dist/node/src/document-model/gen/operation-example/operations.d.ts +8 -0
  145. package/dist/node/src/document-model/gen/reducer.d.ts +3 -0
  146. package/dist/node/src/document-model/gen/schema/index.d.ts +2 -0
  147. package/dist/node/src/document-model/gen/schema/types.d.ts +435 -0
  148. package/dist/node/src/document-model/gen/schema/zod.d.ts +428 -0
  149. package/dist/node/src/document-model/gen/state/actions.d.ts +9 -0
  150. package/dist/node/src/document-model/gen/state/creators.d.ts +8 -0
  151. package/dist/node/src/document-model/gen/state/object.d.ts +11 -0
  152. package/dist/node/src/document-model/gen/state/operations.d.ts +10 -0
  153. package/dist/node/src/document-model/gen/types.d.ts +8 -0
  154. package/dist/node/src/document-model/gen/utils.d.ts +4 -0
  155. package/dist/node/src/document-model/gen/versioning/actions.d.ts +8 -0
  156. package/dist/node/src/document-model/gen/versioning/creators.d.ts +7 -0
  157. package/dist/node/src/document-model/gen/versioning/object.d.ts +10 -0
  158. package/dist/node/src/document-model/gen/versioning/operations.d.ts +9 -0
  159. package/dist/node/src/document-model/index.d.ts +73 -0
  160. package/dist/node/src/index.d.ts +25 -0
  161. package/dist/node/src/index.doc.d.ts +20 -0
  162. package/dist/node/vite.config.d.ts +2 -0
  163. package/package.json +89 -0
@@ -0,0 +1,1776 @@
1
+ var pt = Object.defineProperty;
2
+ var lt = (t, e, i) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
+ var pe = (t, e, i) => (lt(t, typeof e != "symbol" ? e + "" : e, i), i);
4
+ import { c as dt, i as ct, a as ut, b as mt, s as Et, d as ht, l as Ot, e as St, f as s, B as l, g as gt, h as ft } from "./object-916a56cd.mjs";
5
+ import "json-stringify-deterministic";
6
+ import "immer";
7
+ import "sha.js/sha1";
8
+ import "jszip";
9
+ import { z as r } from "zod";
10
+ const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11
+ __proto__: null
12
+ }, Symbol.toStringTag, { value: "Module" })), le = {
13
+ id: "powerhouse/document-model",
14
+ name: "DocumentModel",
15
+ extension: "phdm",
16
+ description: "The Powerhouse Document Model describes the state and operations of a document type.",
17
+ author: {
18
+ name: "Powerhouse",
19
+ website: "https://www.powerhouse.inc/"
20
+ },
21
+ specifications: [
22
+ {
23
+ version: 1,
24
+ changeLog: [],
25
+ modules: [
26
+ {
27
+ name: "header",
28
+ operations: [
29
+ {
30
+ name: "SetModelName",
31
+ id: "",
32
+ description: "",
33
+ schema: "",
34
+ template: "",
35
+ reducer: "",
36
+ examples: [],
37
+ errors: []
38
+ },
39
+ {
40
+ name: "SetModelId",
41
+ id: "",
42
+ description: "",
43
+ schema: "",
44
+ template: "",
45
+ reducer: "",
46
+ examples: [],
47
+ errors: []
48
+ },
49
+ {
50
+ name: "SetModelExtension",
51
+ id: "",
52
+ description: "",
53
+ schema: "",
54
+ template: "",
55
+ reducer: "",
56
+ examples: [],
57
+ errors: []
58
+ },
59
+ {
60
+ name: "SetModelDescription",
61
+ id: "",
62
+ description: "",
63
+ schema: "",
64
+ template: "",
65
+ reducer: "",
66
+ examples: [],
67
+ errors: []
68
+ },
69
+ {
70
+ name: "SetAuthorName",
71
+ id: "",
72
+ description: "",
73
+ schema: "",
74
+ template: "",
75
+ reducer: "",
76
+ examples: [],
77
+ errors: []
78
+ },
79
+ {
80
+ name: "SetAuthorWebsite",
81
+ id: "",
82
+ description: "",
83
+ schema: "",
84
+ template: "",
85
+ reducer: "",
86
+ examples: [],
87
+ errors: []
88
+ }
89
+ ],
90
+ id: "",
91
+ description: ""
92
+ },
93
+ {
94
+ name: "versioning",
95
+ operations: [
96
+ {
97
+ name: "AddChangeLogItem",
98
+ id: "",
99
+ description: "",
100
+ schema: "",
101
+ template: "",
102
+ reducer: "",
103
+ examples: [],
104
+ errors: []
105
+ },
106
+ {
107
+ name: "UpdateChangeLogItem",
108
+ id: "",
109
+ description: "",
110
+ schema: "",
111
+ template: "",
112
+ reducer: "",
113
+ examples: [],
114
+ errors: []
115
+ },
116
+ {
117
+ name: "DeleteChangeLogItem",
118
+ id: "",
119
+ description: "",
120
+ schema: "",
121
+ template: "",
122
+ reducer: "",
123
+ examples: [],
124
+ errors: []
125
+ },
126
+ {
127
+ name: "ReorderChangeLogItems",
128
+ id: "",
129
+ description: "",
130
+ schema: "",
131
+ template: "",
132
+ reducer: "",
133
+ examples: [],
134
+ errors: []
135
+ },
136
+ {
137
+ name: "ReleaseNewVersion",
138
+ schema: null,
139
+ id: "",
140
+ description: "",
141
+ template: "",
142
+ reducer: "",
143
+ examples: [],
144
+ errors: []
145
+ }
146
+ ],
147
+ id: "",
148
+ description: ""
149
+ },
150
+ {
151
+ name: "module",
152
+ operations: [
153
+ {
154
+ name: "AddModule",
155
+ id: "",
156
+ description: "",
157
+ schema: "",
158
+ template: "",
159
+ reducer: "",
160
+ examples: [],
161
+ errors: []
162
+ },
163
+ {
164
+ name: "SetModuleName",
165
+ id: "",
166
+ description: "",
167
+ schema: "",
168
+ template: "",
169
+ reducer: "",
170
+ examples: [],
171
+ errors: []
172
+ },
173
+ {
174
+ name: "SetModuleDescription",
175
+ id: "",
176
+ description: "",
177
+ schema: "",
178
+ template: "",
179
+ reducer: "",
180
+ examples: [],
181
+ errors: []
182
+ },
183
+ {
184
+ name: "DeleteModule",
185
+ id: "",
186
+ description: "",
187
+ schema: "",
188
+ template: "",
189
+ reducer: "",
190
+ examples: [],
191
+ errors: []
192
+ },
193
+ {
194
+ name: "ReorderModules",
195
+ id: "",
196
+ description: "",
197
+ schema: "",
198
+ template: "",
199
+ reducer: "",
200
+ examples: [],
201
+ errors: []
202
+ }
203
+ ],
204
+ id: "",
205
+ description: ""
206
+ },
207
+ {
208
+ name: "operation-error",
209
+ operations: [
210
+ {
211
+ name: "AddOperationError",
212
+ id: "",
213
+ description: "",
214
+ schema: "",
215
+ template: "",
216
+ reducer: "",
217
+ examples: [],
218
+ errors: []
219
+ },
220
+ {
221
+ name: "SetOperationErrorCode",
222
+ id: "",
223
+ description: "",
224
+ schema: "",
225
+ template: "",
226
+ reducer: "",
227
+ examples: [],
228
+ errors: []
229
+ },
230
+ {
231
+ name: "SetOperationErrorName",
232
+ id: "",
233
+ description: "",
234
+ schema: "",
235
+ template: "",
236
+ reducer: "",
237
+ examples: [],
238
+ errors: []
239
+ },
240
+ {
241
+ name: "SetOperationErrorDescription",
242
+ id: "",
243
+ description: "",
244
+ schema: "",
245
+ template: "",
246
+ reducer: "",
247
+ examples: [],
248
+ errors: []
249
+ },
250
+ {
251
+ name: "SetOperationErrorTemplate",
252
+ id: "",
253
+ description: "",
254
+ schema: "",
255
+ template: "",
256
+ reducer: "",
257
+ examples: [],
258
+ errors: []
259
+ },
260
+ {
261
+ name: "DeleteOperationError",
262
+ id: "",
263
+ description: "",
264
+ schema: "",
265
+ template: "",
266
+ reducer: "",
267
+ examples: [],
268
+ errors: []
269
+ },
270
+ {
271
+ name: "ReorderOperationErrors",
272
+ id: "",
273
+ description: "",
274
+ schema: "",
275
+ template: "",
276
+ reducer: "",
277
+ examples: [],
278
+ errors: []
279
+ }
280
+ ],
281
+ id: "",
282
+ description: ""
283
+ },
284
+ {
285
+ name: "operation-example",
286
+ operations: [
287
+ {
288
+ name: "AddOperationExample",
289
+ id: "",
290
+ description: "",
291
+ schema: "",
292
+ template: "",
293
+ reducer: "",
294
+ examples: [],
295
+ errors: []
296
+ },
297
+ {
298
+ name: "UpdateOperationExample",
299
+ id: "",
300
+ description: "",
301
+ schema: "",
302
+ template: "",
303
+ reducer: "",
304
+ examples: [],
305
+ errors: []
306
+ },
307
+ {
308
+ name: "DeleteOperationExample",
309
+ id: "",
310
+ description: "",
311
+ schema: "",
312
+ template: "",
313
+ reducer: "",
314
+ examples: [],
315
+ errors: []
316
+ },
317
+ {
318
+ name: "ReorderOperationExamples",
319
+ id: "",
320
+ description: "",
321
+ schema: "",
322
+ template: "",
323
+ reducer: "",
324
+ examples: [],
325
+ errors: []
326
+ }
327
+ ],
328
+ id: "",
329
+ description: ""
330
+ },
331
+ {
332
+ name: "operation",
333
+ operations: [
334
+ {
335
+ name: "AddOperation",
336
+ id: "",
337
+ description: "",
338
+ schema: "",
339
+ template: "",
340
+ reducer: "",
341
+ examples: [],
342
+ errors: []
343
+ },
344
+ {
345
+ name: "SetOperationName",
346
+ id: "",
347
+ description: "",
348
+ schema: "",
349
+ template: "",
350
+ reducer: "",
351
+ examples: [],
352
+ errors: []
353
+ },
354
+ {
355
+ name: "SetOperationSchema",
356
+ id: "",
357
+ description: "",
358
+ schema: "",
359
+ template: "",
360
+ reducer: "",
361
+ examples: [],
362
+ errors: []
363
+ },
364
+ {
365
+ name: "SetOperationDescription",
366
+ id: "",
367
+ description: "",
368
+ schema: "",
369
+ template: "",
370
+ reducer: "",
371
+ examples: [],
372
+ errors: []
373
+ },
374
+ {
375
+ name: "SetOperationTemplate",
376
+ id: "",
377
+ description: "",
378
+ schema: "",
379
+ template: "",
380
+ reducer: "",
381
+ examples: [],
382
+ errors: []
383
+ },
384
+ {
385
+ name: "SetOperationReducer",
386
+ id: "",
387
+ description: "",
388
+ schema: "",
389
+ template: "",
390
+ reducer: "",
391
+ examples: [],
392
+ errors: []
393
+ },
394
+ {
395
+ name: "MoveOperation",
396
+ id: "",
397
+ description: "",
398
+ schema: "",
399
+ template: "",
400
+ reducer: "",
401
+ examples: [],
402
+ errors: []
403
+ },
404
+ {
405
+ name: "DeleteOperation",
406
+ id: "",
407
+ description: "",
408
+ schema: "",
409
+ template: "",
410
+ reducer: "",
411
+ examples: [],
412
+ errors: []
413
+ },
414
+ {
415
+ name: "ReorderModuleOperations",
416
+ id: "",
417
+ description: "",
418
+ schema: "",
419
+ template: "",
420
+ reducer: "",
421
+ examples: [],
422
+ errors: []
423
+ }
424
+ ],
425
+ id: "",
426
+ description: ""
427
+ },
428
+ {
429
+ name: "state",
430
+ operations: [
431
+ {
432
+ name: "SetStateSchema",
433
+ id: "",
434
+ description: "",
435
+ schema: "",
436
+ template: "",
437
+ reducer: "",
438
+ examples: [],
439
+ errors: []
440
+ },
441
+ {
442
+ name: "SetInitialState",
443
+ id: "",
444
+ description: "",
445
+ schema: "",
446
+ template: "",
447
+ reducer: "",
448
+ examples: [],
449
+ errors: []
450
+ },
451
+ {
452
+ name: "AddStateExample",
453
+ id: "",
454
+ description: "",
455
+ schema: "",
456
+ template: "",
457
+ reducer: "",
458
+ examples: [],
459
+ errors: []
460
+ },
461
+ {
462
+ name: "UpdateStateExample",
463
+ id: "",
464
+ description: "",
465
+ schema: "",
466
+ template: "",
467
+ reducer: "",
468
+ examples: [],
469
+ errors: []
470
+ },
471
+ {
472
+ name: "DeleteStateExample",
473
+ id: "",
474
+ description: "",
475
+ schema: "",
476
+ template: "",
477
+ reducer: "",
478
+ examples: [],
479
+ errors: []
480
+ },
481
+ {
482
+ name: "ReorderStateExamples",
483
+ id: "",
484
+ description: "",
485
+ schema: "",
486
+ template: "",
487
+ reducer: "",
488
+ examples: [],
489
+ errors: []
490
+ }
491
+ ],
492
+ id: "",
493
+ description: ""
494
+ }
495
+ ],
496
+ state: {
497
+ schema: "",
498
+ initialValue: `{
499
+ "id": "",
500
+ "name": "",
501
+ "extension": "",
502
+ "description": "",
503
+ "author": {
504
+ "name": "",
505
+ "website": ""
506
+ },
507
+ "specifications": [
508
+ {
509
+ "version": 1,
510
+ "changeLog": [],
511
+ "state": {
512
+ "schema": "",
513
+ "initialValue": "",
514
+ "examples": []
515
+ },
516
+ "modules": []
517
+ }
518
+ ]
519
+ }`,
520
+ examples: []
521
+ }
522
+ }
523
+ ]
524
+ }, de = (t) => t != null, It = r.any().refine((t) => de(t));
525
+ function f() {
526
+ return r.object({
527
+ __typename: r.literal("AddChangeLogItemInput").optional(),
528
+ content: r.string(),
529
+ id: r.string(),
530
+ insertBefore: r.string().nullable()
531
+ });
532
+ }
533
+ function _() {
534
+ return r.object({
535
+ description: r.string().nullish(),
536
+ id: r.string(),
537
+ name: r.string()
538
+ });
539
+ }
540
+ function I() {
541
+ return r.object({
542
+ errorCode: r.string().nullish(),
543
+ errorDescription: r.string().nullish(),
544
+ errorName: r.string().nullish(),
545
+ errorTemplate: r.string().nullish(),
546
+ id: r.string(),
547
+ operationId: r.string()
548
+ });
549
+ }
550
+ function T() {
551
+ return r.object({
552
+ example: r.string(),
553
+ id: r.string(),
554
+ operationId: r.string()
555
+ });
556
+ }
557
+ function R() {
558
+ return r.object({
559
+ description: r.string().nullish(),
560
+ id: r.string(),
561
+ moduleId: r.string(),
562
+ name: r.string(),
563
+ reducer: r.string().nullish(),
564
+ schema: r.string().nullish(),
565
+ template: r.string().nullish()
566
+ });
567
+ }
568
+ function D() {
569
+ return r.object({
570
+ example: r.string(),
571
+ id: r.string(),
572
+ insertBefore: r.string().nullish()
573
+ });
574
+ }
575
+ function ce() {
576
+ return r.object({
577
+ __typename: r.literal("Author").optional(),
578
+ name: r.string(),
579
+ website: r.string().nullable()
580
+ });
581
+ }
582
+ function x() {
583
+ return r.object({
584
+ __typename: r.literal("CodeExample").optional(),
585
+ id: r.string(),
586
+ value: r.string()
587
+ });
588
+ }
589
+ function A() {
590
+ return r.object({
591
+ __typename: r.literal("DeleteChangeLogItemInput").optional(),
592
+ id: r.string()
593
+ });
594
+ }
595
+ function M() {
596
+ return r.object({
597
+ id: r.string()
598
+ });
599
+ }
600
+ function b() {
601
+ return r.object({
602
+ id: r.string()
603
+ });
604
+ }
605
+ function N() {
606
+ return r.object({
607
+ id: r.string()
608
+ });
609
+ }
610
+ function L() {
611
+ return r.object({
612
+ id: r.string()
613
+ });
614
+ }
615
+ function P() {
616
+ return r.object({
617
+ id: r.string()
618
+ });
619
+ }
620
+ function Tt() {
621
+ return r.union([
622
+ f(),
623
+ _(),
624
+ I(),
625
+ T(),
626
+ R(),
627
+ D(),
628
+ A(),
629
+ M(),
630
+ b(),
631
+ N(),
632
+ L(),
633
+ P(),
634
+ j(),
635
+ C(),
636
+ k(),
637
+ y(),
638
+ w(),
639
+ U(),
640
+ v(),
641
+ F(),
642
+ H(),
643
+ V(),
644
+ X(),
645
+ G(),
646
+ W(),
647
+ $(),
648
+ z(),
649
+ B(),
650
+ q(),
651
+ J(),
652
+ K(),
653
+ Q(),
654
+ Y(),
655
+ Z(),
656
+ ee(),
657
+ te(),
658
+ re(),
659
+ ne(),
660
+ ie(),
661
+ oe(),
662
+ se()
663
+ ]);
664
+ }
665
+ function Rt() {
666
+ return r.object({
667
+ __typename: r.literal("DocumentModelState").optional(),
668
+ author: ce(),
669
+ description: r.string(),
670
+ extension: r.string(),
671
+ id: r.string(),
672
+ name: r.string(),
673
+ specifications: r.array(ue())
674
+ });
675
+ }
676
+ function ue() {
677
+ return r.object({
678
+ __typename: r.literal("DocumentSpecification").optional(),
679
+ changeLog: r.array(r.string()),
680
+ modules: r.array(me()),
681
+ state: Oe(),
682
+ version: r.number()
683
+ });
684
+ }
685
+ function me() {
686
+ return r.object({
687
+ __typename: r.literal("Module").optional(),
688
+ description: r.string().nullable(),
689
+ id: r.string(),
690
+ name: r.string(),
691
+ operations: r.array(Ee())
692
+ });
693
+ }
694
+ function j() {
695
+ return r.object({
696
+ newModuleId: r.string(),
697
+ operationId: r.string()
698
+ });
699
+ }
700
+ function Ee() {
701
+ return r.object({
702
+ __typename: r.literal("Operation").optional(),
703
+ description: r.string().nullable(),
704
+ errors: r.array(he()),
705
+ examples: r.array(x()),
706
+ id: r.string(),
707
+ name: r.string().nullable(),
708
+ reducer: r.string().nullable(),
709
+ schema: r.string().nullable(),
710
+ template: r.string().nullable()
711
+ });
712
+ }
713
+ function he() {
714
+ return r.object({
715
+ __typename: r.literal("OperationError").optional(),
716
+ code: r.string().nullable(),
717
+ description: r.string().nullable(),
718
+ id: r.string(),
719
+ name: r.string().nullable(),
720
+ template: r.string().nullable()
721
+ });
722
+ }
723
+ function C() {
724
+ return r.object({
725
+ __typename: r.literal("ReorderChangeLogItemsInput").optional(),
726
+ order: r.array(r.string())
727
+ });
728
+ }
729
+ function k() {
730
+ return r.object({
731
+ moduleId: r.string(),
732
+ order: r.array(r.string())
733
+ });
734
+ }
735
+ function y() {
736
+ return r.object({
737
+ order: r.array(r.string())
738
+ });
739
+ }
740
+ function w() {
741
+ return r.object({
742
+ operationId: r.string(),
743
+ order: r.array(r.string())
744
+ });
745
+ }
746
+ function U() {
747
+ return r.object({
748
+ operationId: r.string(),
749
+ order: r.array(r.string())
750
+ });
751
+ }
752
+ function v() {
753
+ return r.object({
754
+ order: r.array(r.string())
755
+ });
756
+ }
757
+ function F() {
758
+ return r.object({
759
+ authorName: r.string()
760
+ });
761
+ }
762
+ function H() {
763
+ return r.object({
764
+ authorWebsite: r.string()
765
+ });
766
+ }
767
+ function V() {
768
+ return r.object({
769
+ initialValue: r.string()
770
+ });
771
+ }
772
+ function X() {
773
+ return r.object({
774
+ description: r.string()
775
+ });
776
+ }
777
+ function G() {
778
+ return r.object({
779
+ extension: r.string()
780
+ });
781
+ }
782
+ function W() {
783
+ return r.object({
784
+ id: r.string()
785
+ });
786
+ }
787
+ function $() {
788
+ return r.object({
789
+ name: r.string()
790
+ });
791
+ }
792
+ function z() {
793
+ return r.object({
794
+ description: r.string().nullish(),
795
+ id: r.string()
796
+ });
797
+ }
798
+ function B() {
799
+ return r.object({
800
+ id: r.string(),
801
+ name: r.string().nullish()
802
+ });
803
+ }
804
+ function q() {
805
+ return r.object({
806
+ description: r.string().nullish(),
807
+ id: r.string()
808
+ });
809
+ }
810
+ function J() {
811
+ return r.object({
812
+ errorCode: r.string().nullish(),
813
+ id: r.string()
814
+ });
815
+ }
816
+ function K() {
817
+ return r.object({
818
+ errorDescription: r.string().nullish(),
819
+ id: r.string()
820
+ });
821
+ }
822
+ function Q() {
823
+ return r.object({
824
+ errorName: r.string().nullish(),
825
+ id: r.string()
826
+ });
827
+ }
828
+ function Y() {
829
+ return r.object({
830
+ errorTemplate: r.string().nullish(),
831
+ id: r.string()
832
+ });
833
+ }
834
+ function Z() {
835
+ return r.object({
836
+ id: r.string(),
837
+ name: r.string().nullish()
838
+ });
839
+ }
840
+ function ee() {
841
+ return r.object({
842
+ id: r.string(),
843
+ reducer: r.string().nullish()
844
+ });
845
+ }
846
+ function te() {
847
+ return r.object({
848
+ id: r.string(),
849
+ schema: r.string().nullish()
850
+ });
851
+ }
852
+ function re() {
853
+ return r.object({
854
+ id: r.string(),
855
+ template: r.string().nullish()
856
+ });
857
+ }
858
+ function ne() {
859
+ return r.object({
860
+ schema: r.string()
861
+ });
862
+ }
863
+ function Oe() {
864
+ return r.object({
865
+ __typename: r.literal("State").optional(),
866
+ examples: r.array(x()),
867
+ initialValue: r.string(),
868
+ schema: r.string()
869
+ });
870
+ }
871
+ function ie() {
872
+ return r.object({
873
+ __typename: r.literal("UpdateChangeLogItemInput").optional(),
874
+ id: r.string(),
875
+ newContent: r.string()
876
+ });
877
+ }
878
+ function oe() {
879
+ return r.object({
880
+ example: r.string(),
881
+ id: r.string()
882
+ });
883
+ }
884
+ function se() {
885
+ return r.object({
886
+ id: r.string(),
887
+ newExample: r.string()
888
+ });
889
+ }
890
+ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
891
+ __proto__: null,
892
+ AddChangeLogItemInputSchema: f,
893
+ AddModuleInputSchema: _,
894
+ AddOperationErrorInputSchema: I,
895
+ AddOperationExampleInputSchema: T,
896
+ AddOperationInputSchema: R,
897
+ AddStateExampleInputSchema: D,
898
+ AuthorSchema: ce,
899
+ CodeExampleSchema: x,
900
+ DeleteChangeLogItemInputSchema: A,
901
+ DeleteModuleInputSchema: M,
902
+ DeleteOperationErrorInputSchema: b,
903
+ DeleteOperationExampleInputSchema: N,
904
+ DeleteOperationInputSchema: L,
905
+ DeleteStateExampleInputSchema: P,
906
+ DocumentModelInputSchema: Tt,
907
+ DocumentModelStateSchema: Rt,
908
+ DocumentSpecificationSchema: ue,
909
+ ModuleSchema: me,
910
+ MoveOperationInputSchema: j,
911
+ OperationErrorSchema: he,
912
+ OperationSchema: Ee,
913
+ ReorderChangeLogItemsInputSchema: C,
914
+ ReorderModuleOperationsInputSchema: k,
915
+ ReorderModulesInputSchema: y,
916
+ ReorderOperationErrorsInputSchema: w,
917
+ ReorderOperationExamplesInputSchema: U,
918
+ ReorderStateExamplesInputSchema: v,
919
+ SetAuthorNameInputSchema: F,
920
+ SetAuthorWebsiteInputSchema: H,
921
+ SetInitialStateInputSchema: V,
922
+ SetModelDescriptionInputSchema: X,
923
+ SetModelExtensionInputSchema: G,
924
+ SetModelIdInputSchema: W,
925
+ SetModelNameInputSchema: $,
926
+ SetModuleDescriptionInputSchema: z,
927
+ SetModuleNameInputSchema: B,
928
+ SetOperationDescriptionInputSchema: q,
929
+ SetOperationErrorCodeInputSchema: J,
930
+ SetOperationErrorDescriptionInputSchema: K,
931
+ SetOperationErrorNameInputSchema: Q,
932
+ SetOperationErrorTemplateInputSchema: Y,
933
+ SetOperationNameInputSchema: Z,
934
+ SetOperationReducerInputSchema: ee,
935
+ SetOperationSchemaInputSchema: te,
936
+ SetOperationTemplateInputSchema: re,
937
+ SetStateSchemaInputSchema: ne,
938
+ StateSchema: Oe,
939
+ UpdateChangeLogItemInputSchema: ie,
940
+ UpdateOperationExampleInputSchema: oe,
941
+ UpdateStateExampleInputSchema: se,
942
+ definedNonNullAnySchema: It,
943
+ isDefinedNonNullAny: de
944
+ }, Symbol.toStringTag, { value: "Module" })), c = {
945
+ setModelNameOperation(t, e) {
946
+ t.name = e.input.name;
947
+ },
948
+ setModelIdOperation(t, e) {
949
+ t.id = e.input.id;
950
+ },
951
+ setModelExtensionOperation(t, e) {
952
+ t.extension = e.input.extension;
953
+ },
954
+ setModelDescriptionOperation(t, e) {
955
+ t.description = e.input.description;
956
+ },
957
+ setAuthorNameOperation(t, e) {
958
+ t.author = t.author || { name: "", website: null }, t.author.name = e.input.authorName;
959
+ },
960
+ setAuthorWebsiteOperation(t, e) {
961
+ t.author = t.author || { name: "", website: null }, t.author.website = e.input.authorWebsite;
962
+ }
963
+ }, E = {
964
+ addChangeLogItemOperation(t, e) {
965
+ throw new Error('Reducer "addChangeLogItemOperation" not yet implemented');
966
+ },
967
+ updateChangeLogItemOperation(t, e) {
968
+ throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented');
969
+ },
970
+ deleteChangeLogItemOperation(t, e) {
971
+ throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented');
972
+ },
973
+ reorderChangeLogItemsOperation(t, e) {
974
+ throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented');
975
+ },
976
+ releaseNewVersionOperation(t, e) {
977
+ throw new Error('Reducer "releaseNewVersionOperation" not yet implemented');
978
+ }
979
+ }, xt = (t) => {
980
+ const e = {};
981
+ return t.forEach((i, n) => e[i] = n), (i, n) => (e[n.id] || 999999) - (e[i.id] || 999999);
982
+ }, h = {
983
+ addModuleOperation(t, e) {
984
+ t.specifications[t.specifications.length - 1].modules.push({
985
+ id: e.input.id,
986
+ name: e.input.name,
987
+ description: e.input.description || "",
988
+ operations: []
989
+ });
990
+ },
991
+ setModuleNameOperation(t, e) {
992
+ const i = t.specifications[t.specifications.length - 1];
993
+ for (let n = 0; n < i.modules.length; n++)
994
+ i.modules[n].id === e.input.id && (i.modules[n].name = e.input.name || "");
995
+ },
996
+ setModuleDescriptionOperation(t, e) {
997
+ const i = t.specifications[t.specifications.length - 1];
998
+ for (let n = 0; n < i.modules.length; n++)
999
+ i.modules[n].id === e.input.id && (i.modules[n].description = e.input.description || "");
1000
+ },
1001
+ deleteModuleOperation(t, e) {
1002
+ const i = t.specifications[t.specifications.length - 1];
1003
+ i.modules = i.modules.filter(
1004
+ (n) => n.id != e.input.id
1005
+ );
1006
+ },
1007
+ reorderModulesOperation(t, e) {
1008
+ t.specifications[t.specifications.length - 1].modules.sort(xt(e.input.order));
1009
+ }
1010
+ }, At = (t) => {
1011
+ const e = {};
1012
+ return t.forEach((i, n) => e[i] = n), (i, n) => (e[n.id] || 999999) - (e[i.id] || 999999);
1013
+ }, d = {
1014
+ addOperationErrorOperation(t, e) {
1015
+ const i = t.specifications[t.specifications.length - 1];
1016
+ for (let n = 0; n < i.modules.length; n++)
1017
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1018
+ i.modules[n].operations[o].id == e.input.operationId && i.modules[n].operations[o].errors.push({
1019
+ id: e.input.id,
1020
+ name: e.input.errorName || "",
1021
+ code: e.input.errorCode || "",
1022
+ description: e.input.errorDescription || "",
1023
+ template: e.input.errorTemplate || ""
1024
+ });
1025
+ },
1026
+ setOperationErrorCodeOperation(t, e) {
1027
+ const i = t.specifications[t.specifications.length - 1];
1028
+ for (let n = 0; n < i.modules.length; n++)
1029
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1030
+ for (let a = 0; a < i.modules[n].operations[o].errors.length; a++)
1031
+ i.modules[n].operations[o].errors[a].id == e.input.id && (i.modules[n].operations[o].errors[a].code = e.input.errorCode || "");
1032
+ },
1033
+ setOperationErrorNameOperation(t, e) {
1034
+ const i = t.specifications[t.specifications.length - 1];
1035
+ for (let n = 0; n < i.modules.length; n++)
1036
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1037
+ for (let a = 0; a < i.modules[n].operations[o].errors.length; a++)
1038
+ i.modules[n].operations[o].errors[a].id == e.input.id && (i.modules[n].operations[o].errors[a].name = e.input.errorName || "");
1039
+ },
1040
+ setOperationErrorDescriptionOperation(t, e) {
1041
+ const i = t.specifications[t.specifications.length - 1];
1042
+ for (let n = 0; n < i.modules.length; n++)
1043
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1044
+ for (let a = 0; a < i.modules[n].operations[o].errors.length; a++)
1045
+ i.modules[n].operations[o].errors[a].id == e.input.id && (i.modules[n].operations[o].errors[a].description = e.input.errorDescription || "");
1046
+ },
1047
+ setOperationErrorTemplateOperation(t, e) {
1048
+ const i = t.specifications[t.specifications.length - 1];
1049
+ for (let n = 0; n < i.modules.length; n++)
1050
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1051
+ for (let a = 0; a < i.modules[n].operations[o].errors.length; a++)
1052
+ i.modules[n].operations[o].errors[a].id == e.input.id && (i.modules[n].operations[o].errors[a].template = e.input.errorTemplate || "");
1053
+ },
1054
+ deleteOperationErrorOperation(t, e) {
1055
+ const i = t.specifications[t.specifications.length - 1];
1056
+ for (let n = 0; n < i.modules.length; n++)
1057
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1058
+ i.modules[n].operations[o].errors = i.modules[n].operations[o].errors.filter((a) => a.id != e.input.id);
1059
+ },
1060
+ reorderOperationErrorsOperation(t, e) {
1061
+ const i = t.specifications[t.specifications.length - 1];
1062
+ for (let n = 0; n < i.modules.length; n++)
1063
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1064
+ i.modules[n].operations[o].id == e.input.operationId && i.modules[n].operations[o].errors.sort(
1065
+ At(e.input.order)
1066
+ );
1067
+ }
1068
+ }, Mt = (t) => {
1069
+ const e = {};
1070
+ return t.forEach((i, n) => e[i] = n), (i, n) => (e[n.id] || 999999) - (e[i.id] || 999999);
1071
+ }, g = {
1072
+ addOperationExampleOperation(t, e) {
1073
+ const i = t.specifications[t.specifications.length - 1];
1074
+ for (let n = 0; n < i.modules.length; n++)
1075
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1076
+ i.modules[n].operations[o].id == e.input.operationId && i.modules[n].operations[o].examples.push({
1077
+ id: e.input.id,
1078
+ value: e.input.example
1079
+ });
1080
+ },
1081
+ updateOperationExampleOperation(t, e) {
1082
+ const i = t.specifications[t.specifications.length - 1];
1083
+ for (let n = 0; n < i.modules.length; n++)
1084
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1085
+ for (let a = 0; a < i.modules[n].operations[o].examples.length; a++)
1086
+ i.modules[n].operations[o].examples[a].id == e.input.id && (i.modules[n].operations[o].examples[a].value = e.input.example);
1087
+ },
1088
+ deleteOperationExampleOperation(t, e) {
1089
+ const i = t.specifications[t.specifications.length - 1];
1090
+ for (let n = 0; n < i.modules.length; n++)
1091
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1092
+ i.modules[n].operations[o].examples = i.modules[n].operations[o].examples.filter(
1093
+ (a) => a.id != e.input.id
1094
+ );
1095
+ },
1096
+ reorderOperationExamplesOperation(t, e) {
1097
+ const i = t.specifications[t.specifications.length - 1];
1098
+ for (let n = 0; n < i.modules.length; n++)
1099
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1100
+ i.modules[n].operations[o].id == e.input.operationId && i.modules[n].operations[o].examples.sort(
1101
+ Mt(e.input.order)
1102
+ );
1103
+ }
1104
+ }, bt = (t) => {
1105
+ const e = {};
1106
+ return t.forEach((i, n) => e[i] = n), (i, n) => (e[n.id] || 999999) - (e[i.id] || 999999);
1107
+ }, p = {
1108
+ addOperationOperation(t, e) {
1109
+ const i = t.specifications[t.specifications.length - 1];
1110
+ for (let n = 0; n < i.modules.length; n++)
1111
+ i.modules[n].id == e.input.moduleId && i.modules[n].operations.push({
1112
+ id: e.input.id,
1113
+ name: e.input.name,
1114
+ description: e.input.description || "",
1115
+ schema: e.input.schema || "",
1116
+ template: e.input.template || e.input.description || "",
1117
+ reducer: e.input.reducer || "",
1118
+ errors: [],
1119
+ examples: []
1120
+ });
1121
+ },
1122
+ setOperationNameOperation(t, e) {
1123
+ const i = t.specifications[t.specifications.length - 1];
1124
+ for (let n = 0; n < i.modules.length; n++)
1125
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1126
+ i.modules[n].operations[o].id == e.input.id && (i.modules[n].operations[o].name = e.input.name || "");
1127
+ },
1128
+ setOperationSchemaOperation(t, e) {
1129
+ const i = t.specifications[t.specifications.length - 1];
1130
+ for (let n = 0; n < i.modules.length; n++)
1131
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1132
+ i.modules[n].operations[o].id == e.input.id && (i.modules[n].operations[o].schema = e.input.schema || "");
1133
+ },
1134
+ setOperationDescriptionOperation(t, e) {
1135
+ const i = t.specifications[t.specifications.length - 1];
1136
+ for (let n = 0; n < i.modules.length; n++)
1137
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1138
+ i.modules[n].operations[o].id == e.input.id && (i.modules[n].operations[o].description = e.input.description || "");
1139
+ },
1140
+ setOperationTemplateOperation(t, e) {
1141
+ const i = t.specifications[t.specifications.length - 1];
1142
+ for (let n = 0; n < i.modules.length; n++)
1143
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1144
+ i.modules[n].operations[o].id == e.input.id && (i.modules[n].operations[o].template = e.input.template || "");
1145
+ },
1146
+ setOperationReducerOperation(t, e) {
1147
+ const i = t.specifications[t.specifications.length - 1];
1148
+ for (let n = 0; n < i.modules.length; n++)
1149
+ for (let o = 0; o < i.modules[n].operations.length; o++)
1150
+ i.modules[n].operations[o].id == e.input.id && (i.modules[n].operations[o].reducer = e.input.reducer || "");
1151
+ },
1152
+ moveOperationOperation(t, e) {
1153
+ const i = [], n = t.specifications[t.specifications.length - 1];
1154
+ for (let o = 0; o < n.modules.length; o++)
1155
+ n.modules[o].operations = n.modules[o].operations.filter((a) => a.id == e.input.operationId ? (i.push(a), !1) : !0);
1156
+ for (let o = 0; o < n.modules.length; o++)
1157
+ n.modules[o].id == e.input.newModuleId && n.modules[o].operations.push(...i);
1158
+ },
1159
+ deleteOperationOperation(t, e) {
1160
+ const i = t.specifications[t.specifications.length - 1];
1161
+ for (let n = 0; n < i.modules.length; n++)
1162
+ i.modules[n].operations = i.modules[n].operations.filter((o) => o.id != e.input.id);
1163
+ },
1164
+ reorderModuleOperationsOperation(t, e) {
1165
+ const i = t.specifications[t.specifications.length - 1];
1166
+ for (let n = 0; n < i.modules.length; n++)
1167
+ i.modules[n].id == e.input.moduleId && i.modules[n].operations.sort(
1168
+ bt(e.input.order)
1169
+ );
1170
+ }
1171
+ }, Nt = (t) => {
1172
+ const e = {};
1173
+ return t.forEach((i, n) => e[i] = n), (i, n) => (e[n.id] || 999999) - (e[i.id] || 999999);
1174
+ }, u = {
1175
+ setStateSchemaOperation(t, e) {
1176
+ const i = t.specifications[t.specifications.length - 1];
1177
+ i.state.schema = e.input.schema;
1178
+ },
1179
+ setInitialStateOperation(t, e) {
1180
+ const i = t.specifications[t.specifications.length - 1];
1181
+ i.state.initialValue = e.input.initialValue;
1182
+ },
1183
+ addStateExampleOperation(t, e) {
1184
+ t.specifications[t.specifications.length - 1].state.examples.push({
1185
+ id: e.input.id,
1186
+ value: e.input.example
1187
+ });
1188
+ },
1189
+ updateStateExampleOperation(t, e) {
1190
+ const i = t.specifications[t.specifications.length - 1];
1191
+ for (let n = 0; n < i.state.examples.length; n++)
1192
+ i.state.examples[n].id == e.input.id && (i.state.examples[n].value = e.input.newExample);
1193
+ },
1194
+ deleteStateExampleOperation(t, e) {
1195
+ const i = t.specifications[t.specifications.length - 1];
1196
+ i.state.examples = i.state.examples.filter(
1197
+ (n) => n.id != e.input.id
1198
+ );
1199
+ },
1200
+ reorderStateExamplesOperation(t, e) {
1201
+ t.specifications[t.specifications.length - 1].state.examples.sort(Nt(e.input.order));
1202
+ }
1203
+ }, Lt = (t, e) => {
1204
+ if (ct(e))
1205
+ return t;
1206
+ switch (e.type) {
1207
+ case "SET_MODEL_NAME":
1208
+ $().parse(e.input), c.setModelNameOperation(t, e);
1209
+ break;
1210
+ case "SET_MODEL_ID":
1211
+ W().parse(e.input), c.setModelIdOperation(t, e);
1212
+ break;
1213
+ case "SET_MODEL_EXTENSION":
1214
+ G().parse(e.input), c.setModelExtensionOperation(t, e);
1215
+ break;
1216
+ case "SET_MODEL_DESCRIPTION":
1217
+ X().parse(e.input), c.setModelDescriptionOperation(t, e);
1218
+ break;
1219
+ case "SET_AUTHOR_NAME":
1220
+ F().parse(e.input), c.setAuthorNameOperation(t, e);
1221
+ break;
1222
+ case "SET_AUTHOR_WEBSITE":
1223
+ H().parse(e.input), c.setAuthorWebsiteOperation(t, e);
1224
+ break;
1225
+ case "ADD_CHANGE_LOG_ITEM":
1226
+ f().parse(e.input), E.addChangeLogItemOperation(t, e);
1227
+ break;
1228
+ case "UPDATE_CHANGE_LOG_ITEM":
1229
+ ie().parse(e.input), E.updateChangeLogItemOperation(t, e);
1230
+ break;
1231
+ case "DELETE_CHANGE_LOG_ITEM":
1232
+ A().parse(e.input), E.deleteChangeLogItemOperation(t, e);
1233
+ break;
1234
+ case "REORDER_CHANGE_LOG_ITEMS":
1235
+ C().parse(e.input), E.reorderChangeLogItemsOperation(t, e);
1236
+ break;
1237
+ case "RELEASE_NEW_VERSION":
1238
+ if (Object.keys(e.input).length > 0)
1239
+ throw new Error(
1240
+ "Expected empty input for action RELEASE_NEW_VERSION"
1241
+ );
1242
+ E.releaseNewVersionOperation(t, e);
1243
+ break;
1244
+ case "ADD_MODULE":
1245
+ _().parse(e.input), h.addModuleOperation(t, e);
1246
+ break;
1247
+ case "SET_MODULE_NAME":
1248
+ B().parse(e.input), h.setModuleNameOperation(t, e);
1249
+ break;
1250
+ case "SET_MODULE_DESCRIPTION":
1251
+ z().parse(e.input), h.setModuleDescriptionOperation(t, e);
1252
+ break;
1253
+ case "DELETE_MODULE":
1254
+ M().parse(e.input), h.deleteModuleOperation(t, e);
1255
+ break;
1256
+ case "REORDER_MODULES":
1257
+ y().parse(e.input), h.reorderModulesOperation(t, e);
1258
+ break;
1259
+ case "ADD_OPERATION_ERROR":
1260
+ I().parse(e.input), d.addOperationErrorOperation(t, e);
1261
+ break;
1262
+ case "SET_OPERATION_ERROR_CODE":
1263
+ J().parse(e.input), d.setOperationErrorCodeOperation(t, e);
1264
+ break;
1265
+ case "SET_OPERATION_ERROR_NAME":
1266
+ Q().parse(e.input), d.setOperationErrorNameOperation(t, e);
1267
+ break;
1268
+ case "SET_OPERATION_ERROR_DESCRIPTION":
1269
+ K().parse(e.input), d.setOperationErrorDescriptionOperation(
1270
+ t,
1271
+ e
1272
+ );
1273
+ break;
1274
+ case "SET_OPERATION_ERROR_TEMPLATE":
1275
+ Y().parse(e.input), d.setOperationErrorTemplateOperation(
1276
+ t,
1277
+ e
1278
+ );
1279
+ break;
1280
+ case "DELETE_OPERATION_ERROR":
1281
+ b().parse(e.input), d.deleteOperationErrorOperation(t, e);
1282
+ break;
1283
+ case "REORDER_OPERATION_ERRORS":
1284
+ w().parse(e.input), d.reorderOperationErrorsOperation(
1285
+ t,
1286
+ e
1287
+ );
1288
+ break;
1289
+ case "ADD_OPERATION_EXAMPLE":
1290
+ T().parse(e.input), g.addOperationExampleOperation(t, e);
1291
+ break;
1292
+ case "UPDATE_OPERATION_EXAMPLE":
1293
+ oe().parse(e.input), g.updateOperationExampleOperation(
1294
+ t,
1295
+ e
1296
+ );
1297
+ break;
1298
+ case "DELETE_OPERATION_EXAMPLE":
1299
+ N().parse(e.input), g.deleteOperationExampleOperation(
1300
+ t,
1301
+ e
1302
+ );
1303
+ break;
1304
+ case "REORDER_OPERATION_EXAMPLES":
1305
+ U().parse(e.input), g.reorderOperationExamplesOperation(
1306
+ t,
1307
+ e
1308
+ );
1309
+ break;
1310
+ case "ADD_OPERATION":
1311
+ R().parse(e.input), p.addOperationOperation(t, e);
1312
+ break;
1313
+ case "SET_OPERATION_NAME":
1314
+ Z().parse(e.input), p.setOperationNameOperation(t, e);
1315
+ break;
1316
+ case "SET_OPERATION_SCHEMA":
1317
+ te().parse(e.input), p.setOperationSchemaOperation(t, e);
1318
+ break;
1319
+ case "SET_OPERATION_DESCRIPTION":
1320
+ q().parse(e.input), p.setOperationDescriptionOperation(t, e);
1321
+ break;
1322
+ case "SET_OPERATION_TEMPLATE":
1323
+ re().parse(e.input), p.setOperationTemplateOperation(t, e);
1324
+ break;
1325
+ case "SET_OPERATION_REDUCER":
1326
+ ee().parse(e.input), p.setOperationReducerOperation(t, e);
1327
+ break;
1328
+ case "MOVE_OPERATION":
1329
+ j().parse(e.input), p.moveOperationOperation(t, e);
1330
+ break;
1331
+ case "DELETE_OPERATION":
1332
+ L().parse(e.input), p.deleteOperationOperation(t, e);
1333
+ break;
1334
+ case "REORDER_MODULE_OPERATIONS":
1335
+ k().parse(e.input), p.reorderModuleOperationsOperation(t, e);
1336
+ break;
1337
+ case "SET_STATE_SCHEMA":
1338
+ ne().parse(e.input), u.setStateSchemaOperation(t, e);
1339
+ break;
1340
+ case "SET_INITIAL_STATE":
1341
+ V().parse(e.input), u.setInitialStateOperation(t, e);
1342
+ break;
1343
+ case "ADD_STATE_EXAMPLE":
1344
+ D().parse(e.input), u.addStateExampleOperation(t, e);
1345
+ break;
1346
+ case "UPDATE_STATE_EXAMPLE":
1347
+ se().parse(e.input), u.updateStateExampleOperation(t, e);
1348
+ break;
1349
+ case "DELETE_STATE_EXAMPLE":
1350
+ P().parse(e.input), u.deleteStateExampleOperation(t, e);
1351
+ break;
1352
+ case "REORDER_STATE_EXAMPLES":
1353
+ v().parse(e.input), u.reorderStateExamplesOperation(t, e);
1354
+ break;
1355
+ default:
1356
+ return t;
1357
+ }
1358
+ }, S = dt(
1359
+ Lt
1360
+ ), Pt = {
1361
+ id: "",
1362
+ name: "",
1363
+ extension: "",
1364
+ description: "",
1365
+ author: {
1366
+ name: "",
1367
+ website: ""
1368
+ },
1369
+ specifications: [
1370
+ {
1371
+ version: 1,
1372
+ changeLog: [],
1373
+ state: {
1374
+ schema: "",
1375
+ initialValue: "",
1376
+ examples: []
1377
+ },
1378
+ modules: []
1379
+ }
1380
+ ]
1381
+ }, O = {
1382
+ fileExtension: "phdm",
1383
+ createState(t) {
1384
+ return { ...Pt, ...t };
1385
+ },
1386
+ createExtendedState(t) {
1387
+ return ut(
1388
+ { ...t, documentType: "powerhouse/document-model" },
1389
+ O.createState
1390
+ );
1391
+ },
1392
+ createDocument(t) {
1393
+ return mt(
1394
+ O.createExtendedState(t),
1395
+ O.createState
1396
+ );
1397
+ },
1398
+ saveToFile(t, e, i) {
1399
+ return Et(t, e, "phdm", i);
1400
+ },
1401
+ saveToFileHandle(t, e) {
1402
+ return ht(t, e);
1403
+ },
1404
+ loadFromFile(t) {
1405
+ return Ot(t, S);
1406
+ },
1407
+ loadFromInput(t) {
1408
+ return St(t, S);
1409
+ }
1410
+ }, Se = (t) => s(
1411
+ "SET_MODEL_NAME",
1412
+ { ...t }
1413
+ ), ge = (t) => s(
1414
+ "SET_MODEL_ID",
1415
+ { ...t }
1416
+ ), fe = (t) => s(
1417
+ "SET_MODEL_EXTENSION",
1418
+ { ...t }
1419
+ ), _e = (t) => s(
1420
+ "SET_MODEL_DESCRIPTION",
1421
+ { ...t }
1422
+ ), Ie = (t) => s(
1423
+ "SET_AUTHOR_NAME",
1424
+ { ...t }
1425
+ ), Te = (t) => s(
1426
+ "SET_AUTHOR_WEBSITE",
1427
+ { ...t }
1428
+ );
1429
+ class jt extends l {
1430
+ setModelName(e) {
1431
+ return this.dispatch(Se(e));
1432
+ }
1433
+ setModelId(e) {
1434
+ return this.dispatch(ge(e));
1435
+ }
1436
+ setModelExtension(e) {
1437
+ return this.dispatch(fe(e));
1438
+ }
1439
+ setModelDescription(e) {
1440
+ return this.dispatch(_e(e));
1441
+ }
1442
+ setAuthorName(e) {
1443
+ return this.dispatch(Ie(e));
1444
+ }
1445
+ setAuthorWebsite(e) {
1446
+ return this.dispatch(Te(e));
1447
+ }
1448
+ }
1449
+ const Re = (t) => s(
1450
+ "ADD_CHANGE_LOG_ITEM",
1451
+ { ...t }
1452
+ ), De = (t) => s(
1453
+ "UPDATE_CHANGE_LOG_ITEM",
1454
+ { ...t }
1455
+ ), xe = (t) => s(
1456
+ "DELETE_CHANGE_LOG_ITEM",
1457
+ { ...t }
1458
+ ), Ae = (t) => s(
1459
+ "REORDER_CHANGE_LOG_ITEMS",
1460
+ { ...t }
1461
+ ), Me = () => s("RELEASE_NEW_VERSION");
1462
+ class Ct extends l {
1463
+ addChangeLogItem(e) {
1464
+ return this.dispatch(Re(e));
1465
+ }
1466
+ updateChangeLogItem(e) {
1467
+ return this.dispatch(De(e));
1468
+ }
1469
+ deleteChangeLogItem(e) {
1470
+ return this.dispatch(xe(e));
1471
+ }
1472
+ reorderChangeLogItems(e) {
1473
+ return this.dispatch(Ae(e));
1474
+ }
1475
+ releaseNewVersion() {
1476
+ return this.dispatch(Me());
1477
+ }
1478
+ }
1479
+ const be = (t) => s(
1480
+ "ADD_MODULE",
1481
+ { ...t }
1482
+ ), Ne = (t) => s(
1483
+ "SET_MODULE_NAME",
1484
+ { ...t }
1485
+ ), Le = (t) => s(
1486
+ "SET_MODULE_DESCRIPTION",
1487
+ { ...t }
1488
+ ), Pe = (t) => s(
1489
+ "DELETE_MODULE",
1490
+ { ...t }
1491
+ ), je = (t) => s(
1492
+ "REORDER_MODULES",
1493
+ { ...t }
1494
+ );
1495
+ class kt extends l {
1496
+ addModule(e) {
1497
+ return this.dispatch(be(e));
1498
+ }
1499
+ setModuleName(e) {
1500
+ return this.dispatch(Ne(e));
1501
+ }
1502
+ setModuleDescription(e) {
1503
+ return this.dispatch(Le(e));
1504
+ }
1505
+ deleteModule(e) {
1506
+ return this.dispatch(Pe(e));
1507
+ }
1508
+ reorderModules(e) {
1509
+ return this.dispatch(je(e));
1510
+ }
1511
+ }
1512
+ const Ce = (t) => s(
1513
+ "ADD_OPERATION_ERROR",
1514
+ { ...t }
1515
+ ), ke = (t) => s(
1516
+ "SET_OPERATION_ERROR_CODE",
1517
+ { ...t }
1518
+ ), ye = (t) => s(
1519
+ "SET_OPERATION_ERROR_NAME",
1520
+ { ...t }
1521
+ ), we = (t) => s(
1522
+ "SET_OPERATION_ERROR_DESCRIPTION",
1523
+ { ...t }
1524
+ ), Ue = (t) => s(
1525
+ "SET_OPERATION_ERROR_TEMPLATE",
1526
+ { ...t }
1527
+ ), ve = (t) => s(
1528
+ "DELETE_OPERATION_ERROR",
1529
+ { ...t }
1530
+ ), Fe = (t) => s(
1531
+ "REORDER_OPERATION_ERRORS",
1532
+ { ...t }
1533
+ );
1534
+ class yt extends l {
1535
+ addOperationError(e) {
1536
+ return this.dispatch(Ce(e));
1537
+ }
1538
+ setOperationErrorCode(e) {
1539
+ return this.dispatch(ke(e));
1540
+ }
1541
+ setOperationErrorName(e) {
1542
+ return this.dispatch(ye(e));
1543
+ }
1544
+ setOperationErrorDescription(e) {
1545
+ return this.dispatch(we(e));
1546
+ }
1547
+ setOperationErrorTemplate(e) {
1548
+ return this.dispatch(Ue(e));
1549
+ }
1550
+ deleteOperationError(e) {
1551
+ return this.dispatch(ve(e));
1552
+ }
1553
+ reorderOperationErrors(e) {
1554
+ return this.dispatch(Fe(e));
1555
+ }
1556
+ }
1557
+ const He = (t) => s(
1558
+ "ADD_OPERATION_EXAMPLE",
1559
+ { ...t }
1560
+ ), Ve = (t) => s(
1561
+ "UPDATE_OPERATION_EXAMPLE",
1562
+ { ...t }
1563
+ ), Xe = (t) => s(
1564
+ "DELETE_OPERATION_EXAMPLE",
1565
+ { ...t }
1566
+ ), Ge = (t) => s(
1567
+ "REORDER_OPERATION_EXAMPLES",
1568
+ { ...t }
1569
+ );
1570
+ class wt extends l {
1571
+ addOperationExample(e) {
1572
+ return this.dispatch(He(e));
1573
+ }
1574
+ updateOperationExample(e) {
1575
+ return this.dispatch(Ve(e));
1576
+ }
1577
+ deleteOperationExample(e) {
1578
+ return this.dispatch(Xe(e));
1579
+ }
1580
+ reorderOperationExamples(e) {
1581
+ return this.dispatch(Ge(e));
1582
+ }
1583
+ }
1584
+ const We = (t) => s(
1585
+ "ADD_OPERATION",
1586
+ { ...t }
1587
+ ), $e = (t) => s(
1588
+ "SET_OPERATION_NAME",
1589
+ { ...t }
1590
+ ), ze = (t) => s(
1591
+ "SET_OPERATION_SCHEMA",
1592
+ { ...t }
1593
+ ), Be = (t) => s(
1594
+ "SET_OPERATION_DESCRIPTION",
1595
+ { ...t }
1596
+ ), qe = (t) => s(
1597
+ "SET_OPERATION_TEMPLATE",
1598
+ { ...t }
1599
+ ), Je = (t) => s(
1600
+ "SET_OPERATION_REDUCER",
1601
+ { ...t }
1602
+ ), Ke = (t) => s(
1603
+ "MOVE_OPERATION",
1604
+ { ...t }
1605
+ ), Qe = (t) => s(
1606
+ "DELETE_OPERATION",
1607
+ { ...t }
1608
+ ), Ye = (t) => s(
1609
+ "REORDER_MODULE_OPERATIONS",
1610
+ { ...t }
1611
+ );
1612
+ class Ut extends l {
1613
+ addOperation(e) {
1614
+ return this.dispatch(We(e));
1615
+ }
1616
+ setOperationName(e) {
1617
+ return this.dispatch($e(e));
1618
+ }
1619
+ setOperationSchema(e) {
1620
+ return this.dispatch(ze(e));
1621
+ }
1622
+ setOperationDescription(e) {
1623
+ return this.dispatch(Be(e));
1624
+ }
1625
+ setOperationTemplate(e) {
1626
+ return this.dispatch(qe(e));
1627
+ }
1628
+ setOperationReducer(e) {
1629
+ return this.dispatch(Je(e));
1630
+ }
1631
+ moveOperation(e) {
1632
+ return this.dispatch(Ke(e));
1633
+ }
1634
+ deleteOperation(e) {
1635
+ return this.dispatch(Qe(e));
1636
+ }
1637
+ reorderModuleOperations(e) {
1638
+ return this.dispatch(Ye(e));
1639
+ }
1640
+ }
1641
+ const Ze = (t) => s(
1642
+ "SET_STATE_SCHEMA",
1643
+ { ...t }
1644
+ ), et = (t) => s(
1645
+ "SET_INITIAL_STATE",
1646
+ { ...t }
1647
+ ), tt = (t) => s(
1648
+ "ADD_STATE_EXAMPLE",
1649
+ { ...t }
1650
+ ), rt = (t) => s(
1651
+ "UPDATE_STATE_EXAMPLE",
1652
+ { ...t }
1653
+ ), nt = (t) => s(
1654
+ "DELETE_STATE_EXAMPLE",
1655
+ { ...t }
1656
+ ), it = (t) => s(
1657
+ "REORDER_STATE_EXAMPLES",
1658
+ { ...t }
1659
+ );
1660
+ class vt extends l {
1661
+ setStateSchema(e) {
1662
+ return this.dispatch(Ze(e));
1663
+ }
1664
+ setInitialState(e) {
1665
+ return this.dispatch(et(e));
1666
+ }
1667
+ addStateExample(e) {
1668
+ return this.dispatch(tt(e));
1669
+ }
1670
+ updateStateExample(e) {
1671
+ return this.dispatch(rt(e));
1672
+ }
1673
+ deleteStateExample(e) {
1674
+ return this.dispatch(nt(e));
1675
+ }
1676
+ reorderStateExamples(e) {
1677
+ return this.dispatch(it(e));
1678
+ }
1679
+ }
1680
+ var m;
1681
+ let ae = (m = class extends l {
1682
+ constructor(e) {
1683
+ super(S, O.createDocument(e));
1684
+ }
1685
+ saveToFile(e, i) {
1686
+ return super.saveToFile(e, m.fileExtension, i);
1687
+ }
1688
+ loadFromFile(e) {
1689
+ return super.loadFromFile(e);
1690
+ }
1691
+ static async fromFile(e) {
1692
+ const i = new this();
1693
+ return await i.loadFromFile(e), i;
1694
+ }
1695
+ }, pe(m, "fileExtension", "phdm"), m);
1696
+ gt(ae, [
1697
+ jt,
1698
+ Ct,
1699
+ kt,
1700
+ yt,
1701
+ wt,
1702
+ Ut,
1703
+ vt
1704
+ ]);
1705
+ const Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1706
+ __proto__: null,
1707
+ addChangeLogItem: Re,
1708
+ addModule: be,
1709
+ addOperation: We,
1710
+ addOperationError: Ce,
1711
+ addOperationExample: He,
1712
+ addStateExample: tt,
1713
+ deleteChangeLogItem: xe,
1714
+ deleteModule: Pe,
1715
+ deleteOperation: Qe,
1716
+ deleteOperationError: ve,
1717
+ deleteOperationExample: Xe,
1718
+ deleteStateExample: nt,
1719
+ moveOperation: Ke,
1720
+ releaseNewVersion: Me,
1721
+ reorderChangeLogItems: Ae,
1722
+ reorderModuleOperations: Ye,
1723
+ reorderModules: je,
1724
+ reorderOperationErrors: Fe,
1725
+ reorderOperationExamples: Ge,
1726
+ reorderStateExamples: it,
1727
+ setAuthorName: Ie,
1728
+ setAuthorWebsite: Te,
1729
+ setInitialState: et,
1730
+ setModelDescription: _e,
1731
+ setModelExtension: fe,
1732
+ setModelId: ge,
1733
+ setModelName: Se,
1734
+ setModuleDescription: Le,
1735
+ setModuleName: Ne,
1736
+ setOperationDescription: Be,
1737
+ setOperationErrorCode: ke,
1738
+ setOperationErrorDescription: we,
1739
+ setOperationErrorName: ye,
1740
+ setOperationErrorTemplate: Ue,
1741
+ setOperationName: $e,
1742
+ setOperationReducer: Je,
1743
+ setOperationSchema: ze,
1744
+ setOperationTemplate: qe,
1745
+ setStateSchema: Ze,
1746
+ updateChangeLogItem: De,
1747
+ updateOperationExample: Ve,
1748
+ updateStateExample: rt
1749
+ }, Symbol.toStringTag, { value: "Module" })), ot = ae, st = { ...O, ..._t }, at = { ...ft, ...Ft }, Ht = {
1750
+ Document: ot,
1751
+ reducer: S,
1752
+ actions: at,
1753
+ utils: st,
1754
+ documentModel: le
1755
+ }, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1756
+ __proto__: null,
1757
+ Document: ot,
1758
+ DocumentModel: ae,
1759
+ actions: at,
1760
+ documentModel: le,
1761
+ module: Ht,
1762
+ reducer: S,
1763
+ utils: st,
1764
+ z: Dt
1765
+ }, Symbol.toStringTag, { value: "Module" }));
1766
+ export {
1767
+ qt as D,
1768
+ ae as a,
1769
+ ot as b,
1770
+ at as c,
1771
+ le as d,
1772
+ Ht as m,
1773
+ S as r,
1774
+ st as u,
1775
+ Dt as z
1776
+ };