reactronic 0.22.302 → 0.22.306

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 (45) hide show
  1. package/package.json +1 -1
  2. package/build/dist/source/Buffer.d.ts +0 -8
  3. package/build/dist/source/Buffer.js +0 -8
  4. package/build/dist/source/Controller.d.ts +0 -12
  5. package/build/dist/source/Controller.js +0 -6
  6. package/build/dist/source/Logging.d.ts +0 -38
  7. package/build/dist/source/Logging.js +0 -113
  8. package/build/dist/source/Options.d.ts +0 -38
  9. package/build/dist/source/Options.js +0 -21
  10. package/build/dist/source/Ref.d.ts +0 -34
  11. package/build/dist/source/Ref.js +0 -90
  12. package/build/dist/source/Rx.d.ts +0 -26
  13. package/build/dist/source/Rx.js +0 -57
  14. package/build/dist/source/Worker.d.ts +0 -8
  15. package/build/dist/source/Worker.js +0 -2
  16. package/build/dist/source/api.d.ts +0 -14
  17. package/build/dist/source/api.js +0 -40
  18. package/build/dist/source/impl/Data.d.ts +0 -58
  19. package/build/dist/source/impl/Data.js +0 -42
  20. package/build/dist/source/impl/Hooks.d.ts +0 -50
  21. package/build/dist/source/impl/Hooks.js +0 -241
  22. package/build/dist/source/impl/Journal.d.ts +0 -34
  23. package/build/dist/source/impl/Journal.js +0 -138
  24. package/build/dist/source/impl/Meta.d.ts +0 -13
  25. package/build/dist/source/impl/Meta.js +0 -33
  26. package/build/dist/source/impl/Monitor.d.ts +0 -32
  27. package/build/dist/source/impl/Monitor.js +0 -97
  28. package/build/dist/source/impl/Operation.d.ts +0 -93
  29. package/build/dist/source/impl/Operation.js +0 -721
  30. package/build/dist/source/impl/Snapshot.d.ts +0 -60
  31. package/build/dist/source/impl/Snapshot.js +0 -353
  32. package/build/dist/source/impl/Transaction.d.ts +0 -30
  33. package/build/dist/source/impl/Transaction.js +0 -313
  34. package/build/dist/source/util/Dbg.d.ts +0 -15
  35. package/build/dist/source/util/Dbg.js +0 -96
  36. package/build/dist/source/util/Sealant.d.ts +0 -14
  37. package/build/dist/source/util/Sealant.js +0 -30
  38. package/build/dist/source/util/SealedArray.d.ts +0 -16
  39. package/build/dist/source/util/SealedArray.js +0 -28
  40. package/build/dist/source/util/SealedMap.d.ts +0 -13
  41. package/build/dist/source/util/SealedMap.js +0 -21
  42. package/build/dist/source/util/SealedSet.d.ts +0 -13
  43. package/build/dist/source/util/SealedSet.js +0 -21
  44. package/build/dist/source/util/Utils.d.ts +0 -9
  45. package/build/dist/source/util/Utils.js +0 -62
@@ -1,60 +0,0 @@
1
- import { Kind, SnapshotOptions } from '../Options';
2
- import { AbstractSnapshot, DataRevision, MemberName, DataHolder, Subscription, Subscriber } from './Data';
3
- export declare const MAX_TIMESTAMP: number;
4
- export declare const UNDEFINED_TIMESTAMP: number;
5
- export declare class Snapshot implements AbstractSnapshot {
6
- static idGen: number;
7
- private static stampGen;
8
- private static pending;
9
- private static oldest;
10
- static garbageCollectionSummaryInterval: number;
11
- static lastGarbageCollectionSummaryTimestamp: number;
12
- static totalHolderCount: number;
13
- static totalRevisionCount: number;
14
- readonly id: number;
15
- readonly options: SnapshotOptions;
16
- get hint(): string;
17
- get timestamp(): number;
18
- private stamp;
19
- private bumper;
20
- changeset: Map<DataHolder, DataRevision>;
21
- reactions: Subscriber[];
22
- sealed: boolean;
23
- constructor(options: SnapshotOptions | null);
24
- static current: () => Snapshot;
25
- static edit: () => Snapshot;
26
- static markUsed: (subscription: Subscription, r: DataRevision, m: MemberName, h: DataHolder, kind: Kind, weak: boolean) => void;
27
- static markEdited: (oldValue: any, newValue: any, edited: boolean, r: DataRevision, m: MemberName, h: DataHolder) => void;
28
- static isConflicting: (oldValue: any, newValue: any) => boolean;
29
- static propagateAllChangesThroughSubscriptions: (snapshot: Snapshot) => void;
30
- static revokeAllSubscriptions: (snapshot: Snapshot) => void;
31
- static enqueueReactionsToRun: (reactions: Array<Subscriber>) => void;
32
- seekRevision(h: DataHolder, m: MemberName): DataRevision;
33
- getCurrentRevision(h: DataHolder, m: MemberName): DataRevision;
34
- getEditableRevision(h: DataHolder, m: MemberName, value: any, token?: any): DataRevision;
35
- static takeSnapshot<T>(obj: T): T;
36
- static dispose(obj: any): void;
37
- static doDispose(ctx: Snapshot, h: DataHolder): DataRevision;
38
- private isNewRevisionRequired;
39
- acquire(outer: Snapshot): void;
40
- bumpBy(timestamp: number): void;
41
- rebase(): DataRevision[] | undefined;
42
- private merge;
43
- applyOrDiscard(error?: any): Array<Subscriber>;
44
- static sealObjectRevision(h: DataHolder, r: DataRevision): void;
45
- static sealSubscription(subscription: Subscription | symbol, m: MemberName, typeName: string): void;
46
- static freezeObjectRevision(r: DataRevision): DataRevision;
47
- triggerGarbageCollection(): void;
48
- private unlinkHistory;
49
- static _init(): void;
50
- }
51
- export declare class Dump {
52
- static valueHint: (value: any, m?: PropertyKey | undefined) => string;
53
- static obj(h: DataHolder | undefined, m?: MemberName | undefined, stamp?: number, snapshotId?: number, originSnapshotId?: number, value?: any): string;
54
- static rev2(h: DataHolder, s: AbstractSnapshot, m?: MemberName, o?: Subscription): string;
55
- static rev(r: DataRevision, m?: MemberName): string;
56
- static conflicts(conflicts: DataRevision[]): string;
57
- static conflictingMemberHint(m: MemberName, ours: DataRevision, theirs: DataRevision): string;
58
- }
59
- export declare const ROOT_REV: DataRevision;
60
- export declare const DefaultSnapshotOptions: SnapshotOptions;
@@ -1,353 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultSnapshotOptions = exports.ROOT_REV = exports.Dump = exports.Snapshot = exports.UNDEFINED_TIMESTAMP = exports.MAX_TIMESTAMP = void 0;
4
- const Utils_1 = require("../util/Utils");
5
- const Dbg_1 = require("../util/Dbg");
6
- const Sealant_1 = require("../util/Sealant");
7
- const SealedArray_1 = require("../util/SealedArray");
8
- const SealedMap_1 = require("../util/SealedMap");
9
- const SealedSet_1 = require("../util/SealedSet");
10
- const Data_1 = require("./Data");
11
- exports.MAX_TIMESTAMP = Number.MAX_SAFE_INTEGER;
12
- exports.UNDEFINED_TIMESTAMP = exports.MAX_TIMESTAMP - 1;
13
- Object.defineProperty(Data_1.DataHolder.prototype, '#this', {
14
- configurable: false, enumerable: false,
15
- get() {
16
- const result = {};
17
- const data = Snapshot.current().getCurrentRevision(this, '#this').data;
18
- for (const m in data) {
19
- const v = data[m];
20
- if (v instanceof Data_1.Subscription)
21
- result[m] = v.content;
22
- else if (v === Data_1.Meta.Nonreactive)
23
- result[m] = this.data[m];
24
- else
25
- result[m] = v;
26
- }
27
- return result;
28
- },
29
- });
30
- const EMPTY_ARRAY = Object.freeze([]);
31
- const EMPTY_MAP = Utils_1.Utils.freezeMap(new Map());
32
- class Snapshot {
33
- constructor(options) {
34
- this.id = ++Snapshot.idGen;
35
- this.options = options !== null && options !== void 0 ? options : exports.DefaultSnapshotOptions;
36
- this.stamp = exports.UNDEFINED_TIMESTAMP;
37
- this.bumper = 100;
38
- this.changeset = new Map();
39
- this.reactions = [];
40
- this.sealed = false;
41
- }
42
- get hint() { var _a; return (_a = this.options.hint) !== null && _a !== void 0 ? _a : 'noname'; }
43
- get timestamp() { return this.stamp; }
44
- seekRevision(h, m) {
45
- let r = h.editing;
46
- if (r && r.snapshot !== this) {
47
- r = this.changeset.get(h);
48
- if (r)
49
- h.editing = r;
50
- }
51
- if (!r) {
52
- r = h.head;
53
- while (r !== exports.ROOT_REV && r.snapshot.timestamp > this.timestamp)
54
- r = r.former.revision;
55
- }
56
- return r;
57
- }
58
- getCurrentRevision(h, m) {
59
- const r = this.seekRevision(h, m);
60
- if (r === exports.ROOT_REV)
61
- throw (0, Dbg_1.misuse)(`object ${Dump.obj(h)} doesn't exist in snapshot v${this.stamp} (${this.hint})`);
62
- return r;
63
- }
64
- getEditableRevision(h, m, value, token) {
65
- let r = this.seekRevision(h, m);
66
- const existing = r.data[m];
67
- if (existing !== Data_1.Meta.Nonreactive) {
68
- if (this.isNewRevisionRequired(h, r, m, existing, value, token)) {
69
- const data = Object.assign({}, m === Data_1.Meta.Holder ? value : r.data);
70
- Reflect.set(data, Data_1.Meta.Holder, h);
71
- r = new Data_1.DataRevision(this, r, data);
72
- this.changeset.set(h, r);
73
- h.editing = r;
74
- h.editors++;
75
- if (Dbg_1.Log.isOn && Dbg_1.Log.opt.write)
76
- Dbg_1.Log.write('║', ' ⎘', `${Dump.obj(h)} is cloned`);
77
- }
78
- }
79
- else
80
- r = exports.ROOT_REV;
81
- return r;
82
- }
83
- static takeSnapshot(obj) {
84
- return obj[Data_1.Meta.Holder]['#this'];
85
- }
86
- static dispose(obj) {
87
- const ctx = Snapshot.edit();
88
- const h = Data_1.Meta.get(obj, Data_1.Meta.Holder);
89
- if (h !== undefined)
90
- Snapshot.doDispose(ctx, h);
91
- }
92
- static doDispose(ctx, h) {
93
- const r = ctx.getEditableRevision(h, Data_1.Meta.Disposed, Data_1.Meta.Disposed);
94
- if (r !== exports.ROOT_REV) {
95
- r.data[Data_1.Meta.Disposed] = Data_1.Meta.Disposed;
96
- Snapshot.markEdited(Data_1.Meta.Disposed, Data_1.Meta.Disposed, true, r, Data_1.Meta.Disposed, h);
97
- }
98
- return r;
99
- }
100
- isNewRevisionRequired(h, r, m, existing, value, token) {
101
- if (this.sealed && r.snapshot !== exports.ROOT_REV.snapshot)
102
- throw (0, Dbg_1.misuse)(`reactive property ${Dump.obj(h, m)} can only be modified inside transaction`);
103
- if (m !== Data_1.Meta.Holder && value !== Data_1.Meta.Holder) {
104
- if (r.snapshot !== this || r.former.revision !== exports.ROOT_REV) {
105
- if (this.options.token !== undefined && token !== this.options.token)
106
- throw (0, Dbg_1.misuse)(`${this.hint} should not have side effects (trying to change ${Dump.rev(r, m)})`);
107
- }
108
- if (r === exports.ROOT_REV)
109
- throw (0, Dbg_1.misuse)(`member ${Dump.rev(r, m)} doesn't exist in snapshot v${this.stamp} (${this.hint})`);
110
- }
111
- return r.snapshot !== this && !this.sealed;
112
- }
113
- acquire(outer) {
114
- if (!this.sealed && this.stamp === exports.UNDEFINED_TIMESTAMP) {
115
- const ahead = this.options.token === undefined || outer.stamp === exports.UNDEFINED_TIMESTAMP;
116
- this.stamp = ahead ? Snapshot.stampGen : outer.stamp;
117
- Snapshot.pending.push(this);
118
- if (Snapshot.oldest === undefined)
119
- Snapshot.oldest = this;
120
- if (Dbg_1.Log.isOn && Dbg_1.Log.opt.transaction)
121
- Dbg_1.Log.write('╔══', `v${this.stamp}`, `${this.hint}`);
122
- }
123
- }
124
- bumpBy(timestamp) {
125
- if (timestamp > this.bumper)
126
- this.bumper = timestamp;
127
- }
128
- rebase() {
129
- let conflicts = undefined;
130
- if (this.changeset.size > 0) {
131
- this.changeset.forEach((r, h) => {
132
- if (r.former.revision !== h.head) {
133
- const merged = this.merge(h, r);
134
- if (r.conflicts.size > 0) {
135
- if (!conflicts)
136
- conflicts = [];
137
- conflicts.push(r);
138
- }
139
- if (Dbg_1.Log.isOn && Dbg_1.Log.opt.transaction)
140
- Dbg_1.Log.write('╠╝', '', `${Dump.rev2(h, r.snapshot)} is merged with ${Dump.rev2(h, h.head.snapshot)} among ${merged} properties with ${r.conflicts.size} conflicts.`);
141
- }
142
- });
143
- if (this.options.token === undefined) {
144
- if (this.bumper > 100) {
145
- this.bumper = this.stamp;
146
- this.stamp = ++Snapshot.stampGen;
147
- }
148
- else
149
- this.stamp = this.bumper + 1;
150
- }
151
- else {
152
- this.stamp = this.bumper;
153
- }
154
- }
155
- return conflicts;
156
- }
157
- merge(h, ours) {
158
- let counter = 0;
159
- const head = h.head;
160
- const headDisposed = head.changes.has(Data_1.Meta.Disposed);
161
- const merged = Object.assign({}, head.data);
162
- ours.changes.forEach((o, m) => {
163
- counter++;
164
- merged[m] = ours.data[m];
165
- if (headDisposed || m === Data_1.Meta.Disposed) {
166
- if (headDisposed !== (m === Data_1.Meta.Disposed)) {
167
- if (headDisposed || this.options.standalone !== 'disposal') {
168
- if (Dbg_1.Log.isOn && Dbg_1.Log.opt.change)
169
- Dbg_1.Log.write('║╠', '', `${Dump.rev2(h, ours.snapshot, m)} <> ${Dump.rev2(h, head.snapshot, m)}`, 0, ' *** CONFLICT ***');
170
- ours.conflicts.set(m, head);
171
- }
172
- }
173
- }
174
- else {
175
- const conflict = Snapshot.isConflicting(head.data[m], ours.former.revision.data[m]);
176
- if (conflict)
177
- ours.conflicts.set(m, head);
178
- if (Dbg_1.Log.isOn && Dbg_1.Log.opt.change)
179
- Dbg_1.Log.write('║╠', '', `${Dump.rev2(h, ours.snapshot, m)} ${conflict ? '<>' : '=='} ${Dump.rev2(h, head.snapshot, m)}`, 0, conflict ? ' *** CONFLICT ***' : undefined);
180
- }
181
- });
182
- Utils_1.Utils.copyAllMembers(merged, ours.data);
183
- ours.former.revision = head;
184
- return counter;
185
- }
186
- applyOrDiscard(error) {
187
- this.sealed = true;
188
- this.changeset.forEach((r, h) => {
189
- Snapshot.sealObjectRevision(h, r);
190
- h.editors--;
191
- if (h.editors === 0)
192
- h.editing = undefined;
193
- if (!error) {
194
- h.head = r;
195
- if (Snapshot.garbageCollectionSummaryInterval < Number.MAX_SAFE_INTEGER) {
196
- Snapshot.totalRevisionCount++;
197
- if (r.former.revision === exports.ROOT_REV)
198
- Snapshot.totalHolderCount++;
199
- }
200
- }
201
- });
202
- if (Dbg_1.Log.isOn) {
203
- if (Dbg_1.Log.opt.change && !error) {
204
- this.changeset.forEach((r, h) => {
205
- const members = [];
206
- r.changes.forEach((o, m) => members.push(m.toString()));
207
- const s = members.join(', ');
208
- Dbg_1.Log.write('║', '√', `${Dump.rev2(h, r.snapshot)} (${s}) is ${r.former.revision === exports.ROOT_REV ? 'constructed' : `applied on top of ${Dump.rev2(h, r.former.revision.snapshot)}`}`);
209
- });
210
- }
211
- if (Dbg_1.Log.opt.transaction)
212
- Dbg_1.Log.write(this.stamp < exports.UNDEFINED_TIMESTAMP ? '╚══' : '═══', `v${this.stamp}`, `${this.hint} - ${error ? 'CANCEL' : 'APPLY'}(${this.changeset.size})${error ? ` - ${error}` : ''}`);
213
- }
214
- if (!error)
215
- Snapshot.propagateAllChangesThroughSubscriptions(this);
216
- return this.reactions;
217
- }
218
- static sealObjectRevision(h, r) {
219
- if (!r.changes.has(Data_1.Meta.Disposed))
220
- r.changes.forEach((o, m) => Snapshot.sealSubscription(r.data[m], m, h.proxy.constructor.name));
221
- else
222
- for (const m in r.former.revision.data)
223
- r.data[m] = Data_1.Meta.Disposed;
224
- if (Dbg_1.Log.isOn)
225
- Snapshot.freezeObjectRevision(r);
226
- }
227
- static sealSubscription(subscription, m, typeName) {
228
- if (subscription instanceof Data_1.Subscription) {
229
- const value = subscription.content;
230
- if (value !== undefined && value !== null) {
231
- const sealedType = Object.getPrototypeOf(value)[Sealant_1.Sealant.SealedType];
232
- if (sealedType)
233
- subscription.content = Sealant_1.Sealant.seal(value, sealedType, typeName, m);
234
- }
235
- }
236
- }
237
- static freezeObjectRevision(r) {
238
- Object.freeze(r.data);
239
- Utils_1.Utils.freezeSet(r.changes);
240
- Utils_1.Utils.freezeMap(r.conflicts);
241
- return r;
242
- }
243
- triggerGarbageCollection() {
244
- if (this.stamp !== 0) {
245
- if (this === Snapshot.oldest) {
246
- const p = Snapshot.pending;
247
- p.sort((a, b) => a.stamp - b.stamp);
248
- let i = 0;
249
- while (i < p.length && p[i].sealed) {
250
- p[i].unlinkHistory();
251
- i++;
252
- }
253
- Snapshot.pending = p.slice(i);
254
- Snapshot.oldest = Snapshot.pending[0];
255
- const now = Date.now();
256
- if (now - Snapshot.lastGarbageCollectionSummaryTimestamp > Snapshot.garbageCollectionSummaryInterval) {
257
- Dbg_1.Log.write('', '[G]', `Total object/revision count: ${Snapshot.totalHolderCount}/${Snapshot.totalRevisionCount}`);
258
- Snapshot.lastGarbageCollectionSummaryTimestamp = now;
259
- }
260
- }
261
- }
262
- }
263
- unlinkHistory() {
264
- if (Dbg_1.Log.isOn && Dbg_1.Log.opt.gc)
265
- Dbg_1.Log.write('', '[G]', `Dismiss history below v${this.stamp}t${this.id} (${this.hint})`);
266
- this.changeset.forEach((r, h) => {
267
- if (Dbg_1.Log.isOn && Dbg_1.Log.opt.gc && r.former.revision !== exports.ROOT_REV)
268
- Dbg_1.Log.write(' ', ' ', `${Dump.rev2(h, r.former.revision.snapshot)} is ready for GC because overwritten by ${Dump.rev2(h, r.snapshot)}`);
269
- if (Snapshot.garbageCollectionSummaryInterval < Number.MAX_SAFE_INTEGER) {
270
- if (r.former.revision !== exports.ROOT_REV)
271
- Snapshot.totalRevisionCount--;
272
- if (r.changes.has(Data_1.Meta.Disposed))
273
- Snapshot.totalHolderCount--;
274
- }
275
- r.former.revision = exports.ROOT_REV;
276
- });
277
- this.changeset = EMPTY_MAP;
278
- this.reactions = EMPTY_ARRAY;
279
- if (Dbg_1.Log.isOn)
280
- Object.freeze(this);
281
- }
282
- static _init() {
283
- const boot = exports.ROOT_REV.snapshot;
284
- boot.acquire(boot);
285
- boot.applyOrDiscard();
286
- boot.triggerGarbageCollection();
287
- Snapshot.freezeObjectRevision(exports.ROOT_REV);
288
- Snapshot.idGen = 100;
289
- Snapshot.stampGen = 101;
290
- Snapshot.oldest = undefined;
291
- SealedArray_1.SealedArray.prototype;
292
- SealedMap_1.SealedMap.prototype;
293
- SealedSet_1.SealedSet.prototype;
294
- }
295
- }
296
- exports.Snapshot = Snapshot;
297
- Snapshot.idGen = -1;
298
- Snapshot.stampGen = 1;
299
- Snapshot.pending = [];
300
- Snapshot.oldest = undefined;
301
- Snapshot.garbageCollectionSummaryInterval = Number.MAX_SAFE_INTEGER;
302
- Snapshot.lastGarbageCollectionSummaryTimestamp = Date.now();
303
- Snapshot.totalHolderCount = 0;
304
- Snapshot.totalRevisionCount = 0;
305
- Snapshot.current = Utils_1.UNDEF;
306
- Snapshot.edit = Utils_1.UNDEF;
307
- Snapshot.markUsed = Utils_1.UNDEF;
308
- Snapshot.markEdited = Utils_1.UNDEF;
309
- Snapshot.isConflicting = Utils_1.UNDEF;
310
- Snapshot.propagateAllChangesThroughSubscriptions = (snapshot) => { };
311
- Snapshot.revokeAllSubscriptions = (snapshot) => { };
312
- Snapshot.enqueueReactionsToRun = (reactions) => { };
313
- class Dump {
314
- static obj(h, m, stamp, snapshotId, originSnapshotId, value) {
315
- const member = m !== undefined ? `.${m.toString()}` : '';
316
- return h === undefined
317
- ? `boot${member}`
318
- : stamp === undefined
319
- ? `${h.hint}${member}${value !== undefined ? `[=${Dump.valueHint(value)}]` : ''} #${h.id}`
320
- : `${h.hint}${member}${value !== undefined ? `[=${Dump.valueHint(value)}]` : ''} #${h.id}t${snapshotId}v${stamp}${originSnapshotId !== undefined && originSnapshotId !== 0 ? `t${originSnapshotId}` : ''}`;
321
- }
322
- static rev2(h, s, m, o) {
323
- var _a;
324
- return Dump.obj(h, m, s.timestamp, s.id, o === null || o === void 0 ? void 0 : o.originSnapshotId, (_a = o === null || o === void 0 ? void 0 : o.content) !== null && _a !== void 0 ? _a : Data_1.Meta.Undefined);
325
- }
326
- static rev(r, m) {
327
- const h = Data_1.Meta.get(r.data, Data_1.Meta.Holder);
328
- const value = m !== undefined ? r.data[m] : undefined;
329
- return Dump.obj(h, m, r.snapshot.timestamp, r.snapshot.id, value === null || value === void 0 ? void 0 : value.originSnapshotId);
330
- }
331
- static conflicts(conflicts) {
332
- return conflicts.map(ours => {
333
- const items = [];
334
- ours.conflicts.forEach((theirs, m) => {
335
- items.push(Dump.conflictingMemberHint(m, ours, theirs));
336
- });
337
- return items.join(', ');
338
- }).join(', ');
339
- }
340
- static conflictingMemberHint(m, ours, theirs) {
341
- return `${theirs.snapshot.hint} (${Dump.rev(theirs, m)})`;
342
- }
343
- }
344
- exports.Dump = Dump;
345
- Dump.valueHint = (value, m) => '???';
346
- exports.ROOT_REV = new Data_1.DataRevision(new Snapshot({ hint: '<root>' }), undefined, {});
347
- exports.DefaultSnapshotOptions = Object.freeze({
348
- hint: 'noname',
349
- standalone: false,
350
- journal: undefined,
351
- logging: undefined,
352
- token: undefined,
353
- });
@@ -1,30 +0,0 @@
1
- import { F } from '../util/Utils';
2
- import { Worker } from '../Worker';
3
- import { SnapshotOptions } from '../Options';
4
- import { Snapshot } from './Snapshot';
5
- export declare abstract class Transaction implements Worker {
6
- static get current(): Transaction;
7
- abstract readonly id: number;
8
- abstract readonly hint: string;
9
- abstract readonly options: SnapshotOptions;
10
- abstract readonly timestamp: number;
11
- abstract readonly error: Error | undefined;
12
- abstract readonly snapshot: Snapshot;
13
- abstract readonly margin: number;
14
- abstract run<T>(func: F<T>, ...args: any[]): T;
15
- abstract inspect<T>(func: F<T>, ...args: any[]): T;
16
- abstract apply(): void;
17
- abstract seal(): this;
18
- abstract wrap<T>(func: F<T>, secondary: boolean): F<T>;
19
- abstract cancel(error: Error, retryAfterOrIgnore?: Worker | null): this;
20
- abstract readonly isCanceled: boolean;
21
- abstract readonly isFinished: boolean;
22
- whenFinished(): Promise<void>;
23
- static create(options: SnapshotOptions | null): Transaction;
24
- static run<T>(options: SnapshotOptions | null, func: F<T>, ...args: any[]): T;
25
- static standalone<T>(func: F<T>, ...args: any[]): T;
26
- static off<T>(func: F<T>, ...args: any[]): T;
27
- static isFrameOver(everyN?: number, timeLimit?: number): boolean;
28
- static requestNextFrame(sleepTime?: number): Promise<void>;
29
- static get isCanceled(): boolean;
30
- }