document-model 1.0.19 → 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 -285
  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 -173
  10. package/dist/browser/document/schema/zod.d.ts +0 -111
  11. package/dist/browser/document/signal.d.ts +0 -22
  12. package/dist/browser/document/types.d.ts +0 -193
  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 -451
  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-1ad32a2e.js +0 -22
  75. package/dist/browser/internal/index-2551382e.js +0 -34
  76. package/dist/browser/internal/index-46b68530.js +0 -1922
  77. package/dist/browser/internal/index-869c5d0d.js +0 -1
  78. package/dist/browser/internal/object-1fdba77d.js +0 -6
  79. package/dist/browser/internal/object-d50f7d2f.js +0 -1741
  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 -285
  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 -173
  88. package/dist/node/document/schema/zod.d.ts +0 -111
  89. package/dist/node/document/signal.d.ts +0 -22
  90. package/dist/node/document/types.d.ts +0 -193
  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 -451
  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-631ba7bf.js +0 -22
  153. package/dist/node/internal/index-6477ee0a.js +0 -1
  154. package/dist/node/internal/index-8d582c48.js +0 -1926
  155. package/dist/node/internal/index-f235f9be.js +0 -34
  156. package/dist/node/internal/object-08bd169a.js +0 -1
  157. package/dist/node/internal/object-773231ca.js +0 -743
@@ -1,1922 +0,0 @@
1
- var dt = Object.defineProperty;
2
- var ut = (t, e, o) => e in t ? dt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var le = (t, e, o) => (ut(t, typeof e != "symbol" ? e + "" : e, o), o);
4
- import { c as mt, i as Et, a as ht, b as Ot, s as gt, d as St, l as bt, e as ft, f as s, B as l, g as _t, h as It } from "./object-d50f7d2f.js";
5
- import "json-stringify-deterministic";
6
- import "immer";
7
- import "jszip";
8
- import { z as r } from "zod";
9
- const Tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10
- __proto__: null
11
- }, Symbol.toStringTag, { value: "Module" })), ce = {
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
- }, de = (t) => t != null, Rt = r.any().refine((t) => de(t));
573
- function f() {
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 _() {
582
- return r.object({
583
- description: r.string().nullish(),
584
- id: r.string(),
585
- name: r.string()
586
- });
587
- }
588
- function I() {
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 T() {
599
- return r.object({
600
- example: r.string(),
601
- id: r.string(),
602
- operationId: r.string()
603
- });
604
- }
605
- function R() {
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: r.literal("local").or(r.literal("global")).nullish()
615
- });
616
- }
617
- function A() {
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 ue() {
626
- return r.object({
627
- __typename: r.literal("Author").optional(),
628
- name: r.string(),
629
- website: r.string().nullable()
630
- });
631
- }
632
- function x() {
633
- return r.object({
634
- __typename: r.literal("CodeExample").optional(),
635
- id: r.string(),
636
- value: r.string()
637
- });
638
- }
639
- function D() {
640
- return r.object({
641
- __typename: r.literal("DeleteChangeLogItemInput").optional(),
642
- id: r.string()
643
- });
644
- }
645
- function M() {
646
- return r.object({
647
- id: r.string()
648
- });
649
- }
650
- function N() {
651
- return r.object({
652
- id: r.string()
653
- });
654
- }
655
- function L() {
656
- return r.object({
657
- id: r.string()
658
- });
659
- }
660
- function P() {
661
- return r.object({
662
- id: r.string()
663
- });
664
- }
665
- function j() {
666
- return r.object({
667
- scope: r.string(),
668
- id: r.string()
669
- });
670
- }
671
- function At() {
672
- return r.union([
673
- f(),
674
- _(),
675
- I(),
676
- T(),
677
- R(),
678
- A(),
679
- D(),
680
- M(),
681
- N(),
682
- L(),
683
- P(),
684
- j(),
685
- C(),
686
- k(),
687
- y(),
688
- w(),
689
- v(),
690
- U(),
691
- V(),
692
- F(),
693
- H(),
694
- X(),
695
- G(),
696
- $(),
697
- W(),
698
- z(),
699
- B(),
700
- q(),
701
- J(),
702
- K(),
703
- Q(),
704
- Y(),
705
- Z(),
706
- ee(),
707
- te(),
708
- re(),
709
- oe(),
710
- ne(),
711
- ie(),
712
- se(),
713
- ae()
714
- ]);
715
- }
716
- function xt() {
717
- return r.object({
718
- __typename: r.literal("DocumentModelState").optional(),
719
- author: ue(),
720
- description: r.string(),
721
- extension: r.string(),
722
- id: r.string(),
723
- name: r.string(),
724
- specifications: r.array(me())
725
- });
726
- }
727
- function me() {
728
- return r.object({
729
- __typename: r.literal("DocumentSpecification").optional(),
730
- changeLog: r.array(r.string()),
731
- modules: r.array(Ee()),
732
- state: Se(),
733
- version: r.number()
734
- });
735
- }
736
- function Ee() {
737
- return r.object({
738
- __typename: r.literal("Module").optional(),
739
- description: r.string().nullable(),
740
- id: r.string(),
741
- name: r.string(),
742
- operations: r.array(he())
743
- });
744
- }
745
- function C() {
746
- return r.object({
747
- newModuleId: r.string(),
748
- operationId: r.string()
749
- });
750
- }
751
- function he() {
752
- return r.object({
753
- __typename: r.literal("Operation").optional(),
754
- description: r.string().nullable(),
755
- errors: r.array(Oe()),
756
- examples: r.array(x()),
757
- id: r.string(),
758
- name: r.string().nullable(),
759
- reducer: r.string().nullable(),
760
- schema: r.string().nullable(),
761
- template: r.string().nullable(),
762
- scope: r.literal("local").or(r.literal("global"))
763
- });
764
- }
765
- function Oe() {
766
- return r.object({
767
- __typename: r.literal("OperationError").optional(),
768
- code: r.string().nullable(),
769
- description: r.string().nullable(),
770
- id: r.string(),
771
- name: r.string().nullable(),
772
- template: r.string().nullable()
773
- });
774
- }
775
- function k() {
776
- return r.object({
777
- __typename: r.literal("ReorderChangeLogItemsInput").optional(),
778
- order: r.array(r.string())
779
- });
780
- }
781
- function y() {
782
- return r.object({
783
- moduleId: r.string(),
784
- order: r.array(r.string())
785
- });
786
- }
787
- function w() {
788
- return r.object({
789
- order: r.array(r.string())
790
- });
791
- }
792
- function v() {
793
- return r.object({
794
- operationId: r.string(),
795
- order: r.array(r.string())
796
- });
797
- }
798
- function U() {
799
- return r.object({
800
- operationId: r.string(),
801
- order: r.array(r.string())
802
- });
803
- }
804
- function V() {
805
- return r.object({
806
- scope: r.string(),
807
- order: r.array(r.string())
808
- });
809
- }
810
- function F() {
811
- return r.object({
812
- authorName: r.string()
813
- });
814
- }
815
- function H() {
816
- return r.object({
817
- authorWebsite: r.string()
818
- });
819
- }
820
- function X() {
821
- return r.object({
822
- scope: r.string(),
823
- initialValue: r.string()
824
- });
825
- }
826
- function G() {
827
- return r.object({
828
- description: r.string()
829
- });
830
- }
831
- function $() {
832
- return r.object({
833
- extension: r.string()
834
- });
835
- }
836
- function W() {
837
- return r.object({
838
- id: r.string()
839
- });
840
- }
841
- function z() {
842
- return r.object({
843
- name: r.string()
844
- });
845
- }
846
- function B() {
847
- return r.object({
848
- description: r.string().nullish(),
849
- id: r.string()
850
- });
851
- }
852
- function q() {
853
- return r.object({
854
- id: r.string(),
855
- name: r.string().nullish()
856
- });
857
- }
858
- function J() {
859
- return r.object({
860
- description: r.string().nullish(),
861
- id: r.string()
862
- });
863
- }
864
- function K() {
865
- return r.object({
866
- errorCode: r.string().nullish(),
867
- id: r.string()
868
- });
869
- }
870
- function Q() {
871
- return r.object({
872
- errorDescription: r.string().nullish(),
873
- id: r.string()
874
- });
875
- }
876
- function Y() {
877
- return r.object({
878
- errorName: r.string().nullish(),
879
- id: r.string()
880
- });
881
- }
882
- function Z() {
883
- return r.object({
884
- errorTemplate: r.string().nullish(),
885
- id: r.string()
886
- });
887
- }
888
- function ee() {
889
- return r.object({
890
- id: r.string(),
891
- name: r.string().nullish()
892
- });
893
- }
894
- function ge() {
895
- return r.object({
896
- id: r.string(),
897
- scope: r.literal("global").or(r.literal("local"))
898
- });
899
- }
900
- function te() {
901
- return r.object({
902
- id: r.string(),
903
- reducer: r.string().nullish()
904
- });
905
- }
906
- function re() {
907
- return r.object({
908
- id: r.string(),
909
- schema: r.string().nullish()
910
- });
911
- }
912
- function oe() {
913
- return r.object({
914
- id: r.string(),
915
- template: r.string().nullish()
916
- });
917
- }
918
- function ne() {
919
- return r.object({
920
- scope: r.string(),
921
- schema: r.string()
922
- });
923
- }
924
- function b() {
925
- return r.object({
926
- __typename: r.literal("State").optional(),
927
- examples: r.array(x()),
928
- initialValue: r.string(),
929
- schema: r.string()
930
- });
931
- }
932
- function Se() {
933
- return r.object({
934
- global: b(),
935
- local: b()
936
- });
937
- }
938
- function ie() {
939
- return r.object({
940
- __typename: r.literal("UpdateChangeLogItemInput").optional(),
941
- id: r.string(),
942
- newContent: r.string()
943
- });
944
- }
945
- function se() {
946
- return r.object({
947
- example: r.string(),
948
- id: r.string()
949
- });
950
- }
951
- function ae() {
952
- return r.object({
953
- scope: r.string(),
954
- id: r.string(),
955
- newExample: r.string()
956
- });
957
- }
958
- const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
959
- __proto__: null,
960
- AddChangeLogItemInputSchema: f,
961
- AddModuleInputSchema: _,
962
- AddOperationErrorInputSchema: I,
963
- AddOperationExampleInputSchema: T,
964
- AddOperationInputSchema: R,
965
- AddStateExampleInputSchema: A,
966
- AuthorSchema: ue,
967
- CodeExampleSchema: x,
968
- DeleteChangeLogItemInputSchema: D,
969
- DeleteModuleInputSchema: M,
970
- DeleteOperationErrorInputSchema: N,
971
- DeleteOperationExampleInputSchema: L,
972
- DeleteOperationInputSchema: P,
973
- DeleteStateExampleInputSchema: j,
974
- DocumentModelInputSchema: At,
975
- DocumentModelStateSchema: xt,
976
- DocumentSpecificationSchema: me,
977
- ModuleSchema: Ee,
978
- MoveOperationInputSchema: C,
979
- OperationErrorSchema: Oe,
980
- OperationSchema: he,
981
- ReorderChangeLogItemsInputSchema: k,
982
- ReorderModuleOperationsInputSchema: y,
983
- ReorderModulesInputSchema: w,
984
- ReorderOperationErrorsInputSchema: v,
985
- ReorderOperationExamplesInputSchema: U,
986
- ReorderStateExamplesInputSchema: V,
987
- ScopeStateSchema: Se,
988
- SetAuthorNameInputSchema: F,
989
- SetAuthorWebsiteInputSchema: H,
990
- SetInitialStateInputSchema: X,
991
- SetModelDescriptionInputSchema: G,
992
- SetModelExtensionInputSchema: $,
993
- SetModelIdInputSchema: W,
994
- SetModelNameInputSchema: z,
995
- SetModuleDescriptionInputSchema: B,
996
- SetModuleNameInputSchema: q,
997
- SetOperationDescriptionInputSchema: J,
998
- SetOperationErrorCodeInputSchema: K,
999
- SetOperationErrorDescriptionInputSchema: Q,
1000
- SetOperationErrorNameInputSchema: Y,
1001
- SetOperationErrorTemplateInputSchema: Z,
1002
- SetOperationNameInputSchema: ee,
1003
- SetOperationReducerInputSchema: te,
1004
- SetOperationSchemaInputSchema: re,
1005
- SetOperationScopeInputSchema: ge,
1006
- SetOperationTemplateInputSchema: oe,
1007
- SetStateSchemaInputSchema: ne,
1008
- StateSchema: b,
1009
- UpdateChangeLogItemInputSchema: ie,
1010
- UpdateOperationExampleInputSchema: se,
1011
- UpdateStateExampleInputSchema: ae,
1012
- definedNonNullAnySchema: Rt,
1013
- isDefinedNonNullAny: de
1014
- }, Symbol.toStringTag, { value: "Module" })), d = {
1015
- setModelNameOperation(t, e) {
1016
- t.name = e.input.name;
1017
- },
1018
- setModelIdOperation(t, e) {
1019
- t.id = e.input.id;
1020
- },
1021
- setModelExtensionOperation(t, e) {
1022
- t.extension = e.input.extension;
1023
- },
1024
- setModelDescriptionOperation(t, e) {
1025
- t.description = e.input.description;
1026
- },
1027
- setAuthorNameOperation(t, e) {
1028
- t.author = t.author || { name: "", website: null }, t.author.name = e.input.authorName;
1029
- },
1030
- setAuthorWebsiteOperation(t, e) {
1031
- t.author = t.author || { name: "", website: null }, t.author.website = e.input.authorWebsite;
1032
- }
1033
- }, E = {
1034
- addChangeLogItemOperation(t, e) {
1035
- throw new Error('Reducer "addChangeLogItemOperation" not yet implemented');
1036
- },
1037
- updateChangeLogItemOperation(t, e) {
1038
- throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented');
1039
- },
1040
- deleteChangeLogItemOperation(t, e) {
1041
- throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented');
1042
- },
1043
- reorderChangeLogItemsOperation(t, e) {
1044
- throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented');
1045
- },
1046
- releaseNewVersionOperation(t, e) {
1047
- throw new Error('Reducer "releaseNewVersionOperation" not yet implemented');
1048
- }
1049
- }, Mt = (t) => {
1050
- const e = {};
1051
- return t.forEach((o, n) => e[o] = n), (o, n) => (e[n.id] || 999999) - (e[o.id] || 999999);
1052
- }, h = {
1053
- addModuleOperation(t, e) {
1054
- t.specifications[t.specifications.length - 1].modules.push({
1055
- id: e.input.id,
1056
- name: e.input.name,
1057
- description: e.input.description || "",
1058
- operations: []
1059
- });
1060
- },
1061
- setModuleNameOperation(t, e) {
1062
- const o = t.specifications[t.specifications.length - 1];
1063
- for (let n = 0; n < o.modules.length; n++)
1064
- o.modules[n].id === e.input.id && (o.modules[n].name = e.input.name || "");
1065
- },
1066
- setModuleDescriptionOperation(t, e) {
1067
- const o = t.specifications[t.specifications.length - 1];
1068
- for (let n = 0; n < o.modules.length; n++)
1069
- o.modules[n].id === e.input.id && (o.modules[n].description = e.input.description || "");
1070
- },
1071
- deleteModuleOperation(t, e) {
1072
- const o = t.specifications[t.specifications.length - 1];
1073
- o.modules = o.modules.filter(
1074
- (n) => n.id != e.input.id
1075
- );
1076
- },
1077
- reorderModulesOperation(t, e) {
1078
- t.specifications[t.specifications.length - 1].modules.sort(Mt(e.input.order));
1079
- }
1080
- }, Nt = (t) => {
1081
- const e = {};
1082
- return t.forEach((o, n) => e[o] = n), (o, n) => (e[n.id] || 999999) - (e[o.id] || 999999);
1083
- }, c = {
1084
- addOperationErrorOperation(t, e) {
1085
- const o = t.specifications[t.specifications.length - 1];
1086
- for (let n = 0; n < o.modules.length; n++)
1087
- for (let i = 0; i < o.modules[n].operations.length; i++)
1088
- o.modules[n].operations[i].id == e.input.operationId && o.modules[n].operations[i].errors.push({
1089
- id: e.input.id,
1090
- name: e.input.errorName || "",
1091
- code: e.input.errorCode || "",
1092
- description: e.input.errorDescription || "",
1093
- template: e.input.errorTemplate || ""
1094
- });
1095
- },
1096
- setOperationErrorCodeOperation(t, e) {
1097
- const o = t.specifications[t.specifications.length - 1];
1098
- for (let n = 0; n < o.modules.length; n++)
1099
- for (let i = 0; i < o.modules[n].operations.length; i++)
1100
- for (let a = 0; a < o.modules[n].operations[i].errors.length; a++)
1101
- o.modules[n].operations[i].errors[a].id == e.input.id && (o.modules[n].operations[i].errors[a].code = e.input.errorCode || "");
1102
- },
1103
- setOperationErrorNameOperation(t, e) {
1104
- const o = t.specifications[t.specifications.length - 1];
1105
- for (let n = 0; n < o.modules.length; n++)
1106
- for (let i = 0; i < o.modules[n].operations.length; i++)
1107
- for (let a = 0; a < o.modules[n].operations[i].errors.length; a++)
1108
- o.modules[n].operations[i].errors[a].id == e.input.id && (o.modules[n].operations[i].errors[a].name = e.input.errorName || "");
1109
- },
1110
- setOperationErrorDescriptionOperation(t, e) {
1111
- const o = t.specifications[t.specifications.length - 1];
1112
- for (let n = 0; n < o.modules.length; n++)
1113
- for (let i = 0; i < o.modules[n].operations.length; i++)
1114
- for (let a = 0; a < o.modules[n].operations[i].errors.length; a++)
1115
- o.modules[n].operations[i].errors[a].id == e.input.id && (o.modules[n].operations[i].errors[a].description = e.input.errorDescription || "");
1116
- },
1117
- setOperationErrorTemplateOperation(t, e) {
1118
- const o = t.specifications[t.specifications.length - 1];
1119
- for (let n = 0; n < o.modules.length; n++)
1120
- for (let i = 0; i < o.modules[n].operations.length; i++)
1121
- for (let a = 0; a < o.modules[n].operations[i].errors.length; a++)
1122
- o.modules[n].operations[i].errors[a].id == e.input.id && (o.modules[n].operations[i].errors[a].template = e.input.errorTemplate || "");
1123
- },
1124
- deleteOperationErrorOperation(t, e) {
1125
- const o = t.specifications[t.specifications.length - 1];
1126
- for (let n = 0; n < o.modules.length; n++)
1127
- for (let i = 0; i < o.modules[n].operations.length; i++)
1128
- o.modules[n].operations[i].errors = o.modules[n].operations[i].errors.filter((a) => a.id != e.input.id);
1129
- },
1130
- reorderOperationErrorsOperation(t, e) {
1131
- const o = t.specifications[t.specifications.length - 1];
1132
- for (let n = 0; n < o.modules.length; n++)
1133
- for (let i = 0; i < o.modules[n].operations.length; i++)
1134
- o.modules[n].operations[i].id == e.input.operationId && o.modules[n].operations[i].errors.sort(
1135
- Nt(e.input.order)
1136
- );
1137
- }
1138
- }, Lt = (t) => {
1139
- const e = {};
1140
- return t.forEach((o, n) => e[o] = n), (o, n) => (e[n.id] || 999999) - (e[o.id] || 999999);
1141
- }, S = {
1142
- addOperationExampleOperation(t, e) {
1143
- const o = t.specifications[t.specifications.length - 1];
1144
- for (let n = 0; n < o.modules.length; n++)
1145
- for (let i = 0; i < o.modules[n].operations.length; i++)
1146
- o.modules[n].operations[i].id == e.input.operationId && o.modules[n].operations[i].examples.push({
1147
- id: e.input.id,
1148
- value: e.input.example
1149
- });
1150
- },
1151
- updateOperationExampleOperation(t, e) {
1152
- const o = t.specifications[t.specifications.length - 1];
1153
- for (let n = 0; n < o.modules.length; n++)
1154
- for (let i = 0; i < o.modules[n].operations.length; i++)
1155
- for (let a = 0; a < o.modules[n].operations[i].examples.length; a++)
1156
- o.modules[n].operations[i].examples[a].id == e.input.id && (o.modules[n].operations[i].examples[a].value = e.input.example);
1157
- },
1158
- deleteOperationExampleOperation(t, e) {
1159
- const o = t.specifications[t.specifications.length - 1];
1160
- for (let n = 0; n < o.modules.length; n++)
1161
- for (let i = 0; i < o.modules[n].operations.length; i++)
1162
- o.modules[n].operations[i].examples = o.modules[n].operations[i].examples.filter(
1163
- (a) => a.id != e.input.id
1164
- );
1165
- },
1166
- reorderOperationExamplesOperation(t, e) {
1167
- const o = t.specifications[t.specifications.length - 1];
1168
- for (let n = 0; n < o.modules.length; n++)
1169
- for (let i = 0; i < o.modules[n].operations.length; i++)
1170
- o.modules[n].operations[i].id == e.input.operationId && o.modules[n].operations[i].examples.sort(
1171
- Lt(e.input.order)
1172
- );
1173
- }
1174
- }, Pt = (t) => {
1175
- const e = {};
1176
- return t.forEach((o, n) => e[o] = n), (o, n) => (e[n.id] || 999999) - (e[o.id] || 999999);
1177
- }, p = {
1178
- addOperationOperation(t, e) {
1179
- const o = t.specifications[t.specifications.length - 1];
1180
- for (let n = 0; n < o.modules.length; n++)
1181
- o.modules[n].id == e.input.moduleId && o.modules[n].operations.push({
1182
- id: e.input.id,
1183
- name: e.input.name,
1184
- description: e.input.description || "",
1185
- schema: e.input.schema || "",
1186
- template: e.input.template || e.input.description || "",
1187
- reducer: e.input.reducer || "",
1188
- errors: [],
1189
- examples: [],
1190
- scope: e.input.scope || "global"
1191
- });
1192
- },
1193
- setOperationNameOperation(t, e) {
1194
- const o = t.specifications[t.specifications.length - 1];
1195
- for (let n = 0; n < o.modules.length; n++)
1196
- for (let i = 0; i < o.modules[n].operations.length; i++)
1197
- o.modules[n].operations[i].id == e.input.id && (o.modules[n].operations[i].name = e.input.name || "");
1198
- },
1199
- setOperationScopeOperation(t, e) {
1200
- const o = t.specifications[t.specifications.length - 1];
1201
- for (let n = 0; n < o.modules.length; n++)
1202
- for (let i = 0; i < o.modules[n].operations.length; i++)
1203
- o.modules[n].operations[i].id == e.input.id && (o.modules[n].operations[i].scope = e.input.scope || "global");
1204
- },
1205
- setOperationSchemaOperation(t, e) {
1206
- const o = t.specifications[t.specifications.length - 1];
1207
- for (let n = 0; n < o.modules.length; n++)
1208
- for (let i = 0; i < o.modules[n].operations.length; i++)
1209
- o.modules[n].operations[i].id == e.input.id && (o.modules[n].operations[i].schema = e.input.schema || "");
1210
- },
1211
- setOperationDescriptionOperation(t, e) {
1212
- const o = t.specifications[t.specifications.length - 1];
1213
- for (let n = 0; n < o.modules.length; n++)
1214
- for (let i = 0; i < o.modules[n].operations.length; i++)
1215
- o.modules[n].operations[i].id == e.input.id && (o.modules[n].operations[i].description = e.input.description || "");
1216
- },
1217
- setOperationTemplateOperation(t, e) {
1218
- const o = t.specifications[t.specifications.length - 1];
1219
- for (let n = 0; n < o.modules.length; n++)
1220
- for (let i = 0; i < o.modules[n].operations.length; i++)
1221
- o.modules[n].operations[i].id == e.input.id && (o.modules[n].operations[i].template = e.input.template || "");
1222
- },
1223
- setOperationReducerOperation(t, e) {
1224
- const o = t.specifications[t.specifications.length - 1];
1225
- for (let n = 0; n < o.modules.length; n++)
1226
- for (let i = 0; i < o.modules[n].operations.length; i++)
1227
- o.modules[n].operations[i].id == e.input.id && (o.modules[n].operations[i].reducer = e.input.reducer || "");
1228
- },
1229
- moveOperationOperation(t, e) {
1230
- const o = [], n = t.specifications[t.specifications.length - 1];
1231
- for (let i = 0; i < n.modules.length; i++)
1232
- n.modules[i].operations = n.modules[i].operations.filter((a) => a.id == e.input.operationId ? (o.push(a), !1) : !0);
1233
- for (let i = 0; i < n.modules.length; i++)
1234
- n.modules[i].id == e.input.newModuleId && n.modules[i].operations.push(...o);
1235
- },
1236
- deleteOperationOperation(t, e) {
1237
- const o = t.specifications[t.specifications.length - 1];
1238
- for (let n = 0; n < o.modules.length; n++)
1239
- o.modules[n].operations = o.modules[n].operations.filter((i) => i.id != e.input.id);
1240
- },
1241
- reorderModuleOperationsOperation(t, e) {
1242
- const o = t.specifications[t.specifications.length - 1];
1243
- for (let n = 0; n < o.modules.length; n++)
1244
- o.modules[n].id == e.input.moduleId && o.modules[n].operations.sort(
1245
- Pt(e.input.order)
1246
- );
1247
- }
1248
- }, jt = (t) => {
1249
- const e = {};
1250
- return t.forEach((o, n) => e[o] = n), (o, n) => (e[n.id] || 999999) - (e[o.id] || 999999);
1251
- }, u = {
1252
- setStateSchemaOperation(t, e) {
1253
- const o = t.specifications[t.specifications.length - 1];
1254
- if (Object.keys(o.state).includes(e.input.scope))
1255
- o.state[e.input.scope].schema = e.input.schema;
1256
- else
1257
- throw new Error(`Invalid scope: ${e.input.scope}`);
1258
- },
1259
- setInitialStateOperation(t, e) {
1260
- const o = t.specifications[t.specifications.length - 1];
1261
- if (Object.keys(o.state).includes(e.input.scope))
1262
- o.state[e.input.scope].initialValue = e.input.initialValue;
1263
- else
1264
- throw new Error(`Invalid scope: ${e.input.scope}`);
1265
- },
1266
- addStateExampleOperation(t, e) {
1267
- const o = t.specifications[t.specifications.length - 1];
1268
- if (Object.keys(o.state).includes(e.input.scope))
1269
- o.state[e.input.scope].examples.push({
1270
- id: e.input.id,
1271
- value: e.input.example
1272
- });
1273
- else
1274
- throw new Error(`Invalid scope: ${e.input.scope}`);
1275
- },
1276
- updateStateExampleOperation(t, e) {
1277
- const o = t.specifications[t.specifications.length - 1];
1278
- if (!Object.keys(o.state).includes(e.input.scope))
1279
- throw new Error(`Invalid scope: ${e.input.scope}`);
1280
- const n = o.state[e.input.scope].examples;
1281
- for (let i = 0; i < n.length; i++)
1282
- n[i].id == e.input.id && (n[i].value = e.input.newExample);
1283
- },
1284
- deleteStateExampleOperation(t, e) {
1285
- const o = t.specifications[t.specifications.length - 1];
1286
- if (Object.keys(o.state).includes(e.input.scope))
1287
- o.state[e.input.scope].examples = o.state[e.input.scope].examples.filter((n) => n.id != e.input.id);
1288
- else
1289
- throw new Error(`Invalid scope: ${e.input.scope}`);
1290
- },
1291
- reorderStateExamplesOperation(t, e) {
1292
- const o = t.specifications[t.specifications.length - 1];
1293
- if (Object.keys(o.state).includes(e.input.scope))
1294
- o.state[e.input.scope].examples.sort(jt(e.input.order));
1295
- else
1296
- throw new Error(`Invalid scope: ${e.input.scope}`);
1297
- }
1298
- }, Ct = (t, e) => {
1299
- if (Et(e))
1300
- return t;
1301
- switch (e.type) {
1302
- case "SET_MODEL_NAME":
1303
- z().parse(e.input), d.setModelNameOperation(t.global, e);
1304
- break;
1305
- case "SET_MODEL_ID":
1306
- W().parse(e.input), d.setModelIdOperation(t.global, e);
1307
- break;
1308
- case "SET_MODEL_EXTENSION":
1309
- $().parse(e.input), d.setModelExtensionOperation(t.global, e);
1310
- break;
1311
- case "SET_MODEL_DESCRIPTION":
1312
- G().parse(e.input), d.setModelDescriptionOperation(t.global, e);
1313
- break;
1314
- case "SET_AUTHOR_NAME":
1315
- F().parse(e.input), d.setAuthorNameOperation(t.global, e);
1316
- break;
1317
- case "SET_AUTHOR_WEBSITE":
1318
- H().parse(e.input), d.setAuthorWebsiteOperation(t.global, e);
1319
- break;
1320
- case "ADD_CHANGE_LOG_ITEM":
1321
- f().parse(e.input), E.addChangeLogItemOperation(t.global, e);
1322
- break;
1323
- case "UPDATE_CHANGE_LOG_ITEM":
1324
- ie().parse(e.input), E.updateChangeLogItemOperation(
1325
- t.global,
1326
- e
1327
- );
1328
- break;
1329
- case "DELETE_CHANGE_LOG_ITEM":
1330
- D().parse(e.input), E.deleteChangeLogItemOperation(
1331
- t.global,
1332
- e
1333
- );
1334
- break;
1335
- case "REORDER_CHANGE_LOG_ITEMS":
1336
- k().parse(e.input), E.reorderChangeLogItemsOperation(
1337
- t.global,
1338
- e
1339
- );
1340
- break;
1341
- case "RELEASE_NEW_VERSION":
1342
- if (Object.keys(e.input).length > 0)
1343
- throw new Error(
1344
- "Expected empty input for action RELEASE_NEW_VERSION"
1345
- );
1346
- E.releaseNewVersionOperation(t.global, e);
1347
- break;
1348
- case "ADD_MODULE":
1349
- _().parse(e.input), h.addModuleOperation(t.global, e);
1350
- break;
1351
- case "SET_MODULE_NAME":
1352
- q().parse(e.input), h.setModuleNameOperation(t.global, e);
1353
- break;
1354
- case "SET_MODULE_DESCRIPTION":
1355
- B().parse(e.input), h.setModuleDescriptionOperation(t.global, e);
1356
- break;
1357
- case "DELETE_MODULE":
1358
- M().parse(e.input), h.deleteModuleOperation(t.global, e);
1359
- break;
1360
- case "REORDER_MODULES":
1361
- w().parse(e.input), h.reorderModulesOperation(t.global, e);
1362
- break;
1363
- case "ADD_OPERATION_ERROR":
1364
- I().parse(e.input), c.addOperationErrorOperation(
1365
- t.global,
1366
- e
1367
- );
1368
- break;
1369
- case "SET_OPERATION_ERROR_CODE":
1370
- K().parse(e.input), c.setOperationErrorCodeOperation(
1371
- t.global,
1372
- e
1373
- );
1374
- break;
1375
- case "SET_OPERATION_ERROR_NAME":
1376
- Y().parse(e.input), c.setOperationErrorNameOperation(
1377
- t.global,
1378
- e
1379
- );
1380
- break;
1381
- case "SET_OPERATION_ERROR_DESCRIPTION":
1382
- Q().parse(e.input), c.setOperationErrorDescriptionOperation(
1383
- t.global,
1384
- e
1385
- );
1386
- break;
1387
- case "SET_OPERATION_ERROR_TEMPLATE":
1388
- Z().parse(e.input), c.setOperationErrorTemplateOperation(
1389
- t.global,
1390
- e
1391
- );
1392
- break;
1393
- case "DELETE_OPERATION_ERROR":
1394
- N().parse(e.input), c.deleteOperationErrorOperation(
1395
- t.global,
1396
- e
1397
- );
1398
- break;
1399
- case "REORDER_OPERATION_ERRORS":
1400
- v().parse(e.input), c.reorderOperationErrorsOperation(
1401
- t.global,
1402
- e
1403
- );
1404
- break;
1405
- case "ADD_OPERATION_EXAMPLE":
1406
- T().parse(e.input), S.addOperationExampleOperation(
1407
- t.global,
1408
- e
1409
- );
1410
- break;
1411
- case "UPDATE_OPERATION_EXAMPLE":
1412
- se().parse(e.input), S.updateOperationExampleOperation(
1413
- t.global,
1414
- e
1415
- );
1416
- break;
1417
- case "DELETE_OPERATION_EXAMPLE":
1418
- L().parse(e.input), S.deleteOperationExampleOperation(
1419
- t.global,
1420
- e
1421
- );
1422
- break;
1423
- case "REORDER_OPERATION_EXAMPLES":
1424
- U().parse(e.input), S.reorderOperationExamplesOperation(
1425
- t.global,
1426
- e
1427
- );
1428
- break;
1429
- case "ADD_OPERATION":
1430
- R().parse(e.input), p.addOperationOperation(t.global, e);
1431
- break;
1432
- case "SET_OPERATION_NAME":
1433
- ee().parse(e.input), p.setOperationNameOperation(t.global, e);
1434
- break;
1435
- case "SET_OPERATION_SCOPE":
1436
- ge().parse(e.input), p.setOperationScopeOperation(t.global, e);
1437
- break;
1438
- case "SET_OPERATION_SCHEMA":
1439
- re().parse(e.input), p.setOperationSchemaOperation(t.global, e);
1440
- break;
1441
- case "SET_OPERATION_DESCRIPTION":
1442
- J().parse(e.input), p.setOperationDescriptionOperation(
1443
- t.global,
1444
- e
1445
- );
1446
- break;
1447
- case "SET_OPERATION_TEMPLATE":
1448
- oe().parse(e.input), p.setOperationTemplateOperation(
1449
- t.global,
1450
- e
1451
- );
1452
- break;
1453
- case "SET_OPERATION_REDUCER":
1454
- te().parse(e.input), p.setOperationReducerOperation(t.global, e);
1455
- break;
1456
- case "MOVE_OPERATION":
1457
- C().parse(e.input), p.moveOperationOperation(t.global, e);
1458
- break;
1459
- case "DELETE_OPERATION":
1460
- P().parse(e.input), p.deleteOperationOperation(t.global, e);
1461
- break;
1462
- case "REORDER_MODULE_OPERATIONS":
1463
- y().parse(e.input), p.reorderModuleOperationsOperation(
1464
- t.global,
1465
- e
1466
- );
1467
- break;
1468
- case "SET_STATE_SCHEMA":
1469
- ne().parse(e.input), u.setStateSchemaOperation(t.global, e);
1470
- break;
1471
- case "SET_INITIAL_STATE":
1472
- X().parse(e.input), u.setInitialStateOperation(t.global, e);
1473
- break;
1474
- case "ADD_STATE_EXAMPLE":
1475
- A().parse(e.input), u.addStateExampleOperation(t.global, e);
1476
- break;
1477
- case "UPDATE_STATE_EXAMPLE":
1478
- ae().parse(e.input), u.updateStateExampleOperation(t.global, e);
1479
- break;
1480
- case "DELETE_STATE_EXAMPLE":
1481
- j().parse(e.input), u.deleteStateExampleOperation(t.global, e);
1482
- break;
1483
- case "REORDER_STATE_EXAMPLES":
1484
- V().parse(e.input), u.reorderStateExamplesOperation(t.global, e);
1485
- break;
1486
- default:
1487
- return t;
1488
- }
1489
- }, g = mt(Ct), kt = {
1490
- id: "",
1491
- name: "",
1492
- extension: "",
1493
- description: "",
1494
- author: {
1495
- name: "",
1496
- website: ""
1497
- },
1498
- specifications: [
1499
- {
1500
- version: 1,
1501
- changeLog: [],
1502
- state: {
1503
- global: {
1504
- schema: "",
1505
- initialValue: "",
1506
- examples: []
1507
- },
1508
- local: {
1509
- schema: "",
1510
- initialValue: "",
1511
- examples: []
1512
- }
1513
- },
1514
- modules: []
1515
- }
1516
- ]
1517
- }, yt = {}, O = {
1518
- fileExtension: "phdm",
1519
- createState(t) {
1520
- return {
1521
- global: { ...kt, ...t == null ? void 0 : t.global },
1522
- local: { ...yt, ...t == null ? void 0 : t.local }
1523
- };
1524
- },
1525
- createExtendedState(t) {
1526
- return ht(
1527
- { ...t, documentType: "powerhouse/document-model" },
1528
- O.createState
1529
- );
1530
- },
1531
- createDocument(t) {
1532
- return Ot(
1533
- O.createExtendedState(t),
1534
- O.createState
1535
- );
1536
- },
1537
- saveToFile(t, e, o) {
1538
- return gt(t, e, "phdm", o);
1539
- },
1540
- saveToFileHandle(t, e) {
1541
- return St(t, e);
1542
- },
1543
- loadFromFile(t) {
1544
- return bt(t, g);
1545
- },
1546
- loadFromInput(t) {
1547
- return ft(t, g);
1548
- }
1549
- }, be = (t) => s(
1550
- "SET_MODEL_NAME",
1551
- { ...t }
1552
- ), fe = (t) => s(
1553
- "SET_MODEL_ID",
1554
- { ...t }
1555
- ), _e = (t) => s(
1556
- "SET_MODEL_EXTENSION",
1557
- { ...t }
1558
- ), Ie = (t) => s(
1559
- "SET_MODEL_DESCRIPTION",
1560
- { ...t }
1561
- ), Te = (t) => s(
1562
- "SET_AUTHOR_NAME",
1563
- { ...t }
1564
- ), Re = (t) => s(
1565
- "SET_AUTHOR_WEBSITE",
1566
- { ...t }
1567
- );
1568
- class wt extends l {
1569
- setModelName(e) {
1570
- return this.dispatch(be(e));
1571
- }
1572
- setModelId(e) {
1573
- return this.dispatch(fe(e));
1574
- }
1575
- setModelExtension(e) {
1576
- return this.dispatch(_e(e));
1577
- }
1578
- setModelDescription(e) {
1579
- return this.dispatch(Ie(e));
1580
- }
1581
- setAuthorName(e) {
1582
- return this.dispatch(Te(e));
1583
- }
1584
- setAuthorWebsite(e) {
1585
- return this.dispatch(Re(e));
1586
- }
1587
- }
1588
- const Ae = (t) => s(
1589
- "ADD_CHANGE_LOG_ITEM",
1590
- { ...t }
1591
- ), xe = (t) => s(
1592
- "UPDATE_CHANGE_LOG_ITEM",
1593
- { ...t }
1594
- ), De = (t) => s(
1595
- "DELETE_CHANGE_LOG_ITEM",
1596
- { ...t }
1597
- ), Me = (t) => s(
1598
- "REORDER_CHANGE_LOG_ITEMS",
1599
- { ...t }
1600
- ), Ne = () => s("RELEASE_NEW_VERSION");
1601
- class vt extends l {
1602
- addChangeLogItem(e) {
1603
- return this.dispatch(Ae(e));
1604
- }
1605
- updateChangeLogItem(e) {
1606
- return this.dispatch(xe(e));
1607
- }
1608
- deleteChangeLogItem(e) {
1609
- return this.dispatch(De(e));
1610
- }
1611
- reorderChangeLogItems(e) {
1612
- return this.dispatch(Me(e));
1613
- }
1614
- releaseNewVersion() {
1615
- return this.dispatch(Ne());
1616
- }
1617
- }
1618
- const Le = (t) => s(
1619
- "ADD_MODULE",
1620
- { ...t }
1621
- ), Pe = (t) => s(
1622
- "SET_MODULE_NAME",
1623
- { ...t }
1624
- ), je = (t) => s(
1625
- "SET_MODULE_DESCRIPTION",
1626
- { ...t }
1627
- ), Ce = (t) => s(
1628
- "DELETE_MODULE",
1629
- { ...t }
1630
- ), ke = (t) => s(
1631
- "REORDER_MODULES",
1632
- { ...t }
1633
- );
1634
- class Ut extends l {
1635
- addModule(e) {
1636
- return this.dispatch(Le(e));
1637
- }
1638
- setModuleName(e) {
1639
- return this.dispatch(Pe(e));
1640
- }
1641
- setModuleDescription(e) {
1642
- return this.dispatch(je(e));
1643
- }
1644
- deleteModule(e) {
1645
- return this.dispatch(Ce(e));
1646
- }
1647
- reorderModules(e) {
1648
- return this.dispatch(ke(e));
1649
- }
1650
- }
1651
- const ye = (t) => s(
1652
- "ADD_OPERATION_ERROR",
1653
- { ...t }
1654
- ), we = (t) => s(
1655
- "SET_OPERATION_ERROR_CODE",
1656
- { ...t }
1657
- ), ve = (t) => s(
1658
- "SET_OPERATION_ERROR_NAME",
1659
- { ...t }
1660
- ), Ue = (t) => s(
1661
- "SET_OPERATION_ERROR_DESCRIPTION",
1662
- { ...t }
1663
- ), Ve = (t) => s(
1664
- "SET_OPERATION_ERROR_TEMPLATE",
1665
- { ...t }
1666
- ), Fe = (t) => s(
1667
- "DELETE_OPERATION_ERROR",
1668
- { ...t }
1669
- ), He = (t) => s(
1670
- "REORDER_OPERATION_ERRORS",
1671
- { ...t }
1672
- );
1673
- class Vt extends l {
1674
- addOperationError(e) {
1675
- return this.dispatch(ye(e));
1676
- }
1677
- setOperationErrorCode(e) {
1678
- return this.dispatch(we(e));
1679
- }
1680
- setOperationErrorName(e) {
1681
- return this.dispatch(ve(e));
1682
- }
1683
- setOperationErrorDescription(e) {
1684
- return this.dispatch(Ue(e));
1685
- }
1686
- setOperationErrorTemplate(e) {
1687
- return this.dispatch(Ve(e));
1688
- }
1689
- deleteOperationError(e) {
1690
- return this.dispatch(Fe(e));
1691
- }
1692
- reorderOperationErrors(e) {
1693
- return this.dispatch(He(e));
1694
- }
1695
- }
1696
- const Xe = (t) => s(
1697
- "ADD_OPERATION_EXAMPLE",
1698
- { ...t }
1699
- ), Ge = (t) => s(
1700
- "UPDATE_OPERATION_EXAMPLE",
1701
- { ...t }
1702
- ), $e = (t) => s(
1703
- "DELETE_OPERATION_EXAMPLE",
1704
- { ...t }
1705
- ), We = (t) => s(
1706
- "REORDER_OPERATION_EXAMPLES",
1707
- { ...t }
1708
- );
1709
- class Ft extends l {
1710
- addOperationExample(e) {
1711
- return this.dispatch(Xe(e));
1712
- }
1713
- updateOperationExample(e) {
1714
- return this.dispatch(Ge(e));
1715
- }
1716
- deleteOperationExample(e) {
1717
- return this.dispatch($e(e));
1718
- }
1719
- reorderOperationExamples(e) {
1720
- return this.dispatch(We(e));
1721
- }
1722
- }
1723
- const ze = (t) => s(
1724
- "ADD_OPERATION",
1725
- { ...t }
1726
- ), Be = (t) => s(
1727
- "SET_OPERATION_NAME",
1728
- { ...t }
1729
- ), qe = (t) => s(
1730
- "SET_OPERATION_SCOPE",
1731
- { ...t }
1732
- ), Je = (t) => s(
1733
- "SET_OPERATION_SCHEMA",
1734
- { ...t }
1735
- ), Ke = (t) => s(
1736
- "SET_OPERATION_DESCRIPTION",
1737
- { ...t }
1738
- ), Qe = (t) => s(
1739
- "SET_OPERATION_TEMPLATE",
1740
- { ...t }
1741
- ), Ye = (t) => s(
1742
- "SET_OPERATION_REDUCER",
1743
- { ...t }
1744
- ), Ze = (t) => s(
1745
- "MOVE_OPERATION",
1746
- { ...t }
1747
- ), et = (t) => s(
1748
- "DELETE_OPERATION",
1749
- { ...t }
1750
- ), tt = (t) => s(
1751
- "REORDER_MODULE_OPERATIONS",
1752
- { ...t }
1753
- );
1754
- class Ht extends l {
1755
- addOperation(e) {
1756
- return this.dispatch(ze(e));
1757
- }
1758
- setOperationName(e) {
1759
- return this.dispatch(Be(e));
1760
- }
1761
- setOperationScope(e) {
1762
- return this.dispatch(qe(e));
1763
- }
1764
- setOperationSchema(e) {
1765
- return this.dispatch(Je(e));
1766
- }
1767
- setOperationDescription(e) {
1768
- return this.dispatch(Ke(e));
1769
- }
1770
- setOperationTemplate(e) {
1771
- return this.dispatch(Qe(e));
1772
- }
1773
- setOperationReducer(e) {
1774
- return this.dispatch(Ye(e));
1775
- }
1776
- moveOperation(e) {
1777
- return this.dispatch(Ze(e));
1778
- }
1779
- deleteOperation(e) {
1780
- return this.dispatch(et(e));
1781
- }
1782
- reorderModuleOperations(e) {
1783
- return this.dispatch(tt(e));
1784
- }
1785
- }
1786
- const rt = (t) => s(
1787
- "SET_STATE_SCHEMA",
1788
- { ...t }
1789
- ), ot = (t) => s(
1790
- "SET_INITIAL_STATE",
1791
- { ...t }
1792
- ), nt = (t) => s(
1793
- "ADD_STATE_EXAMPLE",
1794
- { ...t }
1795
- ), it = (t) => s(
1796
- "UPDATE_STATE_EXAMPLE",
1797
- { ...t }
1798
- ), st = (t) => s(
1799
- "DELETE_STATE_EXAMPLE",
1800
- { ...t }
1801
- ), at = (t) => s(
1802
- "REORDER_STATE_EXAMPLES",
1803
- { ...t }
1804
- );
1805
- class Xt extends l {
1806
- setStateSchema(e) {
1807
- return this.dispatch(rt(e));
1808
- }
1809
- setInitialState(e) {
1810
- return this.dispatch(ot(e));
1811
- }
1812
- addStateExample(e) {
1813
- return this.dispatch(nt(e));
1814
- }
1815
- updateStateExample(e) {
1816
- return this.dispatch(it(e));
1817
- }
1818
- deleteStateExample(e) {
1819
- return this.dispatch(st(e));
1820
- }
1821
- reorderStateExamples(e) {
1822
- return this.dispatch(at(e));
1823
- }
1824
- }
1825
- var m;
1826
- let pe = (m = class extends l {
1827
- constructor(e, o) {
1828
- super(g, O.createDocument(e), o);
1829
- }
1830
- saveToFile(e, o) {
1831
- return super.saveToFile(e, m.fileExtension, o);
1832
- }
1833
- loadFromFile(e) {
1834
- return super.loadFromFile(e);
1835
- }
1836
- static async fromFile(e) {
1837
- const o = new this();
1838
- return await o.loadFromFile(e), o;
1839
- }
1840
- }, le(m, "fileExtension", "phdm"), m);
1841
- _t(pe, [
1842
- wt,
1843
- vt,
1844
- Ut,
1845
- Vt,
1846
- Ft,
1847
- Ht,
1848
- Xt
1849
- ]);
1850
- const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1851
- __proto__: null,
1852
- addChangeLogItem: Ae,
1853
- addModule: Le,
1854
- addOperation: ze,
1855
- addOperationError: ye,
1856
- addOperationExample: Xe,
1857
- addStateExample: nt,
1858
- deleteChangeLogItem: De,
1859
- deleteModule: Ce,
1860
- deleteOperation: et,
1861
- deleteOperationError: Fe,
1862
- deleteOperationExample: $e,
1863
- deleteStateExample: st,
1864
- moveOperation: Ze,
1865
- releaseNewVersion: Ne,
1866
- reorderChangeLogItems: Me,
1867
- reorderModuleOperations: tt,
1868
- reorderModules: ke,
1869
- reorderOperationErrors: He,
1870
- reorderOperationExamples: We,
1871
- reorderStateExamples: at,
1872
- setAuthorName: Te,
1873
- setAuthorWebsite: Re,
1874
- setInitialState: ot,
1875
- setModelDescription: Ie,
1876
- setModelExtension: _e,
1877
- setModelId: fe,
1878
- setModelName: be,
1879
- setModuleDescription: je,
1880
- setModuleName: Pe,
1881
- setOperationDescription: Ke,
1882
- setOperationErrorCode: we,
1883
- setOperationErrorDescription: Ue,
1884
- setOperationErrorName: ve,
1885
- setOperationErrorTemplate: Ve,
1886
- setOperationName: Be,
1887
- setOperationReducer: Ye,
1888
- setOperationSchema: Je,
1889
- setOperationScope: qe,
1890
- setOperationTemplate: Qe,
1891
- setStateSchema: rt,
1892
- updateChangeLogItem: xe,
1893
- updateOperationExample: Ge,
1894
- updateStateExample: it
1895
- }, Symbol.toStringTag, { value: "Module" })), pt = pe, lt = { ...O, ...Tt }, ct = { ...It, ...Gt }, $t = {
1896
- Document: pt,
1897
- reducer: g,
1898
- actions: ct,
1899
- utils: lt,
1900
- documentModel: ce
1901
- }, Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1902
- __proto__: null,
1903
- Document: pt,
1904
- DocumentModel: pe,
1905
- actions: ct,
1906
- documentModel: ce,
1907
- module: $t,
1908
- reducer: g,
1909
- utils: lt,
1910
- z: Dt
1911
- }, Symbol.toStringTag, { value: "Module" }));
1912
- export {
1913
- Qt as D,
1914
- pe as a,
1915
- pt as b,
1916
- ct as c,
1917
- ce as d,
1918
- $t as m,
1919
- g as r,
1920
- lt as u,
1921
- Dt as z
1922
- };