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