@vuu-ui/vuu-data-remote 2.1.18 → 2.1.19-beta.1

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 (57) hide show
  1. package/package.json +10 -12
  2. package/types/ConnectionManager.d.ts +2 -2
  3. package/types/VuuDataSource.d.ts +2 -2
  4. package/types/inlined-worker.d.ts +1 -1
  5. package/types/server-proxy/viewport.d.ts +1 -1
  6. package/cjs/ConnectionManager.js +0 -181
  7. package/cjs/ConnectionManager.js.map +0 -1
  8. package/cjs/DedicatedWorker.js +0 -61
  9. package/cjs/DedicatedWorker.js.map +0 -1
  10. package/cjs/LostConnectionHandler.js +0 -83
  11. package/cjs/LostConnectionHandler.js.map +0 -1
  12. package/cjs/VuuAuthProvider.js +0 -87
  13. package/cjs/VuuAuthProvider.js.map +0 -1
  14. package/cjs/VuuAuthenticator.js +0 -57
  15. package/cjs/VuuAuthenticator.js.map +0 -1
  16. package/cjs/VuuDataSource.js +0 -638
  17. package/cjs/VuuDataSource.js.map +0 -1
  18. package/cjs/WebSocketConnection.js +0 -20
  19. package/cjs/WebSocketConnection.js.map +0 -1
  20. package/cjs/authenticate.js +0 -64
  21. package/cjs/authenticate.js.map +0 -1
  22. package/cjs/constants.js +0 -50
  23. package/cjs/constants.js.map +0 -1
  24. package/cjs/data-source.js +0 -49
  25. package/cjs/data-source.js.map +0 -1
  26. package/cjs/index.js +0 -38
  27. package/cjs/index.js.map +0 -1
  28. package/cjs/inlined-worker.js +0 -2742
  29. package/cjs/inlined-worker.js.map +0 -1
  30. package/cjs/message-utils.js +0 -70
  31. package/cjs/message-utils.js.map +0 -1
  32. package/esm/ConnectionManager.js +0 -179
  33. package/esm/ConnectionManager.js.map +0 -1
  34. package/esm/DedicatedWorker.js +0 -59
  35. package/esm/DedicatedWorker.js.map +0 -1
  36. package/esm/LostConnectionHandler.js +0 -79
  37. package/esm/LostConnectionHandler.js.map +0 -1
  38. package/esm/VuuAuthProvider.js +0 -85
  39. package/esm/VuuAuthProvider.js.map +0 -1
  40. package/esm/VuuAuthenticator.js +0 -54
  41. package/esm/VuuAuthenticator.js.map +0 -1
  42. package/esm/VuuDataSource.js +0 -636
  43. package/esm/VuuDataSource.js.map +0 -1
  44. package/esm/WebSocketConnection.js +0 -17
  45. package/esm/WebSocketConnection.js.map +0 -1
  46. package/esm/authenticate.js +0 -60
  47. package/esm/authenticate.js.map +0 -1
  48. package/esm/constants.js +0 -47
  49. package/esm/constants.js.map +0 -1
  50. package/esm/data-source.js +0 -44
  51. package/esm/data-source.js.map +0 -1
  52. package/esm/index.js +0 -11
  53. package/esm/index.js.map +0 -1
  54. package/esm/inlined-worker.js +0 -2740
  55. package/esm/inlined-worker.js.map +0 -1
  56. package/esm/message-utils.js +0 -64
  57. package/esm/message-utils.js.map +0 -1
@@ -1,638 +0,0 @@
1
- 'use strict';
2
-
3
- var vuuUtils = require('@vuu-ui/vuu-utils');
4
- var ConnectionManager = require('./ConnectionManager.js');
5
- var dataSource = require('./data-source.js');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __typeError = (msg) => {
9
- throw TypeError(msg);
10
- };
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
14
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
15
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
16
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
17
- var _allColumns, _autosubscribeColumns, _pendingVisualLink, _links, _menu, _optimize, _selectedRowsCount, _sessionDataSource, _sessionTableMessageColumn, _status, _tableSchema;
18
- const { info, infoEnabled } = vuuUtils.logger("VuuDataSource");
19
- const combineColumnsWithAutosubscribeColumns = (columns, autosubscribeColumns = []) => {
20
- if (autosubscribeColumns.length === 0) {
21
- return columns;
22
- } else {
23
- const out = columns.slice();
24
- autosubscribeColumns.forEach((name) => {
25
- if (!out.includes(name)) {
26
- out.push(name);
27
- }
28
- });
29
- return out;
30
- }
31
- };
32
- const _VuuDataSource = class _VuuDataSource extends vuuUtils.BaseDataSource {
33
- constructor({
34
- sessionTableMessageColumn,
35
- ...props
36
- }) {
37
- super(props);
38
- __publicField(this, "bufferSize");
39
- __publicField(this, "server", null);
40
- __publicField(this, "rangeRequest");
41
- /**
42
- * this is the combined set of regular columns and autosubscribe columns
43
- */
44
- __privateAdd(this, _allColumns);
45
- __privateAdd(this, _autosubscribeColumns, []);
46
- __privateAdd(this, _pendingVisualLink);
47
- __privateAdd(this, _links);
48
- __privateAdd(this, _menu);
49
- __privateAdd(this, _optimize, "throttle");
50
- __privateAdd(this, _selectedRowsCount, 0);
51
- __privateAdd(this, _sessionDataSource);
52
- __privateAdd(this, _sessionTableMessageColumn);
53
- __privateAdd(this, _status, "initialising");
54
- __privateAdd(this, _tableSchema);
55
- __publicField(this, "table");
56
- __publicField(this, "handleMessageFromServer", (message) => {
57
- if (message.type === "subscribed") {
58
- __privateSet(this, _status, "subscribed");
59
- this.tableSchema = message.tableSchema;
60
- this._clientCallback?.(message);
61
- if (__privateGet(this, _pendingVisualLink)) {
62
- this.visualLink = __privateGet(this, _pendingVisualLink);
63
- __privateSet(this, _pendingVisualLink, void 0);
64
- }
65
- this.emit("subscribed", message);
66
- } else if (message.type === "disabled") {
67
- __privateSet(this, _status, "disabled");
68
- } else if (message.type === "enabled") {
69
- __privateSet(this, _status, "subscribed");
70
- this.emit("enabled", this.viewport);
71
- } else if (dataSource.isDataSourceConfigMessage(message)) {
72
- return;
73
- } else if (message.type === "debounce-begin") {
74
- this.optimize = "debounce";
75
- } else {
76
- if (message.type === "viewport-update") {
77
- if (message.size !== void 0 && message.size !== this.size) {
78
- this.size = message.size;
79
- this.emit("resize", message.size);
80
- }
81
- if (Array.isArray(message.rows) && message.rows.length > 0 && __privateGet(this, _sessionDataSource)) {
82
- this.emit("remote-update-during-local-edit", message.rows);
83
- console.log(
84
- `updates incoming whilst edit in progress ${this.viewport}`
85
- );
86
- console.table(message.rows);
87
- return;
88
- }
89
- } else if (message.type === "viewport-clear") {
90
- this.size = 0;
91
- this.emit("resize", 0);
92
- }
93
- if (this.isAwaitingConfirmationOfConfigChange) {
94
- this.confirmConfigChange();
95
- }
96
- if (vuuUtils.isViewportMenusAction(message)) {
97
- __privateSet(this, _menu, message.menu);
98
- } else if (vuuUtils.isVisualLinksAction(message)) {
99
- __privateSet(this, _links, message.links);
100
- } else {
101
- if (infoEnabled && message.type === "viewport-update") {
102
- info(
103
- `handleMessageFromServer<viewport-update> range (${message.range?.from}:${message.range?.to}) rows ${message.rows?.at(0)?.[0]} - ${message.rows?.at(-1)?.[0]}`
104
- );
105
- }
106
- this._clientCallback?.(message);
107
- }
108
- if (this.optimize === "debounce") {
109
- this.revertDebounce();
110
- }
111
- }
112
- });
113
- __publicField(this, "handleSessionMessageFromServer", (msg) => {
114
- if (msg.type === "subscribed") {
115
- console.log(`[VuuDataSource subscribed to session table]`);
116
- } else if (msg.type === "viewport-update") {
117
- if (msg.size !== void 0 && msg.size !== this.size) {
118
- this.size = msg.size;
119
- this.emit("resize", msg.size);
120
- }
121
- console.log(`[VuuDataSource] clientCallback with ${msg.type}`);
122
- this._clientCallback?.(msg);
123
- }
124
- });
125
- __publicField(this, "revertDebounce", vuuUtils.debounce(() => {
126
- this.optimize = "throttle";
127
- }, 100));
128
- __publicField(this, "rawRangeRequest", (range) => {
129
- if (this.viewport && this.server) {
130
- this.server.send({
131
- viewport: this.viewport,
132
- type: "setViewRange",
133
- range
134
- });
135
- }
136
- });
137
- __publicField(this, "debounceRangeRequest", vuuUtils.debounce((range) => {
138
- if (this.viewport && this.server) {
139
- this.server.send({
140
- viewport: this.viewport,
141
- type: "setViewRange",
142
- range
143
- });
144
- }
145
- }, 50));
146
- __publicField(this, "throttleRangeRequest", vuuUtils.throttle((range) => {
147
- if (this.viewport && this.server) {
148
- this.server.send({
149
- viewport: this.viewport,
150
- type: "setViewRange",
151
- range
152
- });
153
- }
154
- }, 80));
155
- const { bufferSize = 100, table, visualLink } = props;
156
- if (!table)
157
- throw Error("RemoteDataSource constructor called without table");
158
- this.bufferSize = bufferSize;
159
- this.table = table;
160
- __privateSet(this, _pendingVisualLink, visualLink);
161
- __privateSet(this, _sessionTableMessageColumn, sessionTableMessageColumn);
162
- this.rangeRequest = this.rawRangeRequest;
163
- if (props.autosubscribeColumns) {
164
- __privateSet(this, _autosubscribeColumns, props.autosubscribeColumns);
165
- __privateSet(this, _allColumns, combineColumnsWithAutosubscribeColumns(
166
- super.columns,
167
- props.autosubscribeColumns
168
- ));
169
- }
170
- }
171
- async subscribe(subscribeProps, callback) {
172
- super.subscribe(subscribeProps, callback);
173
- const { viewport = this.viewport || (this.viewport = vuuUtils.uuid()) } = subscribeProps;
174
- console.log(`[VuuDataSource] subscribe ${this.viewport}`);
175
- if (__privateGet(this, _status) === "disabled" || __privateGet(this, _status) === "disabling" || __privateGet(this, _status) === "enabling") {
176
- this.enable(callback);
177
- return;
178
- }
179
- if (__privateGet(this, _status) !== "initialising" && __privateGet(this, _status) !== "unsubscribed") {
180
- throw Error(
181
- `[VuuDataSource] invalid status ${__privateGet(this, _status)} for subscribe`
182
- );
183
- }
184
- __privateSet(this, _status, "subscribing");
185
- this.server = await ConnectionManager.serverAPI;
186
- const { bufferSize } = this;
187
- const { columns, ...dataSourceConfig } = vuuUtils.combineFilters(this.config);
188
- this.server?.subscribe(
189
- {
190
- ...dataSourceConfig,
191
- bufferSize,
192
- columns: this.columns,
193
- range: this._range.withBuffer,
194
- table: this.table,
195
- title: this._title,
196
- viewport
197
- },
198
- this.handleMessageFromServer
199
- );
200
- }
201
- unsubscribe() {
202
- if (__privateGet(this, _status) !== "unsubscribed") {
203
- info?.(`unsubscribe #${this.viewport}`);
204
- if (this.viewport) {
205
- this.server?.unsubscribe(this.viewport);
206
- this.emit("unsubscribed", this.viewport);
207
- }
208
- this.server?.destroy(this.viewport);
209
- this.server = null;
210
- this.removeAllListeners();
211
- __privateSet(this, _status, "unsubscribed");
212
- this.viewport = "";
213
- this.range = vuuUtils.Range(0, 0);
214
- }
215
- }
216
- suspend(escalateToDisable = this._defaultSuspenseProps.escalateToDisable, escalateDelay = this._defaultSuspenseProps.escalateDelay) {
217
- if (__privateGet(this, _status) !== "unsubscribed") {
218
- info?.(`suspend #${this.viewport}, current status ${__privateGet(this, _status)}`);
219
- if (this.viewport) {
220
- __privateSet(this, _status, "suspended");
221
- this.server?.send({
222
- escalateDelay,
223
- escalateToDisable,
224
- type: "suspend",
225
- viewport: this.viewport
226
- });
227
- this.emit("suspended", this.viewport);
228
- }
229
- }
230
- }
231
- /**
232
- * Tell the server we wish to resume receiving messages. Server will send a
233
- * snapshot of rows currently in cache. This can be used to update with
234
- * latest data, e.g after an edit session during which we might have ignored
235
- * some updates.
236
- */
237
- sendResumeMessage() {
238
- this.server?.send({
239
- type: "resume",
240
- viewport: this.viewport
241
- });
242
- }
243
- resume(callback) {
244
- const isDisabled = __privateGet(this, _status).startsWith("disabl");
245
- const isSuspended = __privateGet(this, _status) === "suspended";
246
- info?.(`resume #${this.viewport}, current status ${__privateGet(this, _status)}`);
247
- if (callback) {
248
- this._clientCallback = callback;
249
- }
250
- if (this.viewport) {
251
- if (isDisabled) {
252
- this.enable();
253
- } else if (isSuspended) {
254
- this.sendResumeMessage();
255
- __privateSet(this, _status, "subscribed");
256
- this.emit("resumed", this.viewport);
257
- if (__privateGet(this, _selectedRowsCount) > 0) {
258
- this.emit("row-selection", __privateGet(this, _selectedRowsCount));
259
- }
260
- }
261
- }
262
- }
263
- freeze() {
264
- super.freeze();
265
- if (this.viewport) {
266
- this.server?.send({
267
- viewport: this.viewport,
268
- type: "FREEZE_VP"
269
- });
270
- }
271
- }
272
- unfreeze() {
273
- super.unfreeze();
274
- if (this.viewport) {
275
- this.server?.send({
276
- viewport: this.viewport,
277
- type: "UNFREEZE_VP"
278
- });
279
- }
280
- }
281
- disable() {
282
- info?.(`disable #${this.viewport}, current status ${__privateGet(this, _status)}`);
283
- if (this.viewport) {
284
- __privateSet(this, _status, "disabling");
285
- this.server?.send({
286
- viewport: this.viewport,
287
- type: "disable"
288
- });
289
- this.emit("disabled", this.viewport);
290
- }
291
- }
292
- enable(callback) {
293
- info?.(`enable #${this.viewport}, current status ${__privateGet(this, _status)}`);
294
- if (this.viewport && (__privateGet(this, _status) === "disabled" || __privateGet(this, _status) === "disabling")) {
295
- __privateSet(this, _status, "enabling");
296
- if (callback) {
297
- this._clientCallback = callback;
298
- }
299
- this.server?.send({
300
- viewport: this.viewport,
301
- type: "enable"
302
- });
303
- this.emit("enabled", this.viewport);
304
- }
305
- }
306
- async select(selectRequest) {
307
- if (this.viewport && this.server) {
308
- const response = await this.server.select({
309
- ...selectRequest,
310
- vpId: this.viewport
311
- });
312
- if (vuuUtils.isSelectSuccessWithRowCount(response)) {
313
- console.log(
314
- `[VuuDataSource] select selectedRowCount ${response.selectedRowCount}`
315
- );
316
- __privateSet(this, _selectedRowsCount, response.selectedRowCount);
317
- this.emit("row-selection", response.selectedRowCount);
318
- } else {
319
- console.warn(`select error`);
320
- }
321
- }
322
- }
323
- openTreeNode(keyOrIndex) {
324
- if (this.viewport) {
325
- const [key, index] = typeof keyOrIndex === "string" ? [keyOrIndex] : [void 0, keyOrIndex];
326
- this.server?.send({
327
- index,
328
- key,
329
- type: "openTreeNode",
330
- viewport: this.viewport
331
- });
332
- }
333
- }
334
- closeTreeNode(keyOrIndex) {
335
- if (this.viewport) {
336
- const [key, index] = typeof keyOrIndex === "string" ? [keyOrIndex] : [void 0, keyOrIndex];
337
- this.server?.send({
338
- index,
339
- key,
340
- type: "closeTreeNode",
341
- viewport: this.viewport
342
- });
343
- }
344
- }
345
- //TODO is this going to be confusing - the lack of symmetry between set and get columns
346
- // when there are autoSubscribe columns ?
347
- // alternative would be an allColumns prop, but every datasource would then have to add it.
348
- get columns() {
349
- return __privateGet(this, _allColumns) ?? super.columns;
350
- }
351
- set columns(columns) {
352
- super.columns = columns;
353
- if (__privateGet(this, _autosubscribeColumns).length) {
354
- __privateSet(this, _allColumns, combineColumnsWithAutosubscribeColumns(
355
- columns,
356
- __privateGet(this, _autosubscribeColumns)
357
- ));
358
- }
359
- }
360
- get tableSchema() {
361
- return __privateGet(this, _tableSchema);
362
- }
363
- set tableSchema(tableSchema) {
364
- __privateSet(this, _tableSchema, tableSchema);
365
- }
366
- get links() {
367
- return __privateGet(this, _links);
368
- }
369
- get menu() {
370
- return __privateGet(this, _menu);
371
- }
372
- get status() {
373
- return __privateGet(this, _status);
374
- }
375
- get optimize() {
376
- return __privateGet(this, _optimize);
377
- }
378
- set optimize(optimize) {
379
- if (optimize !== __privateGet(this, _optimize)) {
380
- __privateSet(this, _optimize, optimize);
381
- switch (optimize) {
382
- case "none":
383
- this.rangeRequest = this.rawRangeRequest;
384
- break;
385
- case "debounce":
386
- this.rangeRequest = this.debounceRangeRequest;
387
- break;
388
- case "throttle":
389
- this.rangeRequest = this.throttleRangeRequest;
390
- break;
391
- }
392
- this.emit("optimize", optimize);
393
- }
394
- }
395
- get selectedRowsCount() {
396
- return __privateGet(this, _selectedRowsCount);
397
- }
398
- get config() {
399
- return super.config;
400
- }
401
- set config(config) {
402
- const { noChanges, columnsChanged } = vuuUtils.isConfigChanged(this.config, config);
403
- if (!noChanges) {
404
- super.config = config;
405
- const { columns, ...dataSourceConfig } = vuuUtils.combineFilters(this.config);
406
- const serverConfig = {
407
- ...dataSourceConfig,
408
- columns: combineColumnsWithAutosubscribeColumns(
409
- columns,
410
- __privateGet(this, _autosubscribeColumns)
411
- )
412
- };
413
- if (columnsChanged && __privateGet(this, _autosubscribeColumns).length) {
414
- __privateSet(this, _allColumns, combineColumnsWithAutosubscribeColumns(
415
- columns,
416
- __privateGet(this, _autosubscribeColumns)
417
- ));
418
- }
419
- this.server?.send({
420
- viewport: this.viewport,
421
- type: "config",
422
- config: serverConfig
423
- });
424
- }
425
- }
426
- set impendingConfig(config) {
427
- if (config !== this.config) {
428
- super.impendingConfig = config;
429
- this.server?.send({
430
- viewport: this.viewport,
431
- type: "config",
432
- config: vuuUtils.combineFilters(this.config)
433
- });
434
- }
435
- }
436
- get groupBy() {
437
- return this._configWithVisualLink.groupBy;
438
- }
439
- set groupBy(groupBy) {
440
- if (vuuUtils.itemsOrOrderChanged(this.groupBy, groupBy)) {
441
- const wasGrouped = this.groupBy.length > 0;
442
- this.impendingConfig = {
443
- ...this._configWithVisualLink,
444
- groupBy
445
- };
446
- if (!wasGrouped && groupBy.length > 0 && this.viewport) {
447
- this._clientCallback?.({
448
- clientViewportId: this.viewport,
449
- mode: "batch",
450
- type: "viewport-update",
451
- size: 0,
452
- rows: []
453
- });
454
- }
455
- }
456
- }
457
- get range() {
458
- return super.range;
459
- }
460
- set range(range) {
461
- super.range = range;
462
- if (__privateGet(this, _sessionDataSource)) {
463
- __privateGet(this, _sessionDataSource).range = range;
464
- }
465
- }
466
- get title() {
467
- return super.title || `${this.table.module} ${this.table.table}`;
468
- }
469
- set title(title) {
470
- super.title = title;
471
- if (this.viewport && title) {
472
- this.server?.send({
473
- type: "setTitle",
474
- title,
475
- viewport: this.viewport
476
- });
477
- }
478
- }
479
- get visualLink() {
480
- return this._configWithVisualLink.visualLink;
481
- }
482
- set visualLink(visualLink) {
483
- this._configWithVisualLink = {
484
- ...this._configWithVisualLink,
485
- visualLink
486
- };
487
- if (visualLink) {
488
- const {
489
- parentClientVpId,
490
- link: { fromColumn, toColumn }
491
- } = visualLink;
492
- if (this.viewport) {
493
- this.server?.rpcCall({
494
- childColumnName: fromColumn,
495
- childVpId: this.viewport,
496
- parentColumnName: toColumn,
497
- parentVpId: parentClientVpId,
498
- type: "CREATE_VISUAL_LINK"
499
- }).then((response) => {
500
- this.emit("visual-link-created", response);
501
- });
502
- }
503
- } else {
504
- if (this.viewport) {
505
- this.server?.rpcCall({
506
- type: "REMOVE_VISUAL_LINK",
507
- childVpId: this.viewport
508
- }).then(() => {
509
- this.emit("visual-link-removed");
510
- });
511
- }
512
- }
513
- this.emit("config", this._configWithVisualLink, this.range);
514
- }
515
- async remoteProcedureCall() {
516
- return Promise.reject();
517
- }
518
- createSessionDataSource(sessionTable) {
519
- const columns = __privateGet(this, _sessionTableMessageColumn) ? this.columns.concat(__privateGet(this, _sessionTableMessageColumn)) : this.columns;
520
- return new _VuuDataSource({
521
- columns,
522
- table: sessionTable
523
- });
524
- }
525
- async beginEditSession(editSessionMode = "all-rows") {
526
- const rpcResponse = await this?.rpcRequest?.({
527
- type: "RPC_REQUEST",
528
- rpcName: "beginEditSession",
529
- params: {
530
- editSessionMode
531
- }
532
- });
533
- if (vuuUtils.isRpcSuccess(rpcResponse)) {
534
- const { table: sessionTable } = rpcResponse.data;
535
- if (vuuUtils.isInlineEditingSession(editSessionMode)) {
536
- const columns = __privateGet(this, _sessionTableMessageColumn) ? this.columns.concat(__privateGet(this, _sessionTableMessageColumn)) : this.columns;
537
- __privateSet(this, _sessionDataSource, new _VuuDataSource({
538
- ...this.config,
539
- columns,
540
- table: sessionTable,
541
- viewport: sessionTable.table
542
- }));
543
- __privateGet(this, _sessionDataSource).subscribe(
544
- {
545
- range: this.range
546
- },
547
- this.handleSessionMessageFromServer
548
- );
549
- } else {
550
- return new _VuuDataSource({
551
- ...this.config,
552
- table: sessionTable,
553
- viewport: sessionTable.table
554
- });
555
- }
556
- } else {
557
- throw Error(
558
- `[VuuDataSource] beginEditSession ${rpcResponse.errorMessage}`
559
- );
560
- }
561
- }
562
- async editCell(key, column, data) {
563
- const rpcHost = __privateGet(this, _sessionDataSource) ?? this;
564
- return rpcHost.rpcRequest?.({
565
- type: "RPC_REQUEST",
566
- rpcName: "editCell",
567
- params: {
568
- column,
569
- data,
570
- key
571
- }
572
- });
573
- }
574
- async endEditSession(saveChanges = false, force = false) {
575
- const type = "RPC_REQUEST";
576
- const rpcName = "endEditSession";
577
- const sessionDataSource = __privateGet(this, _sessionDataSource);
578
- const rpcHost = sessionDataSource ?? this;
579
- if (sessionDataSource) {
580
- __privateSet(this, _sessionDataSource, void 0);
581
- }
582
- const rpcResponse = await rpcHost.rpcRequest?.(
583
- saveChanges ? { type, rpcName, params: { save: true, force } } : { type, rpcName, params: {} }
584
- );
585
- if (vuuUtils.isRpcSuccess(rpcResponse)) {
586
- if (sessionDataSource) {
587
- sessionDataSource?.unsubscribe();
588
- }
589
- } else {
590
- if (rpcResponse?.errorMessage === "stale update") {
591
- __privateSet(this, _sessionDataSource, sessionDataSource);
592
- throw new vuuUtils.StaleUpdateError(rpcResponse.errorMessage);
593
- } else {
594
- throw Error("unknown error");
595
- }
596
- }
597
- this.sendResumeMessage();
598
- }
599
- async rpcRequest(rpcRequest) {
600
- if (this.viewport && this.server) {
601
- return this.server?.rpcCall({
602
- ...rpcRequest,
603
- context: { type: "VIEWPORT_CONTEXT", viewPortId: this.viewport }
604
- });
605
- } else {
606
- throw Error(`rpcCall server or viewport are undefined`);
607
- }
608
- }
609
- async menuRpcCall(rpcRequest) {
610
- if (this.viewport) {
611
- return this.server?.rpcCall({
612
- ...rpcRequest,
613
- vpId: this.viewport
614
- });
615
- }
616
- }
617
- insertRow() {
618
- return Promise.resolve("not supported");
619
- }
620
- deleteRow() {
621
- return Promise.resolve("not supported");
622
- }
623
- };
624
- _allColumns = new WeakMap();
625
- _autosubscribeColumns = new WeakMap();
626
- _pendingVisualLink = new WeakMap();
627
- _links = new WeakMap();
628
- _menu = new WeakMap();
629
- _optimize = new WeakMap();
630
- _selectedRowsCount = new WeakMap();
631
- _sessionDataSource = new WeakMap();
632
- _sessionTableMessageColumn = new WeakMap();
633
- _status = new WeakMap();
634
- _tableSchema = new WeakMap();
635
- let VuuDataSource = _VuuDataSource;
636
-
637
- exports.VuuDataSource = VuuDataSource;
638
- //# sourceMappingURL=VuuDataSource.js.map