document-model 1.0.20 → 1.0.21

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