reactronic 0.22.109 → 0.22.202
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/README.md +18 -27
- package/build/dist/source/{Trace.d.ts → Logging.d.ts} +9 -9
- package/build/dist/source/{Trace.js → Logging.js} +25 -25
- package/build/dist/source/Options.d.ts +5 -5
- package/build/dist/source/Options.js +3 -3
- package/build/dist/source/Rx.d.ts +7 -7
- package/build/dist/source/Rx.js +6 -6
- package/build/dist/source/api.d.ts +1 -1
- package/build/dist/source/api.js +2 -2
- package/build/dist/source/impl/Data.js +1 -1
- package/build/dist/source/impl/Hooks.d.ts +6 -6
- package/build/dist/source/impl/Hooks.js +19 -21
- package/build/dist/source/impl/Operation.d.ts +2 -2
- package/build/dist/source/impl/Operation.js +109 -97
- package/build/dist/source/impl/Snapshot.d.ts +1 -1
- package/build/dist/source/impl/Snapshot.js +33 -33
- package/build/dist/source/impl/Transaction.js +12 -12
- package/build/dist/source/util/Dbg.d.ts +10 -10
- package/build/dist/source/util/Dbg.js +30 -30
- package/build/dist/source/util/Sealant.js +2 -2
- package/package.json +1 -1
|
@@ -65,16 +65,15 @@ class Snapshot {
|
|
|
65
65
|
let r = this.seekRevision(h, m);
|
|
66
66
|
const existing = r.data[m];
|
|
67
67
|
if (existing !== Data_1.Meta.Unobservable) {
|
|
68
|
-
this.
|
|
69
|
-
if (r.snapshot !== this) {
|
|
68
|
+
if (this.isNewRevisionRequired(h, r, m, existing, value, token)) {
|
|
70
69
|
const data = Object.assign({}, m === Data_1.Meta.Holder ? value : r.data);
|
|
71
70
|
Reflect.set(data, Data_1.Meta.Holder, h);
|
|
72
71
|
r = new Data_1.ObjectRevision(this, r, data);
|
|
73
72
|
this.changeset.set(h, r);
|
|
74
73
|
h.editing = r;
|
|
75
74
|
h.editors++;
|
|
76
|
-
if (Dbg_1.
|
|
77
|
-
Dbg_1.
|
|
75
|
+
if (Dbg_1.Log.isOn && Dbg_1.Log.opt.write)
|
|
76
|
+
Dbg_1.Log.write('║', ' ⎘', `${Dump.obj(h)} is cloned`);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
else
|
|
@@ -98,8 +97,8 @@ class Snapshot {
|
|
|
98
97
|
}
|
|
99
98
|
return r;
|
|
100
99
|
}
|
|
101
|
-
|
|
102
|
-
if (this.sealed)
|
|
100
|
+
isNewRevisionRequired(h, r, m, existing, value, token) {
|
|
101
|
+
if (this.sealed && r.snapshot !== exports.ROOT_REV.snapshot)
|
|
103
102
|
throw (0, Dbg_1.misuse)(`observable property ${Dump.obj(h, m)} can only be modified inside transaction`);
|
|
104
103
|
if (m !== Data_1.Meta.Holder && value !== Data_1.Meta.Holder) {
|
|
105
104
|
if (r.snapshot !== this || r.prev.revision !== exports.ROOT_REV) {
|
|
@@ -109,6 +108,7 @@ class Snapshot {
|
|
|
109
108
|
if (r === exports.ROOT_REV)
|
|
110
109
|
throw (0, Dbg_1.misuse)(`member ${Dump.rev(r, m)} doesn't exist in snapshot v${this.stamp} (${this.hint})`);
|
|
111
110
|
}
|
|
111
|
+
return r.snapshot !== this && !this.sealed;
|
|
112
112
|
}
|
|
113
113
|
acquire(outer) {
|
|
114
114
|
if (!this.sealed && this.stamp === exports.UNDEFINED_TIMESTAMP) {
|
|
@@ -117,8 +117,8 @@ class Snapshot {
|
|
|
117
117
|
Snapshot.pending.push(this);
|
|
118
118
|
if (Snapshot.oldest === undefined)
|
|
119
119
|
Snapshot.oldest = this;
|
|
120
|
-
if (Dbg_1.
|
|
121
|
-
Dbg_1.
|
|
120
|
+
if (Dbg_1.Log.isOn && Dbg_1.Log.opt.transaction)
|
|
121
|
+
Dbg_1.Log.write('╔══', `v${this.stamp}`, `${this.hint}`);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
bumpBy(timestamp) {
|
|
@@ -136,8 +136,8 @@ class Snapshot {
|
|
|
136
136
|
conflicts = [];
|
|
137
137
|
conflicts.push(r);
|
|
138
138
|
}
|
|
139
|
-
if (Dbg_1.
|
|
140
|
-
Dbg_1.
|
|
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
141
|
}
|
|
142
142
|
});
|
|
143
143
|
if (this.options.token === undefined) {
|
|
@@ -165,8 +165,8 @@ class Snapshot {
|
|
|
165
165
|
if (headDisposed || m === Data_1.Meta.Disposed) {
|
|
166
166
|
if (headDisposed !== (m === Data_1.Meta.Disposed)) {
|
|
167
167
|
if (headDisposed || this.options.standalone !== 'disposal') {
|
|
168
|
-
if (Dbg_1.
|
|
169
|
-
Dbg_1.
|
|
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
170
|
ours.conflicts.set(m, head);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -175,8 +175,8 @@ class Snapshot {
|
|
|
175
175
|
const conflict = Snapshot.isConflicting(head.data[m], ours.prev.revision.data[m]);
|
|
176
176
|
if (conflict)
|
|
177
177
|
ours.conflicts.set(m, head);
|
|
178
|
-
if (Dbg_1.
|
|
179
|
-
Dbg_1.
|
|
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
180
|
}
|
|
181
181
|
});
|
|
182
182
|
Utils_1.Utils.copyAllMembers(merged, ours.data);
|
|
@@ -199,17 +199,17 @@ class Snapshot {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
|
-
if (Dbg_1.
|
|
203
|
-
if (Dbg_1.
|
|
202
|
+
if (Dbg_1.Log.isOn) {
|
|
203
|
+
if (Dbg_1.Log.opt.change && !error) {
|
|
204
204
|
this.changeset.forEach((r, h) => {
|
|
205
205
|
const members = [];
|
|
206
206
|
r.changes.forEach((o, m) => members.push(m.toString()));
|
|
207
207
|
const s = members.join(', ');
|
|
208
|
-
Dbg_1.
|
|
208
|
+
Dbg_1.Log.write('║', '√', `${Dump.rev2(h, r.snapshot)} (${s}) is ${r.prev.revision === exports.ROOT_REV ? 'constructed' : `applied on top of ${Dump.rev2(h, r.prev.revision.snapshot)}`}`);
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
if (Dbg_1.
|
|
212
|
-
Dbg_1.
|
|
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
213
|
}
|
|
214
214
|
if (!error)
|
|
215
215
|
Snapshot.propagateAllChangesThroughSubscriptions(this);
|
|
@@ -221,7 +221,7 @@ class Snapshot {
|
|
|
221
221
|
else
|
|
222
222
|
for (const m in r.prev.revision.data)
|
|
223
223
|
r.data[m] = Data_1.Meta.Disposed;
|
|
224
|
-
if (Dbg_1.
|
|
224
|
+
if (Dbg_1.Log.isOn)
|
|
225
225
|
Snapshot.freezeObjectRevision(r);
|
|
226
226
|
}
|
|
227
227
|
static sealObservable(observable, m, typeName) {
|
|
@@ -254,18 +254,18 @@ class Snapshot {
|
|
|
254
254
|
Snapshot.oldest = Snapshot.pending[0];
|
|
255
255
|
const now = Date.now();
|
|
256
256
|
if (now - Snapshot.lastGarbageCollectionSummaryTimestamp > Snapshot.garbageCollectionSummaryInterval) {
|
|
257
|
-
Dbg_1.
|
|
257
|
+
Dbg_1.Log.write('', '[G]', `Total object/revision count: ${Snapshot.totalObjectHolderCount}/${Snapshot.totalObjectRevisionCount}`);
|
|
258
258
|
Snapshot.lastGarbageCollectionSummaryTimestamp = now;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
unlinkHistory() {
|
|
264
|
-
if (Dbg_1.
|
|
265
|
-
Dbg_1.
|
|
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
266
|
this.changeset.forEach((r, h) => {
|
|
267
|
-
if (Dbg_1.
|
|
268
|
-
Dbg_1.
|
|
267
|
+
if (Dbg_1.Log.isOn && Dbg_1.Log.opt.gc && r.prev.revision !== exports.ROOT_REV)
|
|
268
|
+
Dbg_1.Log.write(' ', ' ', `${Dump.rev2(h, r.prev.revision.snapshot)} is ready for GC because overwritten by ${Dump.rev2(h, r.snapshot)}`);
|
|
269
269
|
if (Snapshot.garbageCollectionSummaryInterval < Number.MAX_SAFE_INTEGER) {
|
|
270
270
|
if (r.prev.revision !== exports.ROOT_REV)
|
|
271
271
|
Snapshot.totalObjectRevisionCount--;
|
|
@@ -276,14 +276,14 @@ class Snapshot {
|
|
|
276
276
|
});
|
|
277
277
|
this.changeset = EMPTY_MAP;
|
|
278
278
|
this.reactions = EMPTY_ARRAY;
|
|
279
|
-
if (Dbg_1.
|
|
279
|
+
if (Dbg_1.Log.isOn)
|
|
280
280
|
Object.freeze(this);
|
|
281
281
|
}
|
|
282
282
|
static _init() {
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
const boot = exports.ROOT_REV.snapshot;
|
|
284
|
+
boot.acquire(boot);
|
|
285
|
+
boot.applyOrDiscard();
|
|
286
|
+
boot.triggerGarbageCollection();
|
|
287
287
|
Snapshot.freezeObjectRevision(exports.ROOT_REV);
|
|
288
288
|
Snapshot.idGen = 100;
|
|
289
289
|
Snapshot.stampGen = 101;
|
|
@@ -314,7 +314,7 @@ class Dump {
|
|
|
314
314
|
static obj(h, m, stamp, snapshotId, originSnapshotId, typeless) {
|
|
315
315
|
const member = m !== undefined ? `.${m.toString()}` : '';
|
|
316
316
|
return h === undefined
|
|
317
|
-
? `
|
|
317
|
+
? `boot${member}`
|
|
318
318
|
: stamp === undefined ? `${h.hint}${member} #${h.id}` : `${h.hint}${member} #${h.id}t${snapshotId}v${stamp}${originSnapshotId !== undefined && originSnapshotId !== 0 ? `t${originSnapshotId}` : ''}`;
|
|
319
319
|
}
|
|
320
320
|
static rev2(h, s, m, value) {
|
|
@@ -339,11 +339,11 @@ class Dump {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
exports.Dump = Dump;
|
|
342
|
-
exports.ROOT_REV = new Data_1.ObjectRevision(new Snapshot({ hint: 'root
|
|
342
|
+
exports.ROOT_REV = new Data_1.ObjectRevision(new Snapshot({ hint: '<root>' }), undefined, {});
|
|
343
343
|
exports.DefaultSnapshotOptions = Object.freeze({
|
|
344
344
|
hint: 'noname',
|
|
345
345
|
standalone: false,
|
|
346
346
|
journal: undefined,
|
|
347
|
-
|
|
347
|
+
logging: undefined,
|
|
348
348
|
token: undefined,
|
|
349
349
|
});
|
|
@@ -54,8 +54,8 @@ class TransactionImpl extends Transaction {
|
|
|
54
54
|
const restore = TransactionImpl.inspection;
|
|
55
55
|
try {
|
|
56
56
|
TransactionImpl.inspection = true;
|
|
57
|
-
if (Dbg_1.
|
|
58
|
-
Dbg_1.
|
|
57
|
+
if (Dbg_1.Log.isOn && Dbg_1.Log.opt.transaction)
|
|
58
|
+
Dbg_1.Log.write(' ', ' ', `T${this.id}[${this.hint}] is being inspected by T${TransactionImpl.curr.id}[${TransactionImpl.curr.hint}]`);
|
|
59
59
|
return this.runImpl(undefined, func, ...args);
|
|
60
60
|
}
|
|
61
61
|
finally {
|
|
@@ -119,7 +119,7 @@ class TransactionImpl extends Transaction {
|
|
|
119
119
|
const t = TransactionImpl.acquire(options);
|
|
120
120
|
const root = t !== TransactionImpl.curr;
|
|
121
121
|
t.guard();
|
|
122
|
-
let result = t.runImpl(options === null || options === void 0 ? void 0 : options.
|
|
122
|
+
let result = t.runImpl(options === null || options === void 0 ? void 0 : options.logging, func, ...args);
|
|
123
123
|
if (root) {
|
|
124
124
|
if (result instanceof Promise) {
|
|
125
125
|
result = TransactionImpl.off(() => {
|
|
@@ -181,7 +181,7 @@ class TransactionImpl extends Transaction {
|
|
|
181
181
|
const options = {
|
|
182
182
|
hint: `${this.hint} - restart after T${this.after.id}`,
|
|
183
183
|
standalone: this.options.standalone === 'isolated' ? 'isolated' : true,
|
|
184
|
-
|
|
184
|
+
logging: this.snapshot.options.logging,
|
|
185
185
|
token: this.snapshot.options.token,
|
|
186
186
|
};
|
|
187
187
|
return TransactionImpl.run(options, func, ...args);
|
|
@@ -201,7 +201,7 @@ class TransactionImpl extends Transaction {
|
|
|
201
201
|
return result;
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
runImpl(
|
|
204
|
+
runImpl(logging, func, ...args) {
|
|
205
205
|
let result;
|
|
206
206
|
const outer = TransactionImpl.curr;
|
|
207
207
|
try {
|
|
@@ -241,10 +241,10 @@ class TransactionImpl extends Transaction {
|
|
|
241
241
|
if (!t.canceled && error) {
|
|
242
242
|
t.canceled = error;
|
|
243
243
|
t.after = after;
|
|
244
|
-
if (Dbg_1.
|
|
245
|
-
Dbg_1.
|
|
244
|
+
if (Dbg_1.Log.isOn && Dbg_1.Log.opt.transaction) {
|
|
245
|
+
Dbg_1.Log.write('║', ' [!]', `${error.message}`, undefined, ' *** CANCEL ***');
|
|
246
246
|
if (after && after !== TransactionImpl.none)
|
|
247
|
-
Dbg_1.
|
|
247
|
+
Dbg_1.Log.write('║', ' [!]', `T${t.id}[${t.hint}] will be restarted${t !== after ? ` after T${after.id}[${after.hint}]` : ''}`);
|
|
248
248
|
}
|
|
249
249
|
Snapshot_1.Snapshot.revokeAllSubscriptions(t.snapshot);
|
|
250
250
|
}
|
|
@@ -261,8 +261,8 @@ class TransactionImpl extends Transaction {
|
|
|
261
261
|
applyOrDiscard() {
|
|
262
262
|
let reactions;
|
|
263
263
|
try {
|
|
264
|
-
if (Dbg_1.
|
|
265
|
-
Dbg_1.
|
|
264
|
+
if (Dbg_1.Log.isOn && Dbg_1.Log.opt.change)
|
|
265
|
+
Dbg_1.Log.write('╠═', '', '', undefined, 'changes');
|
|
266
266
|
reactions = this.snapshot.applyOrDiscard(this.canceled);
|
|
267
267
|
this.snapshot.triggerGarbageCollection();
|
|
268
268
|
if (this.promise) {
|
|
@@ -271,7 +271,7 @@ class TransactionImpl extends Transaction {
|
|
|
271
271
|
else
|
|
272
272
|
this.resolve();
|
|
273
273
|
}
|
|
274
|
-
if (Dbg_1.
|
|
274
|
+
if (Dbg_1.Log.isOn)
|
|
275
275
|
Object.freeze(this);
|
|
276
276
|
}
|
|
277
277
|
catch (e) {
|
|
@@ -305,7 +305,7 @@ class TransactionImpl extends Transaction {
|
|
|
305
305
|
Snapshot_1.Snapshot._init();
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
TransactionImpl.none = new TransactionImpl({ hint: '
|
|
308
|
+
TransactionImpl.none = new TransactionImpl({ hint: 'Transaction.off' });
|
|
309
309
|
TransactionImpl.curr = TransactionImpl.none;
|
|
310
310
|
TransactionImpl.inspection = false;
|
|
311
311
|
TransactionImpl.frameStartTime = 0;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggingOptions } from '../Logging';
|
|
2
2
|
export declare function error(message: string, dump: Error | undefined): Error;
|
|
3
3
|
export declare function misuse(message: string, dump?: any): Error;
|
|
4
4
|
export declare function fatal(error: Error): Error;
|
|
5
|
-
export declare class
|
|
6
|
-
static DefaultLevel:
|
|
5
|
+
export declare class Log {
|
|
6
|
+
static DefaultLevel: LoggingOptions;
|
|
7
7
|
static isOn: boolean;
|
|
8
|
-
static global:
|
|
9
|
-
static get
|
|
10
|
-
static
|
|
11
|
-
static
|
|
12
|
-
static
|
|
13
|
-
static
|
|
14
|
-
static merge(t: Partial<
|
|
8
|
+
static global: LoggingOptions;
|
|
9
|
+
static get opt(): LoggingOptions;
|
|
10
|
+
static getMergedLoggingOptions: (local: Partial<LoggingOptions> | undefined) => LoggingOptions;
|
|
11
|
+
static setMode(isOn: boolean, options?: LoggingOptions): void;
|
|
12
|
+
static write(bar: string, tran: string, message: string, ms?: number, highlight?: string | undefined, dump?: any): void;
|
|
13
|
+
static writeAs(options: Partial<LoggingOptions> | undefined, bar: string, tran: string, message: string, ms?: number, highlight?: string | undefined, dump?: any): void;
|
|
14
|
+
static merge(t: Partial<LoggingOptions> | undefined, color: number | undefined, prefix: string | undefined, existing: LoggingOptions): LoggingOptions;
|
|
15
15
|
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Log = exports.fatal = exports.misuse = exports.error = void 0;
|
|
4
4
|
function error(message, dump) {
|
|
5
|
-
if (
|
|
6
|
-
|
|
5
|
+
if (Log.isOn && Log.opt.error)
|
|
6
|
+
Log.write('█', ' ███', message, undefined, ' *** ERROR ***', dump);
|
|
7
7
|
return new Error(message);
|
|
8
8
|
}
|
|
9
9
|
exports.error = error;
|
|
10
10
|
function misuse(message, dump) {
|
|
11
11
|
const error = new Error(message);
|
|
12
|
-
|
|
12
|
+
Log.write(' ', ' ███', message, undefined, ' *** ERROR / MISUSE ***', dump !== null && dump !== void 0 ? dump : error);
|
|
13
13
|
return error;
|
|
14
14
|
}
|
|
15
15
|
exports.misuse = misuse;
|
|
16
16
|
function fatal(error) {
|
|
17
|
-
|
|
17
|
+
Log.write(' ', ' ███', error.message, undefined, ' *** FATAL ***', error);
|
|
18
18
|
return error;
|
|
19
19
|
}
|
|
20
20
|
exports.fatal = fatal;
|
|
21
|
-
class
|
|
22
|
-
static get
|
|
23
|
-
static
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Dbg.log('', '', 'Method-level trace can be configured with @options({ trace: ... }) decorator');
|
|
21
|
+
class Log {
|
|
22
|
+
static get opt() { return this.getMergedLoggingOptions(undefined); }
|
|
23
|
+
static setMode(isOn, options) {
|
|
24
|
+
Log.global = options || Log.DefaultLevel;
|
|
25
|
+
if (isOn) {
|
|
26
|
+
const t = Log.global;
|
|
27
|
+
const o = Object.keys(Log.global).filter(x => t[x] === true).join(', ');
|
|
28
|
+
Log.write('', '', `Reactronic logging is turned on: ${o}`);
|
|
29
|
+
Log.write('', '', 'Member-level logging can be configured with @options({ logging: ... }) decorator');
|
|
31
30
|
}
|
|
32
|
-
else
|
|
33
|
-
|
|
31
|
+
else if (Log.isOn)
|
|
32
|
+
Log.write('', '', 'Reactronic logging is turned off');
|
|
33
|
+
Log.isOn = isOn;
|
|
34
34
|
}
|
|
35
|
-
static
|
|
36
|
-
|
|
35
|
+
static write(bar, tran, message, ms = 0, highlight = undefined, dump) {
|
|
36
|
+
Log.writeAs(undefined, bar, tran, message, ms, highlight, dump);
|
|
37
37
|
}
|
|
38
|
-
static
|
|
39
|
-
const t =
|
|
38
|
+
static writeAs(options, bar, tran, message, ms = 0, highlight = undefined, dump) {
|
|
39
|
+
const t = Log.getMergedLoggingOptions(options);
|
|
40
40
|
const margin1 = ' '.repeat(t.margin1 >= 0 ? t.margin1 : 0);
|
|
41
41
|
const margin2 = ' '.repeat(t.margin2);
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
42
|
+
const enabled = (options && options.enabled !== undefined) ? options.enabled : t.enabled;
|
|
43
|
+
if (enabled) {
|
|
44
44
|
console.log('\x1b[37m%s\x1b[0m \x1b[' + t.color + 'm%s %s%s\x1b[0m \x1b[' + t.color + 'm%s%s\x1b[0m \x1b[' + t.color + 'm%s\x1b[0m%s', '', t.prefix, t.transaction ? margin1 : '', t.transaction ? bar : bar.replace(/./g, ' '), margin2, tran, message, (highlight !== undefined ? `${highlight}` : '') + (ms > 2 ? ` [ ${ms}ms ]` : ''));
|
|
45
45
|
if (dump)
|
|
46
46
|
console.log(dump);
|
|
@@ -48,7 +48,7 @@ class Dbg {
|
|
|
48
48
|
}
|
|
49
49
|
static merge(t, color, prefix, existing) {
|
|
50
50
|
const result = !t ? Object.assign({}, existing) : {
|
|
51
|
-
|
|
51
|
+
enabled: t.enabled !== undefined ? t.enabled : existing.enabled,
|
|
52
52
|
transaction: t.transaction !== undefined ? t.transaction : existing.transaction,
|
|
53
53
|
operation: t.operation !== undefined ? t.operation : existing.operation,
|
|
54
54
|
step: t.step !== undefined ? t.step : existing.step,
|
|
@@ -72,9 +72,9 @@ class Dbg {
|
|
|
72
72
|
return result;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
exports.
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
exports.Log = Log;
|
|
76
|
+
Log.DefaultLevel = {
|
|
77
|
+
enabled: true,
|
|
78
78
|
error: false,
|
|
79
79
|
warning: false,
|
|
80
80
|
transaction: false,
|
|
@@ -91,6 +91,6 @@ Dbg.DefaultLevel = {
|
|
|
91
91
|
margin1: 0,
|
|
92
92
|
margin2: 0,
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
Log.isOn = false;
|
|
95
|
+
Log.global = Log.DefaultLevel;
|
|
96
|
+
Log.getMergedLoggingOptions = (local) => Log.global;
|
|
@@ -8,8 +8,8 @@ class Sealant {
|
|
|
8
8
|
const createCopy = result[Sealant.CreateCopy];
|
|
9
9
|
if (createCopy)
|
|
10
10
|
result = createCopy.call(result);
|
|
11
|
-
if (Dbg_1.
|
|
12
|
-
Dbg_1.
|
|
11
|
+
if (Dbg_1.Log.isOn && Dbg_1.Log.opt.write)
|
|
12
|
+
Dbg_1.Log.write('║', ' ', `${typeName}.${member.toString()} - collection is sealed`);
|
|
13
13
|
Object.setPrototypeOf(result, sealedType);
|
|
14
14
|
Object.freeze(result);
|
|
15
15
|
return result;
|