@mlightcad/data-model 1.9.10 → 1.9.11
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/data-model.cjs +7 -7
- package/lib/base/AcDbObject.d.ts +54 -0
- package/lib/base/AcDbObject.d.ts.map +1 -1
- package/lib/base/AcDbObject.js +200 -21
- package/lib/base/AcDbObject.js.map +1 -1
- package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -1
- package/lib/database/AcDbBlockTableRecord.js +61 -15
- package/lib/database/AcDbBlockTableRecord.js.map +1 -1
- package/lib/database/AcDbDatabase.d.ts +86 -4
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +366 -62
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/database/AcDbSymbolTable.d.ts +9 -0
- package/lib/database/AcDbSymbolTable.d.ts.map +1 -1
- package/lib/database/AcDbSymbolTable.js +34 -4
- package/lib/database/AcDbSymbolTable.js.map +1 -1
- package/lib/database/AcDbSysVarManager.d.ts +13 -0
- package/lib/database/AcDbSysVarManager.d.ts.map +1 -1
- package/lib/database/AcDbSysVarManager.js +43 -11
- package/lib/database/AcDbSysVarManager.js.map +1 -1
- package/lib/database/index.d.ts +2 -0
- package/lib/database/index.d.ts.map +1 -1
- package/lib/database/index.js +1 -0
- package/lib/database/index.js.map +1 -1
- package/lib/database/transaction/AcDbChangeApplier.d.ts +118 -0
- package/lib/database/transaction/AcDbChangeApplier.d.ts.map +1 -0
- package/lib/database/transaction/AcDbChangeApplier.js +310 -0
- package/lib/database/transaction/AcDbChangeApplier.js.map +1 -0
- package/lib/database/transaction/AcDbChangeRecorder.d.ts +113 -0
- package/lib/database/transaction/AcDbChangeRecorder.d.ts.map +1 -0
- package/lib/database/transaction/AcDbChangeRecorder.js +235 -0
- package/lib/database/transaction/AcDbChangeRecorder.js.map +1 -0
- package/lib/database/transaction/AcDbDatabaseChange.d.ts +67 -0
- package/lib/database/transaction/AcDbDatabaseChange.d.ts.map +1 -0
- package/lib/database/transaction/AcDbDatabaseChange.js +23 -0
- package/lib/database/transaction/AcDbDatabaseChange.js.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.d.ts +26 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.d.ts.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.js +51 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.js.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.d.ts +188 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.d.ts.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.js +594 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.js.map +1 -0
- package/lib/database/transaction/AcDbTransaction.d.ts +7 -0
- package/lib/database/transaction/AcDbTransaction.d.ts.map +1 -1
- package/lib/database/transaction/AcDbTransaction.js +20 -10
- package/lib/database/transaction/AcDbTransaction.js.map +1 -1
- package/lib/database/transaction/AcDbTransactionManager.d.ts +3 -4
- package/lib/database/transaction/AcDbTransactionManager.d.ts.map +1 -1
- package/lib/database/transaction/AcDbTransactionManager.js +3 -4
- package/lib/database/transaction/AcDbTransactionManager.js.map +1 -1
- package/lib/database/transaction/AcDbUndoRecord.d.ts +11 -0
- package/lib/database/transaction/AcDbUndoRecord.d.ts.map +1 -0
- package/lib/database/transaction/AcDbUndoRecord.js +2 -0
- package/lib/database/transaction/AcDbUndoRecord.js.map +1 -0
- package/lib/database/transaction/AcDbUndoStack.d.ts +52 -0
- package/lib/database/transaction/AcDbUndoStack.d.ts.map +1 -0
- package/lib/database/transaction/AcDbUndoStack.js +74 -0
- package/lib/database/transaction/AcDbUndoStack.js.map +1 -0
- package/lib/database/transaction/index.d.ts +9 -0
- package/lib/database/transaction/index.d.ts.map +1 -1
- package/lib/database/transaction/index.js +6 -0
- package/lib/database/transaction/index.js.map +1 -1
- package/lib/entity/AcDbEntity.js +4 -4
- package/lib/entity/AcDbEntity.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/object/AcDbDictionary.d.ts +11 -0
- package/lib/object/AcDbDictionary.d.ts.map +1 -1
- package/lib/object/AcDbDictionary.js +65 -20
- package/lib/object/AcDbDictionary.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
var __values = (this && this.__values) || function(o) {
|
|
27
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
28
|
+
if (m) return m.call(o);
|
|
29
|
+
if (o && typeof o.length === "number") return {
|
|
30
|
+
next: function () {
|
|
31
|
+
if (o && i >= o.length) o = void 0;
|
|
32
|
+
return { value: o && o[i++], done: !o };
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
36
|
+
};
|
|
37
|
+
import { AcDbSysVarManager } from '../AcDbSysVarManager';
|
|
38
|
+
import { AcDbChangeApplier, collectChangeEntities, collectDictionaryChanges } from './AcDbChangeApplier';
|
|
39
|
+
import { AcDbDatabaseTransaction } from './AcDbDatabaseTransaction';
|
|
40
|
+
import { AcDbUndoStack } from './AcDbUndoStack';
|
|
41
|
+
/**
|
|
42
|
+
* Manages database transactions and undo/redo history for one {@link AcDbDatabase}.
|
|
43
|
+
*
|
|
44
|
+
* Aligns with ObjectARX {@code AcDbTransactionManager} semantics and provides
|
|
45
|
+
* undo mark grouping for editor commands.
|
|
46
|
+
*/
|
|
47
|
+
var AcDbDatabaseTransactionManager = /** @class */ (function () {
|
|
48
|
+
/**
|
|
49
|
+
* Creates a transaction manager for one database.
|
|
50
|
+
*
|
|
51
|
+
* @param database - Database whose mutations and undo history are managed
|
|
52
|
+
*/
|
|
53
|
+
function AcDbDatabaseTransactionManager(database) {
|
|
54
|
+
this.database = database;
|
|
55
|
+
this.transactionStack = [];
|
|
56
|
+
this.undoStack = new AcDbUndoStack();
|
|
57
|
+
this.undoMarkStack = [];
|
|
58
|
+
this._applyingUndoRedo = false;
|
|
59
|
+
/**
|
|
60
|
+
* When true, mutations outside an active transaction throw an error.
|
|
61
|
+
*
|
|
62
|
+
* Undo/redo replay is exempt so {@link AcDbChangeApplier} can restore state.
|
|
63
|
+
*/
|
|
64
|
+
this.strictMode = false;
|
|
65
|
+
this.changeApplier = new AcDbChangeApplier(database);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Starts a new database transaction and pushes it onto the stack.
|
|
69
|
+
*
|
|
70
|
+
* Equivalent to ObjectARX `AcDbTransactionManager::startTransaction()`.
|
|
71
|
+
*
|
|
72
|
+
* @returns The newly created transaction
|
|
73
|
+
*/
|
|
74
|
+
AcDbDatabaseTransactionManager.prototype.startTransaction = function () {
|
|
75
|
+
var tr = new AcDbDatabaseTransaction(this.database);
|
|
76
|
+
this.transactionStack.push(tr);
|
|
77
|
+
return tr;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Returns the top-most active transaction, if any.
|
|
81
|
+
*/
|
|
82
|
+
AcDbDatabaseTransactionManager.prototype.currentTransaction = function () {
|
|
83
|
+
return this.transactionStack[this.transactionStack.length - 1];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Returns true when at least one transaction is active.
|
|
87
|
+
*/
|
|
88
|
+
AcDbDatabaseTransactionManager.prototype.hasTransaction = function () {
|
|
89
|
+
return this.transactionStack.length > 0;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Returns true when mutations should be recorded into the current transaction.
|
|
93
|
+
*
|
|
94
|
+
* Recording is disabled while undo/redo is being applied.
|
|
95
|
+
*/
|
|
96
|
+
AcDbDatabaseTransactionManager.prototype.isRecording = function () {
|
|
97
|
+
return this.hasTransaction() && !this._applyingUndoRedo;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Returns true while {@link AcDbChangeApplier} is replaying undo or redo changes.
|
|
101
|
+
*/
|
|
102
|
+
AcDbDatabaseTransactionManager.prototype.isApplyingUndoRedo = function () {
|
|
103
|
+
return this._applyingUndoRedo;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Commits the current transaction.
|
|
107
|
+
*
|
|
108
|
+
* Nested transactions merge their recorder into the parent. The outermost
|
|
109
|
+
* commit finalizes changes, dispatches events, and enqueues undo history
|
|
110
|
+
* when an undo mark is active.
|
|
111
|
+
*
|
|
112
|
+
* @throws Error if no transaction is active
|
|
113
|
+
*/
|
|
114
|
+
AcDbDatabaseTransactionManager.prototype.commitTransaction = function () {
|
|
115
|
+
var tr = this.transactionStack.pop();
|
|
116
|
+
if (!tr) {
|
|
117
|
+
throw new Error('No active transaction to commit.');
|
|
118
|
+
}
|
|
119
|
+
if (this.transactionStack.length > 0) {
|
|
120
|
+
var parent_1 = this.transactionStack[this.transactionStack.length - 1];
|
|
121
|
+
parent_1.recorder.mergeFrom(tr.recorder);
|
|
122
|
+
tr.commit();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
tr.recorder.finalize(this.database);
|
|
126
|
+
var changes = tr.recorder.getChanges();
|
|
127
|
+
tr.commit();
|
|
128
|
+
if (changes.length > 0) {
|
|
129
|
+
this.dispatchCommitEvents(changes);
|
|
130
|
+
this.enqueueUndoChanges(changes);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Aborts the current transaction and rolls back all recorded changes.
|
|
135
|
+
*
|
|
136
|
+
* @throws Error if no transaction is active
|
|
137
|
+
*/
|
|
138
|
+
AcDbDatabaseTransactionManager.prototype.abortTransaction = function () {
|
|
139
|
+
var tr = this.transactionStack.pop();
|
|
140
|
+
if (!tr) {
|
|
141
|
+
throw new Error('No active transaction to abort.');
|
|
142
|
+
}
|
|
143
|
+
var changes = __spreadArray([], __read(tr.recorder.getChanges()), false);
|
|
144
|
+
this.database.beginEventBatch();
|
|
145
|
+
this._applyingUndoRedo = true;
|
|
146
|
+
try {
|
|
147
|
+
tr.abort();
|
|
148
|
+
if (changes.length > 0) {
|
|
149
|
+
this.changeApplier.applyInverse(changes);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
this._applyingUndoRedo = false;
|
|
154
|
+
this.database.endEventBatch();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Opens an undo-mark group.
|
|
159
|
+
*
|
|
160
|
+
* Commits performed before {@link endUndoMark} are merged into one
|
|
161
|
+
* {@link AcDbUndoRecord}.
|
|
162
|
+
*
|
|
163
|
+
* @param label - Optional label for undo UI (for example, `"Move"`)
|
|
164
|
+
*/
|
|
165
|
+
AcDbDatabaseTransactionManager.prototype.startUndoMark = function (label) {
|
|
166
|
+
this.undoMarkStack.push({ label: label, pendingChanges: [] });
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Closes the current undo mark and pushes a record when changes were committed.
|
|
170
|
+
*
|
|
171
|
+
* @throws Error if no undo mark is active
|
|
172
|
+
*/
|
|
173
|
+
AcDbDatabaseTransactionManager.prototype.endUndoMark = function () {
|
|
174
|
+
var mark = this.undoMarkStack.pop();
|
|
175
|
+
if (!mark) {
|
|
176
|
+
throw new Error('No active undo mark to end.');
|
|
177
|
+
}
|
|
178
|
+
if (mark.pendingChanges.length === 0) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.undoStack.push({
|
|
182
|
+
label: mark.label,
|
|
183
|
+
changes: mark.pendingChanges
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Discards the current undo mark without creating an undo record.
|
|
188
|
+
*/
|
|
189
|
+
AcDbDatabaseTransactionManager.prototype.cancelUndoMark = function () {
|
|
190
|
+
if (this.undoMarkStack.length > 0) {
|
|
191
|
+
this.undoMarkStack.pop();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Undoes the most recent undo record.
|
|
196
|
+
*
|
|
197
|
+
* @returns True when an undo record was applied; false when the stack is empty
|
|
198
|
+
*/
|
|
199
|
+
AcDbDatabaseTransactionManager.prototype.undo = function () {
|
|
200
|
+
var record = this.undoStack.popUndo();
|
|
201
|
+
if (!record) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
this.database.beginEventBatch();
|
|
205
|
+
this._applyingUndoRedo = true;
|
|
206
|
+
try {
|
|
207
|
+
this.changeApplier.applyInverse(record.changes);
|
|
208
|
+
this.dispatchUndoRedoEvents(record.changes, true);
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
this._applyingUndoRedo = false;
|
|
212
|
+
this.database.endEventBatch();
|
|
213
|
+
}
|
|
214
|
+
this.undoStack.pushRedo(record);
|
|
215
|
+
return true;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Redoes the most recently undone record.
|
|
219
|
+
*
|
|
220
|
+
* @returns True when a redo record was applied; false when the redo stack is empty
|
|
221
|
+
*/
|
|
222
|
+
AcDbDatabaseTransactionManager.prototype.redo = function () {
|
|
223
|
+
var record = this.undoStack.popRedo();
|
|
224
|
+
if (!record) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
this.database.beginEventBatch();
|
|
228
|
+
this._applyingUndoRedo = true;
|
|
229
|
+
try {
|
|
230
|
+
this.changeApplier.applyForward(record.changes);
|
|
231
|
+
this.dispatchUndoRedoEvents(record.changes, false);
|
|
232
|
+
}
|
|
233
|
+
finally {
|
|
234
|
+
this._applyingUndoRedo = false;
|
|
235
|
+
this.database.endEventBatch();
|
|
236
|
+
}
|
|
237
|
+
this.undoStack.push(record);
|
|
238
|
+
return true;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Returns true when at least one undo record is available.
|
|
242
|
+
*/
|
|
243
|
+
AcDbDatabaseTransactionManager.prototype.canUndo = function () {
|
|
244
|
+
return this.undoStack.canUndo();
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Returns true when at least one redo record is available.
|
|
248
|
+
*/
|
|
249
|
+
AcDbDatabaseTransactionManager.prototype.canRedo = function () {
|
|
250
|
+
return this.undoStack.canRedo();
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Clears both undo and redo history for this database.
|
|
254
|
+
*/
|
|
255
|
+
AcDbDatabaseTransactionManager.prototype.clearUndoStack = function () {
|
|
256
|
+
this.undoStack.clear();
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Records append of an object into a container during the active transaction.
|
|
260
|
+
*
|
|
261
|
+
* No-op when {@link isRecording} is false.
|
|
262
|
+
*
|
|
263
|
+
* @param container - Container that received the object
|
|
264
|
+
* @param object - Object that was appended
|
|
265
|
+
*/
|
|
266
|
+
AcDbDatabaseTransactionManager.prototype.recordAppend = function (container, object) {
|
|
267
|
+
var _a;
|
|
268
|
+
if (!this.isRecording()) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
(_a = this.currentTransaction()) === null || _a === void 0 ? void 0 : _a.recorder.recordAppend(container, object);
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Records removal of an object from a container during the active transaction.
|
|
275
|
+
*
|
|
276
|
+
* No-op when {@link isRecording} is false.
|
|
277
|
+
*
|
|
278
|
+
* @param container - Container that owned the removed object
|
|
279
|
+
* @param object - Object that was removed
|
|
280
|
+
*/
|
|
281
|
+
AcDbDatabaseTransactionManager.prototype.recordRemove = function (container, object) {
|
|
282
|
+
var _a;
|
|
283
|
+
if (!this.isRecording()) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
(_a = this.currentTransaction()) === null || _a === void 0 ? void 0 : _a.recorder.recordRemove(container, object);
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Records the pre-change value of a system variable.
|
|
290
|
+
*
|
|
291
|
+
* No-op when {@link isRecording} is false.
|
|
292
|
+
*
|
|
293
|
+
* @param name - System variable name
|
|
294
|
+
* @param before - Value observed before mutation
|
|
295
|
+
*/
|
|
296
|
+
AcDbDatabaseTransactionManager.prototype.recordSysvar = function (name, before) {
|
|
297
|
+
var _a;
|
|
298
|
+
if (!this.isRecording()) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
(_a = this.currentTransaction()) === null || _a === void 0 ? void 0 : _a.recorder.recordSysvar(name, before);
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Maps a symbol table instance to the stable name stored in undo records.
|
|
305
|
+
*
|
|
306
|
+
* @param table - Symbol table whose logical name is needed
|
|
307
|
+
* @returns Known table name, or the table's object ID as a fallback
|
|
308
|
+
*/
|
|
309
|
+
AcDbDatabaseTransactionManager.prototype.resolveSymbolTableName = function (table) {
|
|
310
|
+
var tables = this.database.tables;
|
|
311
|
+
if (table === tables.appIdTable)
|
|
312
|
+
return 'appIdTable';
|
|
313
|
+
if (table === tables.blockTable)
|
|
314
|
+
return 'blockTable';
|
|
315
|
+
if (table === tables.dimStyleTable)
|
|
316
|
+
return 'dimStyleTable';
|
|
317
|
+
if (table === tables.linetypeTable)
|
|
318
|
+
return 'linetypeTable';
|
|
319
|
+
if (table === tables.textStyleTable)
|
|
320
|
+
return 'textStyleTable';
|
|
321
|
+
if (table === tables.viewTable)
|
|
322
|
+
return 'viewTable';
|
|
323
|
+
if (table === tables.layerTable)
|
|
324
|
+
return 'layerTable';
|
|
325
|
+
if (table === tables.viewportTable)
|
|
326
|
+
return 'viewportTable';
|
|
327
|
+
return table.objectId;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Runs one undoable editor command inside a transaction and undo mark.
|
|
331
|
+
*
|
|
332
|
+
* On success the transaction is committed and the undo mark is closed.
|
|
333
|
+
* On failure the transaction is aborted and the undo mark is cancelled.
|
|
334
|
+
*
|
|
335
|
+
* @param label - Label stored on the resulting undo record
|
|
336
|
+
* @param fn - Callback that performs the command using the active transaction
|
|
337
|
+
* @returns The value returned by `fn`
|
|
338
|
+
*/
|
|
339
|
+
AcDbDatabaseTransactionManager.prototype.runUndoable = function (label, fn) {
|
|
340
|
+
this.startUndoMark(label);
|
|
341
|
+
this.startTransaction();
|
|
342
|
+
try {
|
|
343
|
+
var result = fn(this.currentTransaction());
|
|
344
|
+
this.commitTransaction();
|
|
345
|
+
this.endUndoMark();
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
if (this.hasTransaction()) {
|
|
350
|
+
this.abortTransaction();
|
|
351
|
+
}
|
|
352
|
+
this.cancelUndoMark();
|
|
353
|
+
throw error;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* Appends committed changes to the active undo mark, if any.
|
|
358
|
+
*
|
|
359
|
+
* Called after the outermost transaction commit so multiple commits within
|
|
360
|
+
* one {@link startUndoMark} group merge into a single {@link AcDbUndoRecord}.
|
|
361
|
+
*
|
|
362
|
+
* @param changes - Finalized changes from the committed transaction
|
|
363
|
+
*/
|
|
364
|
+
AcDbDatabaseTransactionManager.prototype.enqueueUndoChanges = function (changes) {
|
|
365
|
+
var e_1, _a;
|
|
366
|
+
var activeMark = this.undoMarkStack[this.undoMarkStack.length - 1];
|
|
367
|
+
if (!activeMark) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
try {
|
|
371
|
+
for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
|
|
372
|
+
var change = changes_1_1.value;
|
|
373
|
+
activeMark.pendingChanges.push(change);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
377
|
+
finally {
|
|
378
|
+
try {
|
|
379
|
+
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
380
|
+
}
|
|
381
|
+
finally { if (e_1) throw e_1.error; }
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Dispatches entity, dictionary, and sysvar events after a successful commit.
|
|
386
|
+
*
|
|
387
|
+
* @param changes - Finalized changes from the committed outermost transaction
|
|
388
|
+
*/
|
|
389
|
+
AcDbDatabaseTransactionManager.prototype.dispatchCommitEvents = function (changes) {
|
|
390
|
+
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
391
|
+
var _e = collectChangeEntities(this.database, changes), modified = _e.modified, appended = _e.appended, erased = _e.erased;
|
|
392
|
+
try {
|
|
393
|
+
for (var modified_1 = __values(modified), modified_1_1 = modified_1.next(); !modified_1_1.done; modified_1_1 = modified_1.next()) {
|
|
394
|
+
var entity = modified_1_1.value;
|
|
395
|
+
entity.triggerModifiedEvent();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
399
|
+
finally {
|
|
400
|
+
try {
|
|
401
|
+
if (modified_1_1 && !modified_1_1.done && (_a = modified_1.return)) _a.call(modified_1);
|
|
402
|
+
}
|
|
403
|
+
finally { if (e_2) throw e_2.error; }
|
|
404
|
+
}
|
|
405
|
+
if (appended.length > 0) {
|
|
406
|
+
this.database.notifyEntityAppended(appended);
|
|
407
|
+
}
|
|
408
|
+
if (erased.length > 0) {
|
|
409
|
+
this.database.notifyEntityErased(erased);
|
|
410
|
+
}
|
|
411
|
+
var _f = collectDictionaryChanges(this.database, changes), dictSet = _f.set, dictErased = _f.erased;
|
|
412
|
+
try {
|
|
413
|
+
for (var dictSet_1 = __values(dictSet), dictSet_1_1 = dictSet_1.next(); !dictSet_1_1.done; dictSet_1_1 = dictSet_1.next()) {
|
|
414
|
+
var _g = dictSet_1_1.value, object = _g.object, key = _g.key;
|
|
415
|
+
this.database.notifyDictObjectSet(object, key);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
419
|
+
finally {
|
|
420
|
+
try {
|
|
421
|
+
if (dictSet_1_1 && !dictSet_1_1.done && (_b = dictSet_1.return)) _b.call(dictSet_1);
|
|
422
|
+
}
|
|
423
|
+
finally { if (e_3) throw e_3.error; }
|
|
424
|
+
}
|
|
425
|
+
try {
|
|
426
|
+
for (var dictErased_1 = __values(dictErased), dictErased_1_1 = dictErased_1.next(); !dictErased_1_1.done; dictErased_1_1 = dictErased_1.next()) {
|
|
427
|
+
var _h = dictErased_1_1.value, object = _h.object, key = _h.key;
|
|
428
|
+
this.database.notifyDictObjectErased(object, key);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
432
|
+
finally {
|
|
433
|
+
try {
|
|
434
|
+
if (dictErased_1_1 && !dictErased_1_1.done && (_c = dictErased_1.return)) _c.call(dictErased_1);
|
|
435
|
+
}
|
|
436
|
+
finally { if (e_4) throw e_4.error; }
|
|
437
|
+
}
|
|
438
|
+
try {
|
|
439
|
+
for (var changes_2 = __values(changes), changes_2_1 = changes_2.next(); !changes_2_1.done; changes_2_1 = changes_2.next()) {
|
|
440
|
+
var change = changes_2_1.value;
|
|
441
|
+
if (change.kind === 'sysvar' && change.after !== undefined) {
|
|
442
|
+
AcDbSysVarManager.instance().events.sysVarChanged.dispatch({
|
|
443
|
+
database: this.database,
|
|
444
|
+
name: change.name,
|
|
445
|
+
oldVal: change.before,
|
|
446
|
+
newVal: change.after
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
452
|
+
finally {
|
|
453
|
+
try {
|
|
454
|
+
if (changes_2_1 && !changes_2_1.done && (_d = changes_2.return)) _d.call(changes_2);
|
|
455
|
+
}
|
|
456
|
+
finally { if (e_5) throw e_5.error; }
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Dispatches entity, dictionary, and sysvar events after undo or redo replay.
|
|
461
|
+
*
|
|
462
|
+
* Append/remove and dictionary notifications are swapped when `inverse` is
|
|
463
|
+
* true so listeners observe the same semantics as the user-facing operation.
|
|
464
|
+
*
|
|
465
|
+
* @param changes - Changes from the undo record being applied
|
|
466
|
+
* @param inverse - True when undoing (inverse replay); false when redoing
|
|
467
|
+
*/
|
|
468
|
+
AcDbDatabaseTransactionManager.prototype.dispatchUndoRedoEvents = function (changes, inverse) {
|
|
469
|
+
var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e, e_11, _f, e_12, _g;
|
|
470
|
+
var _h = collectChangeEntities(this.database, changes), modified = _h.modified, appended = _h.appended, erased = _h.erased;
|
|
471
|
+
var _j = collectDictionaryChanges(this.database, changes), dictSet = _j.set, dictErased = _j.erased;
|
|
472
|
+
if (inverse) {
|
|
473
|
+
try {
|
|
474
|
+
for (var modified_2 = __values(modified), modified_2_1 = modified_2.next(); !modified_2_1.done; modified_2_1 = modified_2.next()) {
|
|
475
|
+
var entity = modified_2_1.value;
|
|
476
|
+
entity.triggerModifiedEvent();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
480
|
+
finally {
|
|
481
|
+
try {
|
|
482
|
+
if (modified_2_1 && !modified_2_1.done && (_a = modified_2.return)) _a.call(modified_2);
|
|
483
|
+
}
|
|
484
|
+
finally { if (e_6) throw e_6.error; }
|
|
485
|
+
}
|
|
486
|
+
if (erased.length > 0) {
|
|
487
|
+
this.database.notifyEntityAppended(erased);
|
|
488
|
+
}
|
|
489
|
+
if (appended.length > 0) {
|
|
490
|
+
this.database.notifyEntityErased(appended);
|
|
491
|
+
}
|
|
492
|
+
try {
|
|
493
|
+
for (var dictErased_2 = __values(dictErased), dictErased_2_1 = dictErased_2.next(); !dictErased_2_1.done; dictErased_2_1 = dictErased_2.next()) {
|
|
494
|
+
var _k = dictErased_2_1.value, object = _k.object, key = _k.key;
|
|
495
|
+
this.database.notifyDictObjectSet(object, key);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
499
|
+
finally {
|
|
500
|
+
try {
|
|
501
|
+
if (dictErased_2_1 && !dictErased_2_1.done && (_b = dictErased_2.return)) _b.call(dictErased_2);
|
|
502
|
+
}
|
|
503
|
+
finally { if (e_7) throw e_7.error; }
|
|
504
|
+
}
|
|
505
|
+
try {
|
|
506
|
+
for (var dictSet_2 = __values(dictSet), dictSet_2_1 = dictSet_2.next(); !dictSet_2_1.done; dictSet_2_1 = dictSet_2.next()) {
|
|
507
|
+
var _l = dictSet_2_1.value, object = _l.object, key = _l.key;
|
|
508
|
+
this.database.notifyDictObjectErased(object, key);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
512
|
+
finally {
|
|
513
|
+
try {
|
|
514
|
+
if (dictSet_2_1 && !dictSet_2_1.done && (_c = dictSet_2.return)) _c.call(dictSet_2);
|
|
515
|
+
}
|
|
516
|
+
finally { if (e_8) throw e_8.error; }
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
try {
|
|
521
|
+
for (var modified_3 = __values(modified), modified_3_1 = modified_3.next(); !modified_3_1.done; modified_3_1 = modified_3.next()) {
|
|
522
|
+
var entity = modified_3_1.value;
|
|
523
|
+
entity.triggerModifiedEvent();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
527
|
+
finally {
|
|
528
|
+
try {
|
|
529
|
+
if (modified_3_1 && !modified_3_1.done && (_d = modified_3.return)) _d.call(modified_3);
|
|
530
|
+
}
|
|
531
|
+
finally { if (e_9) throw e_9.error; }
|
|
532
|
+
}
|
|
533
|
+
if (appended.length > 0) {
|
|
534
|
+
this.database.notifyEntityAppended(appended);
|
|
535
|
+
}
|
|
536
|
+
if (erased.length > 0) {
|
|
537
|
+
this.database.notifyEntityErased(erased);
|
|
538
|
+
}
|
|
539
|
+
try {
|
|
540
|
+
for (var dictSet_3 = __values(dictSet), dictSet_3_1 = dictSet_3.next(); !dictSet_3_1.done; dictSet_3_1 = dictSet_3.next()) {
|
|
541
|
+
var _m = dictSet_3_1.value, object = _m.object, key = _m.key;
|
|
542
|
+
this.database.notifyDictObjectSet(object, key);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
546
|
+
finally {
|
|
547
|
+
try {
|
|
548
|
+
if (dictSet_3_1 && !dictSet_3_1.done && (_e = dictSet_3.return)) _e.call(dictSet_3);
|
|
549
|
+
}
|
|
550
|
+
finally { if (e_10) throw e_10.error; }
|
|
551
|
+
}
|
|
552
|
+
try {
|
|
553
|
+
for (var dictErased_3 = __values(dictErased), dictErased_3_1 = dictErased_3.next(); !dictErased_3_1.done; dictErased_3_1 = dictErased_3.next()) {
|
|
554
|
+
var _o = dictErased_3_1.value, object = _o.object, key = _o.key;
|
|
555
|
+
this.database.notifyDictObjectErased(object, key);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
559
|
+
finally {
|
|
560
|
+
try {
|
|
561
|
+
if (dictErased_3_1 && !dictErased_3_1.done && (_f = dictErased_3.return)) _f.call(dictErased_3);
|
|
562
|
+
}
|
|
563
|
+
finally { if (e_11) throw e_11.error; }
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
try {
|
|
567
|
+
for (var changes_3 = __values(changes), changes_3_1 = changes_3.next(); !changes_3_1.done; changes_3_1 = changes_3.next()) {
|
|
568
|
+
var change = changes_3_1.value;
|
|
569
|
+
if (change.kind === 'sysvar') {
|
|
570
|
+
var oldVal = inverse ? change.after : change.before;
|
|
571
|
+
var newVal = inverse ? change.before : change.after;
|
|
572
|
+
if (newVal !== undefined) {
|
|
573
|
+
AcDbSysVarManager.instance().events.sysVarChanged.dispatch({
|
|
574
|
+
database: this.database,
|
|
575
|
+
name: change.name,
|
|
576
|
+
oldVal: oldVal,
|
|
577
|
+
newVal: newVal
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
584
|
+
finally {
|
|
585
|
+
try {
|
|
586
|
+
if (changes_3_1 && !changes_3_1.done && (_g = changes_3.return)) _g.call(changes_3);
|
|
587
|
+
}
|
|
588
|
+
finally { if (e_12) throw e_12.error; }
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
return AcDbDatabaseTransactionManager;
|
|
592
|
+
}());
|
|
593
|
+
export { AcDbDatabaseTransactionManager };
|
|
594
|
+
//# sourceMappingURL=AcDbDatabaseTransactionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcDbDatabaseTransactionManager.js","sourceRoot":"","sources":["../../../src/database/transaction/AcDbDatabaseTransactionManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,sBAAsB,CAAA;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAY/C;;;;;GAKG;AACH;IAcE;;;;OAIG;IACH,wCAA6B,QAAsB;QAAtB,aAAQ,GAAR,QAAQ,CAAc;QAlBlC,qBAAgB,GAA8B,EAAE,CAAA;QAChD,cAAS,GAAG,IAAI,aAAa,EAAE,CAAA;QAE/B,kBAAa,GAAwB,EAAE,CAAA;QAChD,sBAAiB,GAAG,KAAK,CAAA;QAEjC;;;;WAIG;QACH,eAAU,GAAG,KAAK,CAAA;QAQhB,IAAI,CAAC,aAAa,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAA;IACtD,CAAC;IAED;;;;;;OAMG;IACH,yDAAgB,GAAhB;QACE,IAAM,EAAE,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC9B,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;OAEG;IACH,2DAAkB,GAAlB;QACE,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAChE,CAAC;IAED;;OAEG;IACH,uDAAc,GAAd;QACE,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAA;IACzC,CAAC;IAED;;;;OAIG;IACH,oD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eRecorder } from './AcDbChangeRecorder';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a single database transaction.
|
|
4
5
|
*
|
|
@@ -12,12 +13,18 @@ export declare class AcDbTransaction {
|
|
|
12
13
|
private readonly openedObjects;
|
|
13
14
|
/** Snapshots of objects before modification */
|
|
14
15
|
private readonly originalStates;
|
|
16
|
+
/** Structured changes recorded during this transaction for commit/undo integration */
|
|
17
|
+
readonly recorder: AcDbChangeRecorder;
|
|
15
18
|
/**
|
|
16
19
|
* Records an object opening.
|
|
17
20
|
*
|
|
21
|
+
* When the object is opened for write, a pre-modification snapshot is stored
|
|
22
|
+
* for abort rollback and a modify entry is added to {@link recorder}.
|
|
23
|
+
*
|
|
18
24
|
* @param objectId - Object identifier
|
|
19
25
|
* @param mode - Open mode
|
|
20
26
|
* @param openErased - Whether erased objects are allowed
|
|
27
|
+
* @returns The opened object, or the cached instance if already opened in this transaction
|
|
21
28
|
*/
|
|
22
29
|
getObject<T extends AcDbObject>(objectId: AcDbObjectId, mode: AcDbOpenMode, openErased?: boolean): T | undefined;
|
|
23
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcDbTransaction.d.ts","sourceRoot":"","sources":["../../../src/database/transaction/AcDbTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"AcDbTransaction.d.ts","sourceRoot":"","sources":["../../../src/database/transaction/AcDbTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;;;GAOG;AACH,qBAAa,eAAe;IAC1B,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsC;IAEpE,+CAA+C;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsC;IAErE,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,qBAA2B;IAE5C;;;;;;;;;;OAUG;IACH,SAAS,CAAC,CAAC,SAAS,UAAU,EAC5B,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,YAAY,EAClB,UAAU,UAAQ,GACjB,CAAC,GAAG,SAAS;IAiBhB;;;OAGG;IACH,MAAM,IAAI,IAAI;IAKd;;OAEG;IACH,KAAK,IAAI,IAAI;IAab;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,CAAC,SAAS,UAAU,EACzC,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,OAAO,GACnB,CAAC;CAGL"}
|