document-model 1.0.22 → 1.0.24
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.
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +4 -4
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/index-Xpydy6AU.js +22 -0
- package/dist/browser/internal/index-e4O5HJBs.js +1 -0
- package/dist/browser/internal/{index-k0_xGFJa.js → index-sfNIE5tQ.js} +400 -398
- package/dist/browser/internal/index-v3lMuqpK.js +36 -0
- package/dist/browser/internal/object-U8CbkcSV.js +6 -0
- package/dist/browser/internal/{object-wtPuW7QY.js → object-YlWt1S0J.js} +407 -357
- package/dist/browser/src/document/actions/creators.d.ts +3 -2
- package/dist/browser/src/document/actions/types.d.ts +1 -1
- package/dist/browser/src/document/object.d.ts +58 -2
- package/dist/browser/src/document/reducer.d.ts +2 -2
- package/dist/browser/src/document/schema/types.d.ts +9 -3
- package/dist/browser/src/document/signal.d.ts +7 -1
- package/dist/browser/src/document/types.d.ts +12 -1
- package/dist/browser/src/document/utils/base.d.ts +15 -2
- package/dist/browser/src/document-model/gen/header/object.d.ts +7 -6
- package/dist/browser/src/document-model/gen/module/object.d.ts +6 -5
- package/dist/browser/src/document-model/gen/operation/object.d.ts +11 -10
- package/dist/browser/src/document-model/gen/operation-error/object.d.ts +8 -7
- package/dist/browser/src/document-model/gen/operation-example/object.d.ts +5 -4
- package/dist/browser/src/document-model/gen/reducer.d.ts +2 -0
- package/dist/browser/src/document-model/gen/state/object.d.ts +7 -6
- package/dist/browser/src/document-model/gen/versioning/object.d.ts +6 -5
- package/dist/browser/src/document-model/index.d.ts +2 -1
- package/dist/browser/test/document/skip-operations.test.d.ts +1 -0
- package/dist/browser/test/document-model/skip-operations.test.d.ts +1 -0
- package/dist/browser/test/helpers.d.ts +5 -2
- package/dist/jest.config.d.ts +8 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +4 -4
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/internal/index-HgkfWSZk.js +36 -0
- package/dist/node/internal/index-PkGY1BML.js +22 -0
- package/dist/node/internal/index-aihhQ-ya.js +1 -0
- package/dist/node/internal/{index-vqhz-N10.js → index-sNi-u40H.js} +400 -398
- package/dist/node/internal/object-Nz1iEXFy.js +1 -0
- package/dist/node/internal/{object-yzJ3jRpE.js → object-T2hpMYZ4.js} +317 -267
- package/dist/node/src/document/actions/creators.d.ts +3 -2
- package/dist/node/src/document/actions/types.d.ts +1 -1
- package/dist/node/src/document/object.d.ts +58 -2
- package/dist/node/src/document/reducer.d.ts +2 -2
- package/dist/node/src/document/schema/types.d.ts +9 -3
- package/dist/node/src/document/signal.d.ts +7 -1
- package/dist/node/src/document/types.d.ts +12 -1
- package/dist/node/src/document/utils/base.d.ts +15 -2
- package/dist/node/src/document-model/gen/header/object.d.ts +7 -6
- package/dist/node/src/document-model/gen/module/object.d.ts +6 -5
- package/dist/node/src/document-model/gen/operation/object.d.ts +11 -10
- package/dist/node/src/document-model/gen/operation-error/object.d.ts +8 -7
- package/dist/node/src/document-model/gen/operation-example/object.d.ts +5 -4
- package/dist/node/src/document-model/gen/reducer.d.ts +2 -0
- package/dist/node/src/document-model/gen/state/object.d.ts +7 -6
- package/dist/node/src/document-model/gen/versioning/object.d.ts +6 -5
- package/dist/node/src/document-model/index.d.ts +2 -1
- package/dist/node/test/document/skip-operations.test.d.ts +1 -0
- package/dist/node/test/document-model/skip-operations.test.d.ts +1 -0
- package/dist/node/test/helpers.d.ts +5 -2
- package/dist/src/document/actions/creators.d.ts +47 -0
- package/dist/src/document/actions/index.d.ts +10 -0
- package/dist/src/document/actions/types.d.ts +8 -0
- package/dist/src/document/index.d.ts +6 -0
- package/dist/src/document/object.d.ts +447 -0
- package/dist/src/document/reducer.d.ts +16 -0
- package/dist/src/document/schema/index.d.ts +2 -0
- package/dist/src/document/schema/types.d.ts +180 -0
- package/dist/src/document/schema/zod.d.ts +113 -0
- package/dist/src/document/signal.d.ts +28 -0
- package/dist/src/document/types.d.ts +201 -0
- package/dist/src/document/utils/base.d.ts +74 -0
- package/dist/src/document/utils/browser.d.ts +10 -0
- package/dist/src/document/utils/file.d.ts +47 -0
- package/dist/src/document/utils/index.d.ts +2 -0
- package/dist/src/document/utils/node.d.ts +9 -0
- package/dist/src/document-model/custom/reducers/header.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/module.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-error.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-example.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/state.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/versioning.d.ts +7 -0
- package/dist/src/document-model/custom/utils.d.ts +1 -0
- package/dist/src/document-model/gen/actions.d.ts +15 -0
- package/dist/src/document-model/gen/creators.d.ts +7 -0
- package/dist/src/document-model/gen/document-model.d.ts +2 -0
- package/dist/src/document-model/gen/header/actions.d.ts +9 -0
- package/dist/src/document-model/gen/header/creators.d.ts +8 -0
- package/dist/src/document-model/gen/header/object.d.ts +12 -0
- package/dist/src/document-model/gen/header/operations.d.ts +10 -0
- package/dist/src/document-model/gen/index.d.ts +5 -0
- package/dist/src/document-model/gen/module/actions.d.ts +8 -0
- package/dist/src/document-model/gen/module/creators.d.ts +7 -0
- package/dist/src/document-model/gen/module/object.d.ts +11 -0
- package/dist/src/document-model/gen/module/operations.d.ts +9 -0
- package/dist/src/document-model/gen/object.d.ts +28 -0
- package/dist/src/document-model/gen/operation/actions.d.ts +13 -0
- package/dist/src/document-model/gen/operation/creators.d.ts +12 -0
- package/dist/src/document-model/gen/operation/object.d.ts +16 -0
- package/dist/src/document-model/gen/operation/operations.d.ts +14 -0
- package/dist/src/document-model/gen/operation-error/actions.d.ts +10 -0
- package/dist/src/document-model/gen/operation-error/creators.d.ts +9 -0
- package/dist/src/document-model/gen/operation-error/object.d.ts +13 -0
- package/dist/src/document-model/gen/operation-error/operations.d.ts +11 -0
- package/dist/src/document-model/gen/operation-example/actions.d.ts +7 -0
- package/dist/src/document-model/gen/operation-example/creators.d.ts +6 -0
- package/dist/src/document-model/gen/operation-example/object.d.ts +10 -0
- package/dist/src/document-model/gen/operation-example/operations.d.ts +8 -0
- package/dist/src/document-model/gen/reducer.d.ts +5 -0
- package/dist/src/document-model/gen/schema/index.d.ts +2 -0
- package/dist/src/document-model/gen/schema/types.d.ts +453 -0
- package/dist/src/document-model/gen/schema/zod.d.ts +453 -0
- package/dist/src/document-model/gen/state/actions.d.ts +9 -0
- package/dist/src/document-model/gen/state/creators.d.ts +8 -0
- package/dist/src/document-model/gen/state/object.d.ts +12 -0
- package/dist/src/document-model/gen/state/operations.d.ts +10 -0
- package/dist/src/document-model/gen/types.d.ts +8 -0
- package/dist/src/document-model/gen/utils.d.ts +6 -0
- package/dist/src/document-model/gen/versioning/actions.d.ts +8 -0
- package/dist/src/document-model/gen/versioning/creators.d.ts +7 -0
- package/dist/src/document-model/gen/versioning/object.d.ts +11 -0
- package/dist/src/document-model/gen/versioning/operations.d.ts +9 -0
- package/dist/src/document-model/index.d.ts +75 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/test/document/local.test.d.ts +1 -0
- package/dist/test/document/object.test.d.ts +1 -0
- package/dist/test/document/prune.test.d.ts +1 -0
- package/dist/test/document/redo.test.d.ts +1 -0
- package/dist/test/document/reducer.test.d.ts +1 -0
- package/dist/test/document/skip-operations.test.d.ts +1 -0
- package/dist/test/document/undo.test.d.ts +1 -0
- package/dist/test/document/utils.test.d.ts +1 -0
- package/dist/test/document-model/object.test.d.ts +1 -0
- package/dist/test/document-model/skip-operations.test.d.ts +1 -0
- package/dist/test/document-model/zip.test.d.ts +1 -0
- package/dist/test/helpers.d.ts +32 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vitest.config.d.ts +2 -0
- package/package.json +1 -1
- package/dist/browser/internal/index-BGvdUwMj.js +0 -1
- package/dist/browser/internal/index-ZaSXpgfR.js +0 -22
- package/dist/browser/internal/index-vHDbgY8i.js +0 -34
- package/dist/browser/internal/object-fIfH8K9b.js +0 -6
- package/dist/node/internal/index-3_D7m254.js +0 -34
- package/dist/node/internal/index-ffEJwj4v.js +0 -22
- package/dist/node/internal/index-frYzO4l6.js +0 -1
- package/dist/node/internal/object-Vf10stKL.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExtendedState, OperationScope } from '../types';
|
|
2
|
-
import { LoadStateAction, PruneAction, RedoAction, SetNameAction, UndoAction } from './types';
|
|
2
|
+
import { LoadStateAction, PruneAction, RedoAction, SetNameAction, UndoAction, NOOPAction } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Changes the name of the document.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@ export declare const setName: (name: string) => SetNameAction;
|
|
|
13
13
|
* @param count - Number of operations to cancel
|
|
14
14
|
* @category Actions
|
|
15
15
|
*/
|
|
16
|
-
export declare const undo: (
|
|
16
|
+
export declare const undo: (skip?: number, scope?: OperationScope) => UndoAction;
|
|
17
17
|
/**
|
|
18
18
|
* Cancels the last `count` {@link undo | UNDO} operations.
|
|
19
19
|
*
|
|
@@ -44,3 +44,4 @@ export declare const prune: (start?: number | undefined, end?: number | undefine
|
|
|
44
44
|
* @category Actions
|
|
45
45
|
*/
|
|
46
46
|
export declare const loadState: <S, T>(state: Pick<ExtendedState<S, T>, "name" | "state">, operations: number) => LoadStateAction;
|
|
47
|
+
export declare const noop: (scope?: OperationScope) => NOOPAction;
|
|
@@ -4,5 +4,5 @@ export declare const UNDO = "UNDO";
|
|
|
4
4
|
export declare const REDO = "REDO";
|
|
5
5
|
export declare const PRUNE = "PRUNE";
|
|
6
6
|
export declare const LOAD_STATE = "LOAD_STATE";
|
|
7
|
-
export { LoadStateAction, PruneAction, RedoAction, SetNameAction, UndoAction, } from '../types';
|
|
7
|
+
export { LoadStateAction, PruneAction, RedoAction, SetNameAction, UndoAction, NOOPAction, } from '../types';
|
|
8
8
|
export type { BaseAction };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseAction } from './actions/types';
|
|
2
2
|
import type { SignalDispatch } from './signal';
|
|
3
|
-
import type { Action, AttachmentRef, Document, ExtendedState, OperationScope, Reducer } from './types';
|
|
3
|
+
import type { Action, AttachmentRef, Document, ExtendedState, OperationScope, Reducer, ReducerOptions } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* This is an abstract class representing a document and provides methods
|
|
6
6
|
* for creating and manipulating documents.
|
|
@@ -22,7 +22,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
22
22
|
* @param action - The action to dispatch.
|
|
23
23
|
* @returns The Document instance.
|
|
24
24
|
*/
|
|
25
|
-
protected dispatch(action: A | BaseAction): this;
|
|
25
|
+
protected dispatch(action: A | BaseAction, options?: ReducerOptions): this;
|
|
26
26
|
/**
|
|
27
27
|
* Saves the state of the document to a file.
|
|
28
28
|
* @param path - The file path where the state should be saved.
|
|
@@ -66,6 +66,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
66
66
|
readonly index: number;
|
|
67
67
|
readonly timestamp: string;
|
|
68
68
|
readonly hash: string;
|
|
69
|
+
readonly skip: number;
|
|
69
70
|
} | {
|
|
70
71
|
readonly input: {
|
|
71
72
|
readonly end?: import("./types").InputMaybe<number>;
|
|
@@ -76,6 +77,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
76
77
|
readonly index: number;
|
|
77
78
|
readonly timestamp: string;
|
|
78
79
|
readonly hash: string;
|
|
80
|
+
readonly skip: number;
|
|
79
81
|
} | {
|
|
80
82
|
readonly input: number;
|
|
81
83
|
readonly type: "REDO";
|
|
@@ -83,6 +85,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
83
85
|
readonly index: number;
|
|
84
86
|
readonly timestamp: string;
|
|
85
87
|
readonly hash: string;
|
|
88
|
+
readonly skip: number;
|
|
86
89
|
} | {
|
|
87
90
|
readonly input: string;
|
|
88
91
|
readonly type: "SET_NAME";
|
|
@@ -90,6 +93,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
90
93
|
readonly index: number;
|
|
91
94
|
readonly timestamp: string;
|
|
92
95
|
readonly hash: string;
|
|
96
|
+
readonly skip: number;
|
|
93
97
|
} | {
|
|
94
98
|
readonly input: number;
|
|
95
99
|
readonly type: "UNDO";
|
|
@@ -97,10 +101,20 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
97
101
|
readonly index: number;
|
|
98
102
|
readonly timestamp: string;
|
|
99
103
|
readonly hash: string;
|
|
104
|
+
readonly skip: number;
|
|
105
|
+
} | {
|
|
106
|
+
readonly input: unknown;
|
|
107
|
+
readonly type: "NOOP";
|
|
108
|
+
readonly scope: OperationScope;
|
|
109
|
+
readonly index: number;
|
|
110
|
+
readonly timestamp: string;
|
|
111
|
+
readonly hash: string;
|
|
112
|
+
readonly skip: number;
|
|
100
113
|
} | import("immer").Immutable<A & {
|
|
101
114
|
index: number;
|
|
102
115
|
timestamp: string;
|
|
103
116
|
hash: string;
|
|
117
|
+
skip: number;
|
|
104
118
|
}>)[];
|
|
105
119
|
readonly local: readonly ({
|
|
106
120
|
readonly input: {
|
|
@@ -115,6 +129,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
115
129
|
readonly index: number;
|
|
116
130
|
readonly timestamp: string;
|
|
117
131
|
readonly hash: string;
|
|
132
|
+
readonly skip: number;
|
|
118
133
|
} | {
|
|
119
134
|
readonly input: {
|
|
120
135
|
readonly end?: import("./types").InputMaybe<number>;
|
|
@@ -125,6 +140,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
125
140
|
readonly index: number;
|
|
126
141
|
readonly timestamp: string;
|
|
127
142
|
readonly hash: string;
|
|
143
|
+
readonly skip: number;
|
|
128
144
|
} | {
|
|
129
145
|
readonly input: number;
|
|
130
146
|
readonly type: "REDO";
|
|
@@ -132,6 +148,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
132
148
|
readonly index: number;
|
|
133
149
|
readonly timestamp: string;
|
|
134
150
|
readonly hash: string;
|
|
151
|
+
readonly skip: number;
|
|
135
152
|
} | {
|
|
136
153
|
readonly input: string;
|
|
137
154
|
readonly type: "SET_NAME";
|
|
@@ -139,6 +156,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
139
156
|
readonly index: number;
|
|
140
157
|
readonly timestamp: string;
|
|
141
158
|
readonly hash: string;
|
|
159
|
+
readonly skip: number;
|
|
142
160
|
} | {
|
|
143
161
|
readonly input: number;
|
|
144
162
|
readonly type: "UNDO";
|
|
@@ -146,10 +164,20 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
146
164
|
readonly index: number;
|
|
147
165
|
readonly timestamp: string;
|
|
148
166
|
readonly hash: string;
|
|
167
|
+
readonly skip: number;
|
|
168
|
+
} | {
|
|
169
|
+
readonly input: unknown;
|
|
170
|
+
readonly type: "NOOP";
|
|
171
|
+
readonly scope: OperationScope;
|
|
172
|
+
readonly index: number;
|
|
173
|
+
readonly timestamp: string;
|
|
174
|
+
readonly hash: string;
|
|
175
|
+
readonly skip: number;
|
|
149
176
|
} | import("immer").Immutable<A & {
|
|
150
177
|
index: number;
|
|
151
178
|
timestamp: string;
|
|
152
179
|
hash: string;
|
|
180
|
+
skip: number;
|
|
153
181
|
}>)[];
|
|
154
182
|
};
|
|
155
183
|
/**
|
|
@@ -236,6 +264,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
236
264
|
readonly index: number;
|
|
237
265
|
readonly timestamp: string;
|
|
238
266
|
readonly hash: string;
|
|
267
|
+
readonly skip: number;
|
|
239
268
|
} | {
|
|
240
269
|
readonly input: {
|
|
241
270
|
readonly end?: import("./types").InputMaybe<number>;
|
|
@@ -246,6 +275,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
246
275
|
readonly index: number;
|
|
247
276
|
readonly timestamp: string;
|
|
248
277
|
readonly hash: string;
|
|
278
|
+
readonly skip: number;
|
|
249
279
|
} | {
|
|
250
280
|
readonly input: number;
|
|
251
281
|
readonly type: "REDO";
|
|
@@ -253,6 +283,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
253
283
|
readonly index: number;
|
|
254
284
|
readonly timestamp: string;
|
|
255
285
|
readonly hash: string;
|
|
286
|
+
readonly skip: number;
|
|
256
287
|
} | {
|
|
257
288
|
readonly input: string;
|
|
258
289
|
readonly type: "SET_NAME";
|
|
@@ -260,6 +291,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
260
291
|
readonly index: number;
|
|
261
292
|
readonly timestamp: string;
|
|
262
293
|
readonly hash: string;
|
|
294
|
+
readonly skip: number;
|
|
263
295
|
} | {
|
|
264
296
|
readonly input: number;
|
|
265
297
|
readonly type: "UNDO";
|
|
@@ -267,10 +299,20 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
267
299
|
readonly index: number;
|
|
268
300
|
readonly timestamp: string;
|
|
269
301
|
readonly hash: string;
|
|
302
|
+
readonly skip: number;
|
|
303
|
+
} | {
|
|
304
|
+
readonly input: unknown;
|
|
305
|
+
readonly type: "NOOP";
|
|
306
|
+
readonly scope: OperationScope;
|
|
307
|
+
readonly index: number;
|
|
308
|
+
readonly timestamp: string;
|
|
309
|
+
readonly hash: string;
|
|
310
|
+
readonly skip: number;
|
|
270
311
|
} | import("immer").Immutable<A & {
|
|
271
312
|
index: number;
|
|
272
313
|
timestamp: string;
|
|
273
314
|
hash: string;
|
|
315
|
+
skip: number;
|
|
274
316
|
}>)[];
|
|
275
317
|
readonly local: readonly ({
|
|
276
318
|
readonly input: {
|
|
@@ -285,6 +327,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
285
327
|
readonly index: number;
|
|
286
328
|
readonly timestamp: string;
|
|
287
329
|
readonly hash: string;
|
|
330
|
+
readonly skip: number;
|
|
288
331
|
} | {
|
|
289
332
|
readonly input: {
|
|
290
333
|
readonly end?: import("./types").InputMaybe<number>;
|
|
@@ -295,6 +338,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
295
338
|
readonly index: number;
|
|
296
339
|
readonly timestamp: string;
|
|
297
340
|
readonly hash: string;
|
|
341
|
+
readonly skip: number;
|
|
298
342
|
} | {
|
|
299
343
|
readonly input: number;
|
|
300
344
|
readonly type: "REDO";
|
|
@@ -302,6 +346,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
302
346
|
readonly index: number;
|
|
303
347
|
readonly timestamp: string;
|
|
304
348
|
readonly hash: string;
|
|
349
|
+
readonly skip: number;
|
|
305
350
|
} | {
|
|
306
351
|
readonly input: string;
|
|
307
352
|
readonly type: "SET_NAME";
|
|
@@ -309,6 +354,7 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
309
354
|
readonly index: number;
|
|
310
355
|
readonly timestamp: string;
|
|
311
356
|
readonly hash: string;
|
|
357
|
+
readonly skip: number;
|
|
312
358
|
} | {
|
|
313
359
|
readonly input: number;
|
|
314
360
|
readonly type: "UNDO";
|
|
@@ -316,10 +362,20 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
316
362
|
readonly index: number;
|
|
317
363
|
readonly timestamp: string;
|
|
318
364
|
readonly hash: string;
|
|
365
|
+
readonly skip: number;
|
|
366
|
+
} | {
|
|
367
|
+
readonly input: unknown;
|
|
368
|
+
readonly type: "NOOP";
|
|
369
|
+
readonly scope: OperationScope;
|
|
370
|
+
readonly index: number;
|
|
371
|
+
readonly timestamp: string;
|
|
372
|
+
readonly hash: string;
|
|
373
|
+
readonly skip: number;
|
|
319
374
|
} | import("immer").Immutable<A & {
|
|
320
375
|
index: number;
|
|
321
376
|
timestamp: string;
|
|
322
377
|
hash: string;
|
|
378
|
+
skip: number;
|
|
323
379
|
}>)[];
|
|
324
380
|
};
|
|
325
381
|
readonly initialState: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseAction } from './actions/types';
|
|
2
|
-
import { Action, Document, ImmutableStateReducer } from './types';
|
|
2
|
+
import { Action, Document, ImmutableStateReducer, ReducerOptions } from './types';
|
|
3
3
|
import { SignalDispatch } from './signal';
|
|
4
4
|
/**
|
|
5
5
|
* Base document reducer that wraps a custom document reducer and handles
|
|
@@ -13,4 +13,4 @@ import { SignalDispatch } from './signal';
|
|
|
13
13
|
* specific to the document's state.
|
|
14
14
|
* @returns The new state of the document.
|
|
15
15
|
*/
|
|
16
|
-
export declare function baseReducer<T, A extends Action, L>(document: Document<T, A, L>, action: A | BaseAction, customReducer: ImmutableStateReducer<T, A, L>, dispatch?: SignalDispatch): Document<T, A, L>;
|
|
16
|
+
export declare function baseReducer<T, A extends Action, L>(document: Document<T, A, L>, action: A | BaseAction, customReducer: ImmutableStateReducer<T, A, L>, dispatch?: SignalDispatch, options?: ReducerOptions): Document<T, A, L>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OperationScope } from
|
|
1
|
+
import { OperationScope } from '..';
|
|
2
2
|
export type Maybe<T> = T | null;
|
|
3
3
|
export type InputMaybe<T> = T | null | undefined;
|
|
4
4
|
export type Exact<T extends {
|
|
@@ -63,7 +63,7 @@ export type Action = IAction & {
|
|
|
63
63
|
__typename?: 'Action';
|
|
64
64
|
type: Scalars['String']['output'];
|
|
65
65
|
};
|
|
66
|
-
export type BaseAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | UndoAction;
|
|
66
|
+
export type BaseAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | UndoAction | NOOPAction;
|
|
67
67
|
export type DocumentFile = {
|
|
68
68
|
__typename?: 'DocumentFile';
|
|
69
69
|
data: Scalars['String']['output'];
|
|
@@ -156,7 +156,7 @@ export type Set_Name = 'SET_NAME';
|
|
|
156
156
|
export type SetNameAction = {
|
|
157
157
|
input: Scalars['String']['input'];
|
|
158
158
|
type: Set_Name | `${Set_Name}`;
|
|
159
|
-
scope:
|
|
159
|
+
scope: 'global';
|
|
160
160
|
};
|
|
161
161
|
export type SetNameOperation = IOperation & {
|
|
162
162
|
__typename?: 'SetNameOperation';
|
|
@@ -172,3 +172,9 @@ export type UndoAction = {
|
|
|
172
172
|
type: Undo | `${Undo}`;
|
|
173
173
|
scope: OperationScope;
|
|
174
174
|
};
|
|
175
|
+
export type NOOP = 'NOOP';
|
|
176
|
+
export type NOOPAction = {
|
|
177
|
+
input: Scalars['Unknown']['input'];
|
|
178
|
+
type: NOOP | `${NOOP}`;
|
|
179
|
+
scope: OperationScope;
|
|
180
|
+
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { Document } from './types';
|
|
1
|
+
import { Document, OperationScope } from './types';
|
|
2
2
|
export interface ISignal<T extends string = string, I = unknown> {
|
|
3
3
|
type: T;
|
|
4
4
|
input: I;
|
|
5
5
|
}
|
|
6
|
+
export type SynchronizationUnit = {
|
|
7
|
+
syncId: string;
|
|
8
|
+
scope: OperationScope;
|
|
9
|
+
branch: string;
|
|
10
|
+
};
|
|
6
11
|
export type CreateChildDocumentInput = {
|
|
7
12
|
id: string;
|
|
8
13
|
documentType: string;
|
|
9
14
|
document?: Document;
|
|
15
|
+
synchronizationUnits: SynchronizationUnit[];
|
|
10
16
|
};
|
|
11
17
|
export type CreateChildDocumentSignal = ISignal<'CREATE_CHILD_DOCUMENT', CreateChildDocumentInput>;
|
|
12
18
|
export type DeleteChildDocumentInput = {
|
|
@@ -27,6 +27,10 @@ export type Action<T extends string = string, I = unknown, S extends OperationSc
|
|
|
27
27
|
export type ActionWithAttachment<T extends string = string, I = unknown, S extends OperationScope = OperationScope> = Action<T, I, S> & {
|
|
28
28
|
attachments: AttachmentInput[];
|
|
29
29
|
};
|
|
30
|
+
export type ReducerOptions = {
|
|
31
|
+
/** The number of operations to skip before this new action is applied */
|
|
32
|
+
skip?: number;
|
|
33
|
+
};
|
|
30
34
|
/**
|
|
31
35
|
* A pure function that takes an action and the previous state
|
|
32
36
|
* of the document and returns the new state.
|
|
@@ -34,7 +38,7 @@ export type ActionWithAttachment<T extends string = string, I = unknown, S exten
|
|
|
34
38
|
* @typeParam State - The type of the document data.
|
|
35
39
|
* @typeParam A - The type of the actions supported by the reducer.
|
|
36
40
|
*/
|
|
37
|
-
export type Reducer<State, A extends Action, LocalState> = (state: Document<State, A, LocalState>, action: A | BaseAction, dispatch?: SignalDispatch) => Document<State, A, LocalState>;
|
|
41
|
+
export type Reducer<State, A extends Action, LocalState> = (state: Document<State, A, LocalState>, action: A | BaseAction, dispatch?: SignalDispatch, options?: ReducerOptions) => Document<State, A, LocalState>;
|
|
38
42
|
/**
|
|
39
43
|
* A {@link Reducer} that prevents mutable code from changing the previous state.
|
|
40
44
|
*
|
|
@@ -72,6 +76,8 @@ export type Operation<A extends Action = Action> = A & {
|
|
|
72
76
|
timestamp: string;
|
|
73
77
|
/** Hash of the resulting document data after the operation */
|
|
74
78
|
hash: string;
|
|
79
|
+
/** The number of operations skipped with this Operation */
|
|
80
|
+
skip: number;
|
|
75
81
|
};
|
|
76
82
|
/**
|
|
77
83
|
* The base attributes of a {@link Document}.
|
|
@@ -124,6 +130,11 @@ export type ExtendedState<GlobalState, LocalState = unknown> = DocumentHeader &
|
|
|
124
130
|
attachments: FileRegistry;
|
|
125
131
|
};
|
|
126
132
|
export type DocumentOperations<A extends Action> = Required<Record<OperationScope, Operation<A | BaseAction>[]>>;
|
|
133
|
+
export type MappedOperation<A extends Action> = {
|
|
134
|
+
ignore: boolean;
|
|
135
|
+
operation: Operation<A | BaseAction>;
|
|
136
|
+
};
|
|
137
|
+
export type DocumentOperationsIgnoreMap<A extends Action> = Required<Record<OperationScope, MappedOperation<A>[]>>;
|
|
127
138
|
/**
|
|
128
139
|
* The base type of a document model.
|
|
129
140
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { baseReducer } from '../reducer';
|
|
2
|
-
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState, PartialState, DocumentOperations, DocumentHeader } from '../types';
|
|
2
|
+
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState, PartialState, DocumentOperations, DocumentHeader, DocumentOperationsIgnoreMap, Operation, MappedOperation } from '../types';
|
|
3
3
|
import { SignalDispatch } from '../signal';
|
|
4
4
|
export declare function isBaseAction(action: Action): action is BaseAction;
|
|
5
5
|
/**
|
|
@@ -13,6 +13,10 @@ export declare function isBaseAction(action: Action): action is BaseAction;
|
|
|
13
13
|
*
|
|
14
14
|
* @param type - The type of the action.
|
|
15
15
|
* @param input - The input properties of the action.
|
|
16
|
+
* @param attachments - The attachments included in the action.
|
|
17
|
+
* @param validator - The validator to use for the input properties.
|
|
18
|
+
* @param scope - The scope of the action, can either be 'global' or 'local'.
|
|
19
|
+
* @param skip - The number of operations to skip before this new action is applied.
|
|
16
20
|
*
|
|
17
21
|
* @throws Error if the type is empty or not a string.
|
|
18
22
|
*
|
|
@@ -56,6 +60,15 @@ export declare const createDocument: <S, A extends Action, L = unknown>(initialS
|
|
|
56
60
|
export declare const hashDocument: (document: Pick<Document, 'state'>, scope?: OperationScope) => string;
|
|
57
61
|
export declare const hashKey: (date?: Date, randomLimit?: number) => string;
|
|
58
62
|
export declare function readOnly<T>(value: T): Immutable<T>;
|
|
59
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Maps skipped operations in an array of operations.
|
|
65
|
+
* Skipped operations are operations that are ignored during processing.
|
|
66
|
+
* @param operations - The array of operations to map.
|
|
67
|
+
* @returns An array of mapped operations with ignore flag indicating if the operation is skipped.
|
|
68
|
+
* @throws Error if the operation index is invalid and there are missing operations.
|
|
69
|
+
*/
|
|
70
|
+
export declare function mapSkippedOperations<A extends Action>(operations: Operation<BaseAction | A>[]): MappedOperation<A>[];
|
|
71
|
+
export declare function sortOperations<A extends Action>(operations: DocumentOperations<A>): Operation<BaseAction | A>[];
|
|
72
|
+
export declare function sortMappedOperations<A extends Action>(operations: DocumentOperationsIgnoreMap<A>): MappedOperation<A>[];
|
|
60
73
|
export declare function replayOperations<T, A extends Action, L>(initialState: ExtendedState<T, L>, operations: DocumentOperations<A>, reducer: ImmutableStateReducer<T, A, L>, dispatch?: SignalDispatch, header?: DocumentHeader, documentReducer?: typeof baseReducer): Document<T, A, L>;
|
|
61
74
|
export declare function replayDocument<T, A extends Action, L>(initialState: ExtendedState<T, L>, operations: DocumentOperations<A>, reducer: Reducer<T, A, L>, dispatch?: SignalDispatch, header?: DocumentHeader): Document<T, A, L>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
2
|
import { SetModelNameInput, SetModelIdInput, SetModelExtensionInput, SetModelDescriptionInput, SetAuthorNameInput, SetAuthorWebsiteInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
+
import { ReducerOptions } from '../../../document';
|
|
4
5
|
export default class DocumentModel_Header extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
|
-
setModelName(input: SetModelNameInput): this;
|
|
6
|
-
setModelId(input: SetModelIdInput): this;
|
|
7
|
-
setModelExtension(input: SetModelExtensionInput): this;
|
|
8
|
-
setModelDescription(input: SetModelDescriptionInput): this;
|
|
9
|
-
setAuthorName(input: SetAuthorNameInput): this;
|
|
10
|
-
setAuthorWebsite(input: SetAuthorWebsiteInput): this;
|
|
6
|
+
setModelName(input: SetModelNameInput, options?: ReducerOptions): this;
|
|
7
|
+
setModelId(input: SetModelIdInput, options?: ReducerOptions): this;
|
|
8
|
+
setModelExtension(input: SetModelExtensionInput, options?: ReducerOptions): this;
|
|
9
|
+
setModelDescription(input: SetModelDescriptionInput, options?: ReducerOptions): this;
|
|
10
|
+
setAuthorName(input: SetAuthorNameInput, options?: ReducerOptions): this;
|
|
11
|
+
setAuthorWebsite(input: SetAuthorWebsiteInput, options?: ReducerOptions): this;
|
|
11
12
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
2
|
import { AddModuleInput, SetModuleNameInput, SetModuleDescriptionInput, DeleteModuleInput, ReorderModulesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
+
import { ReducerOptions } from '../../../document';
|
|
4
5
|
export default class DocumentModel_Module extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
|
-
addModule(input: AddModuleInput): this;
|
|
6
|
-
setModuleName(input: SetModuleNameInput): this;
|
|
7
|
-
setModuleDescription(input: SetModuleDescriptionInput): this;
|
|
8
|
-
deleteModule(input: DeleteModuleInput): this;
|
|
9
|
-
reorderModules(input: ReorderModulesInput): this;
|
|
6
|
+
addModule(input: AddModuleInput, options?: ReducerOptions): this;
|
|
7
|
+
setModuleName(input: SetModuleNameInput, options?: ReducerOptions): this;
|
|
8
|
+
setModuleDescription(input: SetModuleDescriptionInput, options?: ReducerOptions): this;
|
|
9
|
+
deleteModule(input: DeleteModuleInput, options?: ReducerOptions): this;
|
|
10
|
+
reorderModules(input: ReorderModulesInput, options?: ReducerOptions): this;
|
|
10
11
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
2
|
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, DocumentModelState, SetOperationScopeInput, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
+
import { ReducerOptions } from '../../../document';
|
|
4
5
|
export default class DocumentModel_Operation extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
|
-
addOperation(input: AddOperationInput): this;
|
|
6
|
-
setOperationName(input: SetOperationNameInput): this;
|
|
7
|
-
setOperationScope(input: SetOperationScopeInput): this;
|
|
8
|
-
setOperationSchema(input: SetOperationSchemaInput): this;
|
|
9
|
-
setOperationDescription(input: SetOperationDescriptionInput): this;
|
|
10
|
-
setOperationTemplate(input: SetOperationTemplateInput): this;
|
|
11
|
-
setOperationReducer(input: SetOperationReducerInput): this;
|
|
12
|
-
moveOperation(input: MoveOperationInput): this;
|
|
13
|
-
deleteOperation(input: DeleteOperationInput): this;
|
|
14
|
-
reorderModuleOperations(input: ReorderModuleOperationsInput): this;
|
|
6
|
+
addOperation(input: AddOperationInput, options?: ReducerOptions): this;
|
|
7
|
+
setOperationName(input: SetOperationNameInput, options?: ReducerOptions): this;
|
|
8
|
+
setOperationScope(input: SetOperationScopeInput, options?: ReducerOptions): this;
|
|
9
|
+
setOperationSchema(input: SetOperationSchemaInput, options?: ReducerOptions): this;
|
|
10
|
+
setOperationDescription(input: SetOperationDescriptionInput, options?: ReducerOptions): this;
|
|
11
|
+
setOperationTemplate(input: SetOperationTemplateInput, options?: ReducerOptions): this;
|
|
12
|
+
setOperationReducer(input: SetOperationReducerInput, options?: ReducerOptions): this;
|
|
13
|
+
moveOperation(input: MoveOperationInput, options?: ReducerOptions): this;
|
|
14
|
+
deleteOperation(input: DeleteOperationInput, options?: ReducerOptions): this;
|
|
15
|
+
reorderModuleOperations(input: ReorderModuleOperationsInput, options?: ReducerOptions): this;
|
|
15
16
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
2
|
import { AddOperationErrorInput, SetOperationErrorCodeInput, SetOperationErrorNameInput, SetOperationErrorDescriptionInput, SetOperationErrorTemplateInput, DeleteOperationErrorInput, ReorderOperationErrorsInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
+
import { ReducerOptions } from '../../../document';
|
|
4
5
|
export default class DocumentModel_OperationError extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
|
-
addOperationError(input: AddOperationErrorInput): this;
|
|
6
|
-
setOperationErrorCode(input: SetOperationErrorCodeInput): this;
|
|
7
|
-
setOperationErrorName(input: SetOperationErrorNameInput): this;
|
|
8
|
-
setOperationErrorDescription(input: SetOperationErrorDescriptionInput): this;
|
|
9
|
-
setOperationErrorTemplate(input: SetOperationErrorTemplateInput): this;
|
|
10
|
-
deleteOperationError(input: DeleteOperationErrorInput): this;
|
|
11
|
-
reorderOperationErrors(input: ReorderOperationErrorsInput): this;
|
|
6
|
+
addOperationError(input: AddOperationErrorInput, options?: ReducerOptions): this;
|
|
7
|
+
setOperationErrorCode(input: SetOperationErrorCodeInput, options?: ReducerOptions): this;
|
|
8
|
+
setOperationErrorName(input: SetOperationErrorNameInput, options?: ReducerOptions): this;
|
|
9
|
+
setOperationErrorDescription(input: SetOperationErrorDescriptionInput, options?: ReducerOptions): this;
|
|
10
|
+
setOperationErrorTemplate(input: SetOperationErrorTemplateInput, options?: ReducerOptions): this;
|
|
11
|
+
deleteOperationError(input: DeleteOperationErrorInput, options?: ReducerOptions): this;
|
|
12
|
+
reorderOperationErrors(input: ReorderOperationErrorsInput, options?: ReducerOptions): this;
|
|
12
13
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
2
|
import { AddOperationExampleInput, UpdateOperationExampleInput, DeleteOperationExampleInput, ReorderOperationExamplesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
+
import { ReducerOptions } from '../../../document';
|
|
4
5
|
export default class DocumentModel_OperationExample extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
|
-
addOperationExample(input: AddOperationExampleInput): this;
|
|
6
|
-
updateOperationExample(input: UpdateOperationExampleInput): this;
|
|
7
|
-
deleteOperationExample(input: DeleteOperationExampleInput): this;
|
|
8
|
-
reorderOperationExamples(input: ReorderOperationExamplesInput): this;
|
|
6
|
+
addOperationExample(input: AddOperationExampleInput, options?: ReducerOptions): this;
|
|
7
|
+
updateOperationExample(input: UpdateOperationExampleInput, options?: ReducerOptions): this;
|
|
8
|
+
deleteOperationExample(input: DeleteOperationExampleInput, options?: ReducerOptions): this;
|
|
9
|
+
reorderOperationExamples(input: ReorderOperationExamplesInput, options?: ReducerOptions): this;
|
|
9
10
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ImmutableStateReducer } from '../../document/types';
|
|
1
2
|
import { DocumentModelLocalState, DocumentModelState } from './schema';
|
|
2
3
|
import { DocumentModelAction } from './actions';
|
|
4
|
+
export declare const stateReducer: ImmutableStateReducer<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
3
5
|
export declare const reducer: import("../../document/types").Reducer<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
2
|
import { SetStateSchemaInput, SetInitialStateInput, AddStateExampleInput, UpdateStateExampleInput, DeleteStateExampleInput, ReorderStateExamplesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
+
import { ReducerOptions } from '../../../document';
|
|
4
5
|
export default class DocumentModel_State extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
|
-
setStateSchema(input: SetStateSchemaInput): this;
|
|
6
|
-
setInitialState(input: SetInitialStateInput): this;
|
|
7
|
-
addStateExample(input: AddStateExampleInput): this;
|
|
8
|
-
updateStateExample(input: UpdateStateExampleInput): this;
|
|
9
|
-
deleteStateExample(input: DeleteStateExampleInput): this;
|
|
10
|
-
reorderStateExamples(input: ReorderStateExamplesInput): this;
|
|
6
|
+
setStateSchema(input: SetStateSchemaInput, options?: ReducerOptions): this;
|
|
7
|
+
setInitialState(input: SetInitialStateInput, options?: ReducerOptions): this;
|
|
8
|
+
addStateExample(input: AddStateExampleInput, options?: ReducerOptions): this;
|
|
9
|
+
updateStateExample(input: UpdateStateExampleInput, options?: ReducerOptions): this;
|
|
10
|
+
deleteStateExample(input: DeleteStateExampleInput, options?: ReducerOptions): this;
|
|
11
|
+
reorderStateExamples(input: ReorderStateExamplesInput, options?: ReducerOptions): this;
|
|
11
12
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
2
|
import { AddChangeLogItemInput, UpdateChangeLogItemInput, DeleteChangeLogItemInput, ReorderChangeLogItemsInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
+
import { ReducerOptions } from '../../../document';
|
|
4
5
|
export default class DocumentModel_Versioning extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
|
-
addChangeLogItem(input: AddChangeLogItemInput): this;
|
|
6
|
-
updateChangeLogItem(input: UpdateChangeLogItemInput): this;
|
|
7
|
-
deleteChangeLogItem(input: DeleteChangeLogItemInput): this;
|
|
8
|
-
reorderChangeLogItems(input: ReorderChangeLogItemsInput): this;
|
|
9
|
-
releaseNewVersion(): this;
|
|
6
|
+
addChangeLogItem(input: AddChangeLogItemInput, options?: ReducerOptions): this;
|
|
7
|
+
updateChangeLogItem(input: UpdateChangeLogItemInput, options?: ReducerOptions): this;
|
|
8
|
+
deleteChangeLogItem(input: DeleteChangeLogItemInput, options?: ReducerOptions): this;
|
|
9
|
+
reorderChangeLogItems(input: ReorderChangeLogItemsInput, options?: ReducerOptions): this;
|
|
10
|
+
releaseNewVersion(options?: ReducerOptions): this;
|
|
10
11
|
}
|
|
@@ -63,10 +63,11 @@ declare const actions: {
|
|
|
63
63
|
deleteStateExample: (input: import("./gen").DeleteStateExampleInput) => import("./gen").DeleteStateExampleAction;
|
|
64
64
|
reorderStateExamples: (input: import("./gen").ReorderStateExamplesInput) => import("./gen").ReorderStateExamplesAction;
|
|
65
65
|
setName: (name: string) => import("../document").SetNameAction;
|
|
66
|
-
undo: (
|
|
66
|
+
undo: (skip?: number, scope?: import("../document").OperationScope) => import("../document").UndoAction;
|
|
67
67
|
redo: (count?: number, scope?: import("../document").OperationScope) => import("../document").RedoAction;
|
|
68
68
|
prune: (start?: number | undefined, end?: number | undefined, scope?: import("../document").OperationScope) => import("../document").PruneAction;
|
|
69
69
|
loadState: <S, T>(state: Pick<import("../document").ExtendedState<S, T>, "name" | "state">, operations: number) => import("../document").LoadStateAction;
|
|
70
|
+
noop: (scope?: import("../document").OperationScope) => import("../document").NOOPAction;
|
|
70
71
|
};
|
|
71
72
|
export declare const module: _DocumentModel<DocumentModelState, DocumentModelAction, DocumentModelLocalState, DocumentModel>;
|
|
72
73
|
export * from './custom/utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action, Operation } from '../src/document/types';
|
|
1
|
+
import { Action, ImmutableStateReducer, Operation, OperationScope } from '../src/document/types';
|
|
2
2
|
export declare const emptyReducer: import("../src/document/types").Reducer<unknown, Action, unknown>;
|
|
3
3
|
export interface IncrementAction extends Action {
|
|
4
4
|
type: 'INCREMENT';
|
|
@@ -20,10 +20,13 @@ export type CountLocalState = {
|
|
|
20
20
|
export declare const increment: () => IncrementAction;
|
|
21
21
|
export declare const decrement: () => DecrementAction;
|
|
22
22
|
export declare const setLocalName: (name: string) => SetLocalNameAction;
|
|
23
|
+
export declare const baseCountReducer: ImmutableStateReducer<CountState, CountAction, CountLocalState>;
|
|
23
24
|
export declare const countReducer: import("../src/document/types").Reducer<CountState, CountAction, CountLocalState>;
|
|
24
25
|
export declare const mapOperations: (operations: Operation[]) => {
|
|
25
26
|
input: unknown;
|
|
26
27
|
type: string;
|
|
27
28
|
index: number;
|
|
28
|
-
scope:
|
|
29
|
+
scope: OperationScope;
|
|
30
|
+
skip: number;
|
|
29
31
|
}[];
|
|
32
|
+
export declare const createFakeOperation: (index?: number, skip?: number, scope?: OperationScope) => Operation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-Nz1iEXFy.js");require("json-stringify-deterministic");require("immer");require("jszip");require("crypto");require("fs");require("https");require("path");const e=require("./internal/index-PkGY1BML.js");require("zod");exports.Document=e.Document;exports.DocumentModel=e.DocumentModel$1;exports.actions=e.actions;exports.documentModel=e.documentModel;exports.module=e.module;exports.reducer=e.reducer;exports.utils=e.utils;exports.z=e.zod;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./internal/object-
|
|
1
|
+
import "./internal/object-T2hpMYZ4.js";
|
|
2
2
|
import "json-stringify-deterministic";
|
|
3
3
|
import "immer";
|
|
4
4
|
import "jszip";
|
|
@@ -6,7 +6,7 @@ import "crypto";
|
|
|
6
6
|
import "fs";
|
|
7
7
|
import "https";
|
|
8
8
|
import "path";
|
|
9
|
-
import { b as d, a as l, c as n, d as D, m as M, r as b, u as f, z as x } from "./internal/index-
|
|
9
|
+
import { b as d, a as l, c as n, d as D, m as M, r as b, u as f, z as x } from "./internal/index-sNi-u40H.js";
|
|
10
10
|
import "zod";
|
|
11
11
|
export {
|
|
12
12
|
d as Document,
|
package/dist/node/document.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./internal/object-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./internal/object-Nz1iEXFy.js"),r=require("./internal/index-aihhQ-ya.js");require("json-stringify-deterministic");require("immer");require("zod");require("jszip");require("crypto");require("fs");require("https");require("path");exports.BaseDocument=e.BaseDocument;exports.actions=e.BaseActions;exports.applyMixins=e.applyMixins;exports.baseReducer=e.baseReducer;exports.z=e.zod;exports.utils=r.index;
|