document-model 1.1.0-debug.2 → 1.1.0-experimental.2

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 (140) hide show
  1. package/dist/browser/cjs/document-model.js +1 -21
  2. package/dist/browser/cjs/document.js +1 -15
  3. package/dist/browser/cjs/index.js +1 -18
  4. package/dist/browser/cjs/internal/index-DLodkpOq.js +22 -0
  5. package/dist/browser/cjs/internal/index-azT4DEce.js +1 -0
  6. package/dist/browser/cjs/internal/object-CMr-_AP8.js +25 -0
  7. package/dist/browser/es/document-model.js +15 -16
  8. package/dist/browser/es/document.js +9 -10
  9. package/dist/browser/es/index.js +11 -13
  10. package/dist/browser/es/internal/index-BzNpRs2a.js +44 -0
  11. package/dist/browser/es/internal/index-CL_1ivGq.js +2104 -0
  12. package/dist/browser/es/internal/object-FFc9n_3I.js +2789 -0
  13. package/dist/browser/src/document/object.d.ts +35 -0
  14. package/dist/browser/src/document/types.d.ts +6 -0
  15. package/dist/browser/src/document/utils/base.d.ts +5 -4
  16. package/dist/browser/src/document/utils/document-helpers.d.ts +1 -1
  17. package/dist/browser/src/document/utils/index.d.ts +1 -1
  18. package/dist/node/cjs/document-model.js +1 -25
  19. package/dist/node/cjs/document.js +1 -19
  20. package/dist/node/cjs/index.js +1 -22
  21. package/dist/node/cjs/internal/index-CPeTtUsk.js +22 -0
  22. package/dist/node/cjs/internal/index-CTavCc1t.js +1 -0
  23. package/dist/node/cjs/internal/object-DhI24-1e.js +20 -0
  24. package/dist/node/es/document-model.js +14 -15
  25. package/dist/node/es/document.js +9 -10
  26. package/dist/node/es/index.js +11 -13
  27. package/dist/node/es/internal/index-8lUz8qED.js +44 -0
  28. package/dist/node/es/internal/index-A880In4b.js +2108 -0
  29. package/dist/node/es/internal/object-C9n9Ijnt.js +1687 -0
  30. package/dist/node/src/document/object.d.ts +35 -0
  31. package/dist/node/src/document/types.d.ts +6 -0
  32. package/dist/node/src/document/utils/base.d.ts +5 -4
  33. package/dist/node/src/document/utils/document-helpers.d.ts +1 -1
  34. package/dist/node/src/document/utils/index.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/CHANGELOG.md +0 -19
  37. package/dist/browser/cjs/document-model.js.map +0 -1
  38. package/dist/browser/cjs/document.js.map +0 -1
  39. package/dist/browser/cjs/index.js.map +0 -1
  40. package/dist/browser/cjs/internal/index-CaJbS06G.js +0 -2339
  41. package/dist/browser/cjs/internal/index-CaJbS06G.js.map +0 -1
  42. package/dist/browser/cjs/internal/index-kKIg6qNB.js +0 -44
  43. package/dist/browser/cjs/internal/index-kKIg6qNB.js.map +0 -1
  44. package/dist/browser/cjs/internal/object-B6dSDhtS.js +0 -4109
  45. package/dist/browser/cjs/internal/object-B6dSDhtS.js.map +0 -1
  46. package/dist/browser/es/document-model.js.map +0 -1
  47. package/dist/browser/es/document.js.map +0 -1
  48. package/dist/browser/es/index.js.map +0 -1
  49. package/dist/browser/es/internal/index-B1lQN59e.js +0 -2340
  50. package/dist/browser/es/internal/index-B1lQN59e.js.map +0 -1
  51. package/dist/browser/es/internal/index-Bu0CkmrW.js +0 -45
  52. package/dist/browser/es/internal/index-Bu0CkmrW.js.map +0 -1
  53. package/dist/browser/es/internal/object-9mR1JlXD.js +0 -4110
  54. package/dist/browser/es/internal/object-9mR1JlXD.js.map +0 -1
  55. package/dist/node/cjs/document-model.js.map +0 -1
  56. package/dist/node/cjs/document.js.map +0 -1
  57. package/dist/node/cjs/index.js.map +0 -1
  58. package/dist/node/cjs/internal/index-AqiVmL0w.js +0 -44
  59. package/dist/node/cjs/internal/index-AqiVmL0w.js.map +0 -1
  60. package/dist/node/cjs/internal/index-ajqhOWQ1.js +0 -2343
  61. package/dist/node/cjs/internal/index-ajqhOWQ1.js.map +0 -1
  62. package/dist/node/cjs/internal/object-D_9h7jBN.js +0 -2111
  63. package/dist/node/cjs/internal/object-D_9h7jBN.js.map +0 -1
  64. package/dist/node/es/document-model.js.map +0 -1
  65. package/dist/node/es/document.js.map +0 -1
  66. package/dist/node/es/index.js.map +0 -1
  67. package/dist/node/es/internal/index-Bh_09edy.js +0 -2344
  68. package/dist/node/es/internal/index-Bh_09edy.js.map +0 -1
  69. package/dist/node/es/internal/index-s6NFw7Kq.js +0 -45
  70. package/dist/node/es/internal/index-s6NFw7Kq.js.map +0 -1
  71. package/dist/node/es/internal/object-CbITi4iq.js +0 -2112
  72. package/dist/node/es/internal/object-CbITi4iq.js.map +0 -1
  73. package/dist/src/document/actions/creators.d.ts +0 -47
  74. package/dist/src/document/actions/index.d.ts +0 -14
  75. package/dist/src/document/actions/types.d.ts +0 -15
  76. package/dist/src/document/index.d.ts +0 -6
  77. package/dist/src/document/object.d.ts +0 -1175
  78. package/dist/src/document/reducer.d.ts +0 -43
  79. package/dist/src/document/schema/index.d.ts +0 -2
  80. package/dist/src/document/schema/types.d.ts +0 -176
  81. package/dist/src/document/schema/zod.d.ts +0 -113
  82. package/dist/src/document/signal.d.ts +0 -29
  83. package/dist/src/document/types.d.ts +0 -249
  84. package/dist/src/document/utils/base.d.ts +0 -85
  85. package/dist/src/document/utils/document-helpers.d.ts +0 -53
  86. package/dist/src/document/utils/file.d.ts +0 -48
  87. package/dist/src/document/utils/index.d.ts +0 -5
  88. package/dist/src/document/utils/node.d.ts +0 -9
  89. package/dist/src/document/utils/validation.d.ts +0 -2
  90. package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
  91. package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
  92. package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  93. package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  94. package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
  95. package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
  96. package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
  97. package/dist/src/document-model/custom/utils.d.ts +0 -7
  98. package/dist/src/document-model/gen/actions.d.ts +0 -15
  99. package/dist/src/document-model/gen/creators.d.ts +0 -7
  100. package/dist/src/document-model/gen/document-model.d.ts +0 -2
  101. package/dist/src/document-model/gen/header/actions.d.ts +0 -9
  102. package/dist/src/document-model/gen/header/creators.d.ts +0 -8
  103. package/dist/src/document-model/gen/header/object.d.ts +0 -12
  104. package/dist/src/document-model/gen/header/operations.d.ts +0 -10
  105. package/dist/src/document-model/gen/index.d.ts +0 -5
  106. package/dist/src/document-model/gen/module/actions.d.ts +0 -8
  107. package/dist/src/document-model/gen/module/creators.d.ts +0 -7
  108. package/dist/src/document-model/gen/module/object.d.ts +0 -11
  109. package/dist/src/document-model/gen/module/operations.d.ts +0 -9
  110. package/dist/src/document-model/gen/object.d.ts +0 -28
  111. package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
  112. package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
  113. package/dist/src/document-model/gen/operation/object.d.ts +0 -16
  114. package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
  115. package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
  116. package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
  117. package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
  118. package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
  119. package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
  120. package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
  121. package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
  122. package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
  123. package/dist/src/document-model/gen/reducer.d.ts +0 -5
  124. package/dist/src/document-model/gen/schema/index.d.ts +0 -2
  125. package/dist/src/document-model/gen/schema/types.d.ts +0 -453
  126. package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
  127. package/dist/src/document-model/gen/state/actions.d.ts +0 -9
  128. package/dist/src/document-model/gen/state/creators.d.ts +0 -8
  129. package/dist/src/document-model/gen/state/object.d.ts +0 -12
  130. package/dist/src/document-model/gen/state/operations.d.ts +0 -10
  131. package/dist/src/document-model/gen/types.d.ts +0 -8
  132. package/dist/src/document-model/gen/utils.d.ts +0 -6
  133. package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
  134. package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
  135. package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
  136. package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
  137. package/dist/src/document-model/index.d.ts +0 -80
  138. package/dist/src/index.d.ts +0 -25
  139. package/dist/vite.config.d.ts +0 -2
  140. package/dist/vitest.config.d.ts +0 -2
@@ -1,1175 +0,0 @@
1
- import type { BaseAction } from './actions/types';
2
- import type { SignalDispatch } from './signal';
3
- import type { Action, AttachmentRef, Document, ExtendedState, OperationScope, Reducer, ReducerOptions } from './types';
4
- /**
5
- * This is an abstract class representing a document and provides methods
6
- * for creating and manipulating documents.
7
- * @typeparam T - The type of data stored in the document.
8
- * @typeparam A - The type of action the document can take.
9
- */
10
- export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
11
- protected _document: Document<T, A, L>;
12
- private _reducer;
13
- private _signalDispatch?;
14
- /**
15
- * Constructs a BaseDocument instance with an initial state.
16
- * @param reducer - The reducer function that updates the state.
17
- * @param document - The initial state of the document.
18
- */
19
- constructor(reducer: Reducer<T, A, L>, document: Document<T, A, L>, signalDispatch?: SignalDispatch);
20
- /**
21
- * Dispatches an action to update the state of the document.
22
- * @param action - The action to dispatch.
23
- * @returns The Document instance.
24
- */
25
- protected dispatch(action: A | BaseAction, options?: ReducerOptions): this;
26
- /**
27
- * Saves the state of the document to a file.
28
- * @param path - The file path where the state should be saved.
29
- * @param extension - The file extension to use when saving the state.
30
- * @returns The file path where the state was saved.
31
- */
32
- protected saveToFile(path: string, extension: string, name?: string): Promise<string>;
33
- /**
34
- * Loads the state of the document from a file.
35
- * @param path - The file path where the state is stored.
36
- */
37
- loadFromFile(path: string): Promise<void>;
38
- /**
39
- * Loads the state of the document from a file and returns it.
40
- * @param path - The file path where the state is stored.
41
- * @param reducer - The reducer function that updates the state.
42
- * @returns The state of the document.
43
- */
44
- protected static stateFromFile<T, A extends Action, L>(path: string, reducer: Reducer<T, A, L>): Promise<Document<T, A, L>>;
45
- /**
46
- * Gets the current state of the document.
47
- */
48
- get state(): {
49
- readonly global: import("immer").Immutable<T>;
50
- readonly local: import("immer").Immutable<L>;
51
- };
52
- /**
53
- * Gets the list of operations performed on the document.
54
- */
55
- get operations(): {
56
- readonly global: readonly ({
57
- readonly type: "LOAD_STATE";
58
- readonly input: {
59
- readonly operations: number;
60
- readonly state: {
61
- readonly data?: unknown;
62
- readonly name: string;
63
- };
64
- };
65
- readonly scope: OperationScope;
66
- readonly attachments?: readonly {
67
- readonly data: string;
68
- readonly mimeType: string;
69
- readonly extension?: string | null | undefined;
70
- readonly fileName?: string | null | undefined;
71
- readonly hash: string;
72
- }[] | undefined;
73
- readonly context?: {
74
- readonly signer?: {
75
- readonly user: {
76
- readonly address: string;
77
- readonly networkId: string;
78
- readonly chainId: number;
79
- };
80
- readonly app: {
81
- readonly name: string;
82
- readonly key: string;
83
- };
84
- readonly signature: string;
85
- } | undefined;
86
- } | undefined;
87
- readonly index: number;
88
- readonly timestamp: string;
89
- readonly hash: string;
90
- readonly skip: number;
91
- readonly error?: string | undefined;
92
- } | {
93
- readonly type: "PRUNE";
94
- readonly input: {
95
- readonly end?: import("./types").InputMaybe<number>;
96
- readonly start?: import("./types").InputMaybe<number>;
97
- };
98
- readonly scope: OperationScope;
99
- readonly attachments?: readonly {
100
- readonly data: string;
101
- readonly mimeType: string;
102
- readonly extension?: string | null | undefined;
103
- readonly fileName?: string | null | undefined;
104
- readonly hash: string;
105
- }[] | undefined;
106
- readonly context?: {
107
- readonly signer?: {
108
- readonly user: {
109
- readonly address: string;
110
- readonly networkId: string;
111
- readonly chainId: number;
112
- };
113
- readonly app: {
114
- readonly name: string;
115
- readonly key: string;
116
- };
117
- readonly signature: string;
118
- } | undefined;
119
- } | undefined;
120
- readonly index: number;
121
- readonly timestamp: string;
122
- readonly hash: string;
123
- readonly skip: number;
124
- readonly error?: string | undefined;
125
- } | {
126
- readonly type: "REDO";
127
- readonly input: number;
128
- readonly scope: OperationScope;
129
- readonly attachments?: readonly {
130
- readonly data: string;
131
- readonly mimeType: string;
132
- readonly extension?: string | null | undefined;
133
- readonly fileName?: string | null | undefined;
134
- readonly hash: string;
135
- }[] | undefined;
136
- readonly context?: {
137
- readonly signer?: {
138
- readonly user: {
139
- readonly address: string;
140
- readonly networkId: string;
141
- readonly chainId: number;
142
- };
143
- readonly app: {
144
- readonly name: string;
145
- readonly key: string;
146
- };
147
- readonly signature: string;
148
- } | undefined;
149
- } | undefined;
150
- readonly index: number;
151
- readonly timestamp: string;
152
- readonly hash: string;
153
- readonly skip: number;
154
- readonly error?: string | undefined;
155
- } | {
156
- readonly type: "SET_NAME";
157
- readonly input: string;
158
- readonly scope: OperationScope;
159
- readonly attachments?: readonly {
160
- readonly data: string;
161
- readonly mimeType: string;
162
- readonly extension?: string | null | undefined;
163
- readonly fileName?: string | null | undefined;
164
- readonly hash: string;
165
- }[] | undefined;
166
- readonly context?: {
167
- readonly signer?: {
168
- readonly user: {
169
- readonly address: string;
170
- readonly networkId: string;
171
- readonly chainId: number;
172
- };
173
- readonly app: {
174
- readonly name: string;
175
- readonly key: string;
176
- };
177
- readonly signature: string;
178
- } | undefined;
179
- } | undefined;
180
- readonly index: number;
181
- readonly timestamp: string;
182
- readonly hash: string;
183
- readonly skip: number;
184
- readonly error?: string | undefined;
185
- } | {
186
- readonly type: "UNDO";
187
- readonly input: number;
188
- readonly scope: OperationScope;
189
- readonly attachments?: readonly {
190
- readonly data: string;
191
- readonly mimeType: string;
192
- readonly extension?: string | null | undefined;
193
- readonly fileName?: string | null | undefined;
194
- readonly hash: string;
195
- }[] | undefined;
196
- readonly context?: {
197
- readonly signer?: {
198
- readonly user: {
199
- readonly address: string;
200
- readonly networkId: string;
201
- readonly chainId: number;
202
- };
203
- readonly app: {
204
- readonly name: string;
205
- readonly key: string;
206
- };
207
- readonly signature: string;
208
- } | undefined;
209
- } | undefined;
210
- readonly index: number;
211
- readonly timestamp: string;
212
- readonly hash: string;
213
- readonly skip: number;
214
- readonly error?: string | undefined;
215
- } | {
216
- readonly type: "NOOP";
217
- readonly input: unknown;
218
- readonly scope: OperationScope;
219
- readonly attachments?: readonly {
220
- readonly data: string;
221
- readonly mimeType: string;
222
- readonly extension?: string | null | undefined;
223
- readonly fileName?: string | null | undefined;
224
- readonly hash: string;
225
- }[] | undefined;
226
- readonly context?: {
227
- readonly signer?: {
228
- readonly user: {
229
- readonly address: string;
230
- readonly networkId: string;
231
- readonly chainId: number;
232
- };
233
- readonly app: {
234
- readonly name: string;
235
- readonly key: string;
236
- };
237
- readonly signature: string;
238
- } | undefined;
239
- } | undefined;
240
- readonly index: number;
241
- readonly timestamp: string;
242
- readonly hash: string;
243
- readonly skip: number;
244
- readonly error?: string | undefined;
245
- } | import("immer").Immutable<A & {
246
- index: number;
247
- timestamp: string;
248
- hash: string;
249
- skip: number;
250
- error?: string | undefined;
251
- }>)[];
252
- readonly local: readonly ({
253
- readonly type: "LOAD_STATE";
254
- readonly input: {
255
- readonly operations: number;
256
- readonly state: {
257
- readonly data?: unknown;
258
- readonly name: string;
259
- };
260
- };
261
- readonly scope: OperationScope;
262
- readonly attachments?: readonly {
263
- readonly data: string;
264
- readonly mimeType: string;
265
- readonly extension?: string | null | undefined;
266
- readonly fileName?: string | null | undefined;
267
- readonly hash: string;
268
- }[] | undefined;
269
- readonly context?: {
270
- readonly signer?: {
271
- readonly user: {
272
- readonly address: string;
273
- readonly networkId: string;
274
- readonly chainId: number;
275
- };
276
- readonly app: {
277
- readonly name: string;
278
- readonly key: string;
279
- };
280
- readonly signature: string;
281
- } | undefined;
282
- } | undefined;
283
- readonly index: number;
284
- readonly timestamp: string;
285
- readonly hash: string;
286
- readonly skip: number;
287
- readonly error?: string | undefined;
288
- } | {
289
- readonly type: "PRUNE";
290
- readonly input: {
291
- readonly end?: import("./types").InputMaybe<number>;
292
- readonly start?: import("./types").InputMaybe<number>;
293
- };
294
- readonly scope: OperationScope;
295
- readonly attachments?: readonly {
296
- readonly data: string;
297
- readonly mimeType: string;
298
- readonly extension?: string | null | undefined;
299
- readonly fileName?: string | null | undefined;
300
- readonly hash: string;
301
- }[] | undefined;
302
- readonly context?: {
303
- readonly signer?: {
304
- readonly user: {
305
- readonly address: string;
306
- readonly networkId: string;
307
- readonly chainId: number;
308
- };
309
- readonly app: {
310
- readonly name: string;
311
- readonly key: string;
312
- };
313
- readonly signature: string;
314
- } | undefined;
315
- } | undefined;
316
- readonly index: number;
317
- readonly timestamp: string;
318
- readonly hash: string;
319
- readonly skip: number;
320
- readonly error?: string | undefined;
321
- } | {
322
- readonly type: "REDO";
323
- readonly input: number;
324
- readonly scope: OperationScope;
325
- readonly attachments?: readonly {
326
- readonly data: string;
327
- readonly mimeType: string;
328
- readonly extension?: string | null | undefined;
329
- readonly fileName?: string | null | undefined;
330
- readonly hash: string;
331
- }[] | undefined;
332
- readonly context?: {
333
- readonly signer?: {
334
- readonly user: {
335
- readonly address: string;
336
- readonly networkId: string;
337
- readonly chainId: number;
338
- };
339
- readonly app: {
340
- readonly name: string;
341
- readonly key: string;
342
- };
343
- readonly signature: string;
344
- } | undefined;
345
- } | undefined;
346
- readonly index: number;
347
- readonly timestamp: string;
348
- readonly hash: string;
349
- readonly skip: number;
350
- readonly error?: string | undefined;
351
- } | {
352
- readonly type: "SET_NAME";
353
- readonly input: string;
354
- readonly scope: OperationScope;
355
- readonly attachments?: readonly {
356
- readonly data: string;
357
- readonly mimeType: string;
358
- readonly extension?: string | null | undefined;
359
- readonly fileName?: string | null | undefined;
360
- readonly hash: string;
361
- }[] | undefined;
362
- readonly context?: {
363
- readonly signer?: {
364
- readonly user: {
365
- readonly address: string;
366
- readonly networkId: string;
367
- readonly chainId: number;
368
- };
369
- readonly app: {
370
- readonly name: string;
371
- readonly key: string;
372
- };
373
- readonly signature: string;
374
- } | undefined;
375
- } | undefined;
376
- readonly index: number;
377
- readonly timestamp: string;
378
- readonly hash: string;
379
- readonly skip: number;
380
- readonly error?: string | undefined;
381
- } | {
382
- readonly type: "UNDO";
383
- readonly input: number;
384
- readonly scope: OperationScope;
385
- readonly attachments?: readonly {
386
- readonly data: string;
387
- readonly mimeType: string;
388
- readonly extension?: string | null | undefined;
389
- readonly fileName?: string | null | undefined;
390
- readonly hash: string;
391
- }[] | undefined;
392
- readonly context?: {
393
- readonly signer?: {
394
- readonly user: {
395
- readonly address: string;
396
- readonly networkId: string;
397
- readonly chainId: number;
398
- };
399
- readonly app: {
400
- readonly name: string;
401
- readonly key: string;
402
- };
403
- readonly signature: string;
404
- } | undefined;
405
- } | undefined;
406
- readonly index: number;
407
- readonly timestamp: string;
408
- readonly hash: string;
409
- readonly skip: number;
410
- readonly error?: string | undefined;
411
- } | {
412
- readonly type: "NOOP";
413
- readonly input: unknown;
414
- readonly scope: OperationScope;
415
- readonly attachments?: readonly {
416
- readonly data: string;
417
- readonly mimeType: string;
418
- readonly extension?: string | null | undefined;
419
- readonly fileName?: string | null | undefined;
420
- readonly hash: string;
421
- }[] | undefined;
422
- readonly context?: {
423
- readonly signer?: {
424
- readonly user: {
425
- readonly address: string;
426
- readonly networkId: string;
427
- readonly chainId: number;
428
- };
429
- readonly app: {
430
- readonly name: string;
431
- readonly key: string;
432
- };
433
- readonly signature: string;
434
- } | undefined;
435
- } | undefined;
436
- readonly index: number;
437
- readonly timestamp: string;
438
- readonly hash: string;
439
- readonly skip: number;
440
- readonly error?: string | undefined;
441
- } | import("immer").Immutable<A & {
442
- index: number;
443
- timestamp: string;
444
- hash: string;
445
- skip: number;
446
- error?: string | undefined;
447
- }>)[];
448
- };
449
- /**
450
- * Gets the name of the document.
451
- */
452
- get name(): string;
453
- /**
454
- * Gets the type of document.
455
- */
456
- get documentType(): string;
457
- /**
458
- * Gets the timestamp of the date the document was created.
459
- */
460
- get created(): string;
461
- /**
462
- * Gets the timestamp of the date the document was last modified.
463
- */
464
- get lastModified(): string;
465
- /**
466
- * Gets the global revision number of the document.
467
- */
468
- get revision(): number;
469
- getRevision(scope: OperationScope): number;
470
- /**
471
- * Gets the initial state of the document.
472
- */
473
- get initialState(): {
474
- readonly name: string;
475
- readonly revision: {
476
- readonly global: number;
477
- readonly local: number;
478
- };
479
- readonly documentType: string;
480
- readonly created: string;
481
- readonly lastModified: string;
482
- readonly state: {
483
- readonly global: import("immer").Immutable<T>;
484
- readonly local: import("immer").Immutable<L>;
485
- };
486
- readonly attachments: {
487
- readonly [x: string]: {
488
- readonly data: string;
489
- readonly mimeType: string;
490
- readonly extension?: string | null | undefined;
491
- readonly fileName?: string | null | undefined;
492
- };
493
- };
494
- };
495
- /**
496
- * Returns the current document as an object
497
- */
498
- toDocument(): {
499
- readonly name: string;
500
- readonly revision: {
501
- readonly global: number;
502
- readonly local: number;
503
- };
504
- readonly documentType: string;
505
- readonly created: string;
506
- readonly lastModified: string;
507
- readonly state: {
508
- readonly global: import("immer").Immutable<T>;
509
- readonly local: import("immer").Immutable<L>;
510
- };
511
- readonly attachments: {
512
- readonly [x: string]: {
513
- readonly data: string;
514
- readonly mimeType: string;
515
- readonly extension?: string | null | undefined;
516
- readonly fileName?: string | null | undefined;
517
- };
518
- };
519
- readonly operations: {
520
- readonly global: readonly ({
521
- readonly type: "LOAD_STATE";
522
- readonly input: {
523
- readonly operations: number;
524
- readonly state: {
525
- readonly data?: unknown;
526
- readonly name: string;
527
- };
528
- };
529
- readonly scope: OperationScope;
530
- readonly attachments?: readonly {
531
- readonly data: string;
532
- readonly mimeType: string;
533
- readonly extension?: string | null | undefined;
534
- readonly fileName?: string | null | undefined;
535
- readonly hash: string;
536
- }[] | undefined;
537
- readonly context?: {
538
- readonly signer?: {
539
- readonly user: {
540
- readonly address: string;
541
- readonly networkId: string;
542
- readonly chainId: number;
543
- };
544
- readonly app: {
545
- readonly name: string;
546
- readonly key: string;
547
- };
548
- readonly signature: string;
549
- } | undefined;
550
- } | undefined;
551
- readonly index: number;
552
- readonly timestamp: string;
553
- readonly hash: string;
554
- readonly skip: number;
555
- readonly error?: string | undefined;
556
- } | {
557
- readonly type: "PRUNE";
558
- readonly input: {
559
- readonly end?: import("./types").InputMaybe<number>;
560
- readonly start?: import("./types").InputMaybe<number>;
561
- };
562
- readonly scope: OperationScope;
563
- readonly attachments?: readonly {
564
- readonly data: string;
565
- readonly mimeType: string;
566
- readonly extension?: string | null | undefined;
567
- readonly fileName?: string | null | undefined;
568
- readonly hash: string;
569
- }[] | undefined;
570
- readonly context?: {
571
- readonly signer?: {
572
- readonly user: {
573
- readonly address: string;
574
- readonly networkId: string;
575
- readonly chainId: number;
576
- };
577
- readonly app: {
578
- readonly name: string;
579
- readonly key: string;
580
- };
581
- readonly signature: string;
582
- } | undefined;
583
- } | undefined;
584
- readonly index: number;
585
- readonly timestamp: string;
586
- readonly hash: string;
587
- readonly skip: number;
588
- readonly error?: string | undefined;
589
- } | {
590
- readonly type: "REDO";
591
- readonly input: number;
592
- readonly scope: OperationScope;
593
- readonly attachments?: readonly {
594
- readonly data: string;
595
- readonly mimeType: string;
596
- readonly extension?: string | null | undefined;
597
- readonly fileName?: string | null | undefined;
598
- readonly hash: string;
599
- }[] | undefined;
600
- readonly context?: {
601
- readonly signer?: {
602
- readonly user: {
603
- readonly address: string;
604
- readonly networkId: string;
605
- readonly chainId: number;
606
- };
607
- readonly app: {
608
- readonly name: string;
609
- readonly key: string;
610
- };
611
- readonly signature: string;
612
- } | undefined;
613
- } | undefined;
614
- readonly index: number;
615
- readonly timestamp: string;
616
- readonly hash: string;
617
- readonly skip: number;
618
- readonly error?: string | undefined;
619
- } | {
620
- readonly type: "SET_NAME";
621
- readonly input: string;
622
- readonly scope: OperationScope;
623
- readonly attachments?: readonly {
624
- readonly data: string;
625
- readonly mimeType: string;
626
- readonly extension?: string | null | undefined;
627
- readonly fileName?: string | null | undefined;
628
- readonly hash: string;
629
- }[] | undefined;
630
- readonly context?: {
631
- readonly signer?: {
632
- readonly user: {
633
- readonly address: string;
634
- readonly networkId: string;
635
- readonly chainId: number;
636
- };
637
- readonly app: {
638
- readonly name: string;
639
- readonly key: string;
640
- };
641
- readonly signature: string;
642
- } | undefined;
643
- } | undefined;
644
- readonly index: number;
645
- readonly timestamp: string;
646
- readonly hash: string;
647
- readonly skip: number;
648
- readonly error?: string | undefined;
649
- } | {
650
- readonly type: "UNDO";
651
- readonly input: number;
652
- readonly scope: OperationScope;
653
- readonly attachments?: readonly {
654
- readonly data: string;
655
- readonly mimeType: string;
656
- readonly extension?: string | null | undefined;
657
- readonly fileName?: string | null | undefined;
658
- readonly hash: string;
659
- }[] | undefined;
660
- readonly context?: {
661
- readonly signer?: {
662
- readonly user: {
663
- readonly address: string;
664
- readonly networkId: string;
665
- readonly chainId: number;
666
- };
667
- readonly app: {
668
- readonly name: string;
669
- readonly key: string;
670
- };
671
- readonly signature: string;
672
- } | undefined;
673
- } | undefined;
674
- readonly index: number;
675
- readonly timestamp: string;
676
- readonly hash: string;
677
- readonly skip: number;
678
- readonly error?: string | undefined;
679
- } | {
680
- readonly type: "NOOP";
681
- readonly input: unknown;
682
- readonly scope: OperationScope;
683
- readonly attachments?: readonly {
684
- readonly data: string;
685
- readonly mimeType: string;
686
- readonly extension?: string | null | undefined;
687
- readonly fileName?: string | null | undefined;
688
- readonly hash: string;
689
- }[] | undefined;
690
- readonly context?: {
691
- readonly signer?: {
692
- readonly user: {
693
- readonly address: string;
694
- readonly networkId: string;
695
- readonly chainId: number;
696
- };
697
- readonly app: {
698
- readonly name: string;
699
- readonly key: string;
700
- };
701
- readonly signature: string;
702
- } | undefined;
703
- } | undefined;
704
- readonly index: number;
705
- readonly timestamp: string;
706
- readonly hash: string;
707
- readonly skip: number;
708
- readonly error?: string | undefined;
709
- } | import("immer").Immutable<A & {
710
- index: number;
711
- timestamp: string;
712
- hash: string;
713
- skip: number;
714
- error?: string | undefined;
715
- }>)[];
716
- readonly local: readonly ({
717
- readonly type: "LOAD_STATE";
718
- readonly input: {
719
- readonly operations: number;
720
- readonly state: {
721
- readonly data?: unknown;
722
- readonly name: string;
723
- };
724
- };
725
- readonly scope: OperationScope;
726
- readonly attachments?: readonly {
727
- readonly data: string;
728
- readonly mimeType: string;
729
- readonly extension?: string | null | undefined;
730
- readonly fileName?: string | null | undefined;
731
- readonly hash: string;
732
- }[] | undefined;
733
- readonly context?: {
734
- readonly signer?: {
735
- readonly user: {
736
- readonly address: string;
737
- readonly networkId: string;
738
- readonly chainId: number;
739
- };
740
- readonly app: {
741
- readonly name: string;
742
- readonly key: string;
743
- };
744
- readonly signature: string;
745
- } | undefined;
746
- } | undefined;
747
- readonly index: number;
748
- readonly timestamp: string;
749
- readonly hash: string;
750
- readonly skip: number;
751
- readonly error?: string | undefined;
752
- } | {
753
- readonly type: "PRUNE";
754
- readonly input: {
755
- readonly end?: import("./types").InputMaybe<number>;
756
- readonly start?: import("./types").InputMaybe<number>;
757
- };
758
- readonly scope: OperationScope;
759
- readonly attachments?: readonly {
760
- readonly data: string;
761
- readonly mimeType: string;
762
- readonly extension?: string | null | undefined;
763
- readonly fileName?: string | null | undefined;
764
- readonly hash: string;
765
- }[] | undefined;
766
- readonly context?: {
767
- readonly signer?: {
768
- readonly user: {
769
- readonly address: string;
770
- readonly networkId: string;
771
- readonly chainId: number;
772
- };
773
- readonly app: {
774
- readonly name: string;
775
- readonly key: string;
776
- };
777
- readonly signature: string;
778
- } | undefined;
779
- } | undefined;
780
- readonly index: number;
781
- readonly timestamp: string;
782
- readonly hash: string;
783
- readonly skip: number;
784
- readonly error?: string | undefined;
785
- } | {
786
- readonly type: "REDO";
787
- readonly input: number;
788
- readonly scope: OperationScope;
789
- readonly attachments?: readonly {
790
- readonly data: string;
791
- readonly mimeType: string;
792
- readonly extension?: string | null | undefined;
793
- readonly fileName?: string | null | undefined;
794
- readonly hash: string;
795
- }[] | undefined;
796
- readonly context?: {
797
- readonly signer?: {
798
- readonly user: {
799
- readonly address: string;
800
- readonly networkId: string;
801
- readonly chainId: number;
802
- };
803
- readonly app: {
804
- readonly name: string;
805
- readonly key: string;
806
- };
807
- readonly signature: string;
808
- } | undefined;
809
- } | undefined;
810
- readonly index: number;
811
- readonly timestamp: string;
812
- readonly hash: string;
813
- readonly skip: number;
814
- readonly error?: string | undefined;
815
- } | {
816
- readonly type: "SET_NAME";
817
- readonly input: string;
818
- readonly scope: OperationScope;
819
- readonly attachments?: readonly {
820
- readonly data: string;
821
- readonly mimeType: string;
822
- readonly extension?: string | null | undefined;
823
- readonly fileName?: string | null | undefined;
824
- readonly hash: string;
825
- }[] | undefined;
826
- readonly context?: {
827
- readonly signer?: {
828
- readonly user: {
829
- readonly address: string;
830
- readonly networkId: string;
831
- readonly chainId: number;
832
- };
833
- readonly app: {
834
- readonly name: string;
835
- readonly key: string;
836
- };
837
- readonly signature: string;
838
- } | undefined;
839
- } | undefined;
840
- readonly index: number;
841
- readonly timestamp: string;
842
- readonly hash: string;
843
- readonly skip: number;
844
- readonly error?: string | undefined;
845
- } | {
846
- readonly type: "UNDO";
847
- readonly input: number;
848
- readonly scope: OperationScope;
849
- readonly attachments?: readonly {
850
- readonly data: string;
851
- readonly mimeType: string;
852
- readonly extension?: string | null | undefined;
853
- readonly fileName?: string | null | undefined;
854
- readonly hash: string;
855
- }[] | undefined;
856
- readonly context?: {
857
- readonly signer?: {
858
- readonly user: {
859
- readonly address: string;
860
- readonly networkId: string;
861
- readonly chainId: number;
862
- };
863
- readonly app: {
864
- readonly name: string;
865
- readonly key: string;
866
- };
867
- readonly signature: string;
868
- } | undefined;
869
- } | undefined;
870
- readonly index: number;
871
- readonly timestamp: string;
872
- readonly hash: string;
873
- readonly skip: number;
874
- readonly error?: string | undefined;
875
- } | {
876
- readonly type: "NOOP";
877
- readonly input: unknown;
878
- readonly scope: OperationScope;
879
- readonly attachments?: readonly {
880
- readonly data: string;
881
- readonly mimeType: string;
882
- readonly extension?: string | null | undefined;
883
- readonly fileName?: string | null | undefined;
884
- readonly hash: string;
885
- }[] | undefined;
886
- readonly context?: {
887
- readonly signer?: {
888
- readonly user: {
889
- readonly address: string;
890
- readonly networkId: string;
891
- readonly chainId: number;
892
- };
893
- readonly app: {
894
- readonly name: string;
895
- readonly key: string;
896
- };
897
- readonly signature: string;
898
- } | undefined;
899
- } | undefined;
900
- readonly index: number;
901
- readonly timestamp: string;
902
- readonly hash: string;
903
- readonly skip: number;
904
- readonly error?: string | undefined;
905
- } | import("immer").Immutable<A & {
906
- index: number;
907
- timestamp: string;
908
- hash: string;
909
- skip: number;
910
- error?: string | undefined;
911
- }>)[];
912
- };
913
- readonly initialState: {
914
- readonly name: string;
915
- readonly revision: {
916
- readonly global: number;
917
- readonly local: number;
918
- };
919
- readonly documentType: string;
920
- readonly created: string;
921
- readonly lastModified: string;
922
- readonly state: {
923
- readonly global: import("immer").Immutable<T>;
924
- readonly local: import("immer").Immutable<L>;
925
- };
926
- readonly attachments: {
927
- readonly [x: string]: {
928
- readonly data: string;
929
- readonly mimeType: string;
930
- readonly extension?: string | null | undefined;
931
- readonly fileName?: string | null | undefined;
932
- };
933
- };
934
- };
935
- readonly clipboard: readonly ({
936
- readonly type: "LOAD_STATE";
937
- readonly input: {
938
- readonly operations: number;
939
- readonly state: {
940
- readonly data?: unknown;
941
- readonly name: string;
942
- };
943
- };
944
- readonly scope: OperationScope;
945
- readonly attachments?: readonly {
946
- readonly data: string;
947
- readonly mimeType: string;
948
- readonly extension?: string | null | undefined;
949
- readonly fileName?: string | null | undefined;
950
- readonly hash: string;
951
- }[] | undefined;
952
- readonly context?: {
953
- readonly signer?: {
954
- readonly user: {
955
- readonly address: string;
956
- readonly networkId: string;
957
- readonly chainId: number;
958
- };
959
- readonly app: {
960
- readonly name: string;
961
- readonly key: string;
962
- };
963
- readonly signature: string;
964
- } | undefined;
965
- } | undefined;
966
- readonly index: number;
967
- readonly timestamp: string;
968
- readonly hash: string;
969
- readonly skip: number;
970
- readonly error?: string | undefined;
971
- } | {
972
- readonly type: "PRUNE";
973
- readonly input: {
974
- readonly end?: import("./types").InputMaybe<number>;
975
- readonly start?: import("./types").InputMaybe<number>;
976
- };
977
- readonly scope: OperationScope;
978
- readonly attachments?: readonly {
979
- readonly data: string;
980
- readonly mimeType: string;
981
- readonly extension?: string | null | undefined;
982
- readonly fileName?: string | null | undefined;
983
- readonly hash: string;
984
- }[] | undefined;
985
- readonly context?: {
986
- readonly signer?: {
987
- readonly user: {
988
- readonly address: string;
989
- readonly networkId: string;
990
- readonly chainId: number;
991
- };
992
- readonly app: {
993
- readonly name: string;
994
- readonly key: string;
995
- };
996
- readonly signature: string;
997
- } | undefined;
998
- } | undefined;
999
- readonly index: number;
1000
- readonly timestamp: string;
1001
- readonly hash: string;
1002
- readonly skip: number;
1003
- readonly error?: string | undefined;
1004
- } | {
1005
- readonly type: "REDO";
1006
- readonly input: number;
1007
- readonly scope: OperationScope;
1008
- readonly attachments?: readonly {
1009
- readonly data: string;
1010
- readonly mimeType: string;
1011
- readonly extension?: string | null | undefined;
1012
- readonly fileName?: string | null | undefined;
1013
- readonly hash: string;
1014
- }[] | undefined;
1015
- readonly context?: {
1016
- readonly signer?: {
1017
- readonly user: {
1018
- readonly address: string;
1019
- readonly networkId: string;
1020
- readonly chainId: number;
1021
- };
1022
- readonly app: {
1023
- readonly name: string;
1024
- readonly key: string;
1025
- };
1026
- readonly signature: string;
1027
- } | undefined;
1028
- } | undefined;
1029
- readonly index: number;
1030
- readonly timestamp: string;
1031
- readonly hash: string;
1032
- readonly skip: number;
1033
- readonly error?: string | undefined;
1034
- } | {
1035
- readonly type: "SET_NAME";
1036
- readonly input: string;
1037
- readonly scope: OperationScope;
1038
- readonly attachments?: readonly {
1039
- readonly data: string;
1040
- readonly mimeType: string;
1041
- readonly extension?: string | null | undefined;
1042
- readonly fileName?: string | null | undefined;
1043
- readonly hash: string;
1044
- }[] | undefined;
1045
- readonly context?: {
1046
- readonly signer?: {
1047
- readonly user: {
1048
- readonly address: string;
1049
- readonly networkId: string;
1050
- readonly chainId: number;
1051
- };
1052
- readonly app: {
1053
- readonly name: string;
1054
- readonly key: string;
1055
- };
1056
- readonly signature: string;
1057
- } | undefined;
1058
- } | undefined;
1059
- readonly index: number;
1060
- readonly timestamp: string;
1061
- readonly hash: string;
1062
- readonly skip: number;
1063
- readonly error?: string | undefined;
1064
- } | {
1065
- readonly type: "UNDO";
1066
- readonly input: number;
1067
- readonly scope: OperationScope;
1068
- readonly attachments?: readonly {
1069
- readonly data: string;
1070
- readonly mimeType: string;
1071
- readonly extension?: string | null | undefined;
1072
- readonly fileName?: string | null | undefined;
1073
- readonly hash: string;
1074
- }[] | undefined;
1075
- readonly context?: {
1076
- readonly signer?: {
1077
- readonly user: {
1078
- readonly address: string;
1079
- readonly networkId: string;
1080
- readonly chainId: number;
1081
- };
1082
- readonly app: {
1083
- readonly name: string;
1084
- readonly key: string;
1085
- };
1086
- readonly signature: string;
1087
- } | undefined;
1088
- } | undefined;
1089
- readonly index: number;
1090
- readonly timestamp: string;
1091
- readonly hash: string;
1092
- readonly skip: number;
1093
- readonly error?: string | undefined;
1094
- } | {
1095
- readonly type: "NOOP";
1096
- readonly input: unknown;
1097
- readonly scope: OperationScope;
1098
- readonly attachments?: readonly {
1099
- readonly data: string;
1100
- readonly mimeType: string;
1101
- readonly extension?: string | null | undefined;
1102
- readonly fileName?: string | null | undefined;
1103
- readonly hash: string;
1104
- }[] | undefined;
1105
- readonly context?: {
1106
- readonly signer?: {
1107
- readonly user: {
1108
- readonly address: string;
1109
- readonly networkId: string;
1110
- readonly chainId: number;
1111
- };
1112
- readonly app: {
1113
- readonly name: string;
1114
- readonly key: string;
1115
- };
1116
- readonly signature: string;
1117
- } | undefined;
1118
- } | undefined;
1119
- readonly index: number;
1120
- readonly timestamp: string;
1121
- readonly hash: string;
1122
- readonly skip: number;
1123
- readonly error?: string | undefined;
1124
- } | import("immer").Immutable<A & {
1125
- index: number;
1126
- timestamp: string;
1127
- hash: string;
1128
- skip: number;
1129
- error?: string | undefined;
1130
- }>)[];
1131
- };
1132
- /**
1133
- * Gets the attachment associated with the given key.
1134
- * @param attachment - The key of the attachment to retrieve.
1135
- */
1136
- getAttachment(attachment: AttachmentRef): import("./types").Attachment;
1137
- /**
1138
- * Sets the name of the document.
1139
- * @param name - The new name of the document.
1140
- */
1141
- setName(name: string): this;
1142
- /**
1143
- * Reverts a number of actions from the document.
1144
- * @param count - The number of actions to revert.
1145
- */
1146
- undo(count: number): this;
1147
- /**
1148
- * Reapplies a number of actions to the document.
1149
- * @param count - The number of actions to reapply.
1150
- */
1151
- redo(count: number): this;
1152
- /**
1153
- * Removes a range of operations from the document.
1154
- * @param start - The starting index of the range to remove.
1155
- * @param end - The ending index of the range to remove.
1156
- */
1157
- prune(start?: number | undefined, end?: number | undefined): this;
1158
- /**
1159
- * Loads a document state and a set of operations.
1160
- * @param state - The state to load.
1161
- * @param operations - The operations to apply to the document.
1162
- */
1163
- loadState(state: Pick<ExtendedState<T, L>, 'state' | 'name'>, operations: number): this;
1164
- }
1165
- /**
1166
- * Applies multiple mixins to a base class.
1167
- * Used to have separate mixins to group methods by actions.
1168
- *
1169
- * @remarks
1170
- * {@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}
1171
- *
1172
- * @param derivedCtor - The class to apply the mixins to.
1173
- * @param constructors - The constructors of the mixins.
1174
- */
1175
- export declare function applyMixins(derivedCtor: any, constructors: any[]): void;