document-model 1.0.20 → 1.0.21

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