mongodb-livedata-server 0.1.2 → 0.1.4

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 (91) hide show
  1. package/dist/livedata_server.d.ts +4 -4
  2. package/dist/livedata_server.js +11 -11
  3. package/dist/meteor/binary-heap/max_heap.d.ts +31 -31
  4. package/dist/meteor/binary-heap/max_heap.js +186 -186
  5. package/dist/meteor/binary-heap/min_heap.d.ts +6 -6
  6. package/dist/meteor/binary-heap/min_heap.js +17 -17
  7. package/dist/meteor/binary-heap/min_max_heap.d.ts +11 -11
  8. package/dist/meteor/binary-heap/min_max_heap.js +48 -48
  9. package/dist/meteor/callback-hook/hook.d.ts +11 -11
  10. package/dist/meteor/callback-hook/hook.js +78 -78
  11. package/dist/meteor/ddp/crossbar.d.ts +15 -15
  12. package/dist/meteor/ddp/crossbar.js +136 -136
  13. package/dist/meteor/ddp/heartbeat.d.ts +19 -19
  14. package/dist/meteor/ddp/heartbeat.js +77 -77
  15. package/dist/meteor/ddp/livedata_server.d.ts +141 -142
  16. package/dist/meteor/ddp/livedata_server.js +403 -403
  17. package/dist/meteor/ddp/method-invocation.d.ts +35 -35
  18. package/dist/meteor/ddp/method-invocation.js +72 -72
  19. package/dist/meteor/ddp/random-stream.d.ts +8 -8
  20. package/dist/meteor/ddp/random-stream.js +100 -100
  21. package/dist/meteor/ddp/session-collection-view.d.ts +20 -20
  22. package/dist/meteor/ddp/session-collection-view.js +106 -106
  23. package/dist/meteor/ddp/session-document-view.d.ts +8 -8
  24. package/dist/meteor/ddp/session-document-view.js +82 -82
  25. package/dist/meteor/ddp/session.d.ts +75 -74
  26. package/dist/meteor/ddp/session.js +590 -589
  27. package/dist/meteor/ddp/stream_server.d.ts +20 -21
  28. package/dist/meteor/ddp/stream_server.js +181 -181
  29. package/dist/meteor/ddp/subscription.d.ts +94 -94
  30. package/dist/meteor/ddp/subscription.js +370 -370
  31. package/dist/meteor/ddp/utils.d.ts +8 -8
  32. package/dist/meteor/ddp/utils.js +104 -104
  33. package/dist/meteor/ddp/writefence.d.ts +20 -20
  34. package/dist/meteor/ddp/writefence.js +111 -111
  35. package/dist/meteor/diff-sequence/diff.d.ts +17 -17
  36. package/dist/meteor/diff-sequence/diff.js +257 -257
  37. package/dist/meteor/ejson/ejson.d.ts +82 -82
  38. package/dist/meteor/ejson/ejson.js +568 -569
  39. package/dist/meteor/ejson/stringify.d.ts +2 -2
  40. package/dist/meteor/ejson/stringify.js +119 -119
  41. package/dist/meteor/ejson/utils.d.ts +12 -12
  42. package/dist/meteor/ejson/utils.js +42 -42
  43. package/dist/meteor/mongo/caching_change_observer.d.ts +16 -16
  44. package/dist/meteor/mongo/caching_change_observer.js +63 -63
  45. package/dist/meteor/mongo/doc_fetcher.d.ts +7 -7
  46. package/dist/meteor/mongo/doc_fetcher.js +53 -53
  47. package/dist/meteor/mongo/geojson_utils.d.ts +3 -3
  48. package/dist/meteor/mongo/geojson_utils.js +40 -41
  49. package/dist/meteor/mongo/live_connection.d.ts +28 -28
  50. package/dist/meteor/mongo/live_connection.js +264 -264
  51. package/dist/meteor/mongo/live_cursor.d.ts +25 -25
  52. package/dist/meteor/mongo/live_cursor.js +60 -60
  53. package/dist/meteor/mongo/minimongo_common.d.ts +84 -84
  54. package/dist/meteor/mongo/minimongo_common.js +1998 -2002
  55. package/dist/meteor/mongo/minimongo_matcher.d.ts +23 -23
  56. package/dist/meteor/mongo/minimongo_matcher.js +283 -283
  57. package/dist/meteor/mongo/minimongo_sorter.d.ts +16 -16
  58. package/dist/meteor/mongo/minimongo_sorter.js +268 -268
  59. package/dist/meteor/mongo/observe_driver_utils.d.ts +9 -9
  60. package/dist/meteor/mongo/observe_driver_utils.js +72 -73
  61. package/dist/meteor/mongo/observe_multiplexer.d.ts +46 -46
  62. package/dist/meteor/mongo/observe_multiplexer.js +203 -203
  63. package/dist/meteor/mongo/oplog-observe-driver.d.ts +68 -68
  64. package/dist/meteor/mongo/oplog-observe-driver.js +918 -918
  65. package/dist/meteor/mongo/oplog_tailing.d.ts +35 -35
  66. package/dist/meteor/mongo/oplog_tailing.js +352 -352
  67. package/dist/meteor/mongo/oplog_v2_converter.d.ts +1 -1
  68. package/dist/meteor/mongo/oplog_v2_converter.js +125 -126
  69. package/dist/meteor/mongo/polling_observe_driver.d.ts +30 -30
  70. package/dist/meteor/mongo/polling_observe_driver.js +216 -221
  71. package/dist/meteor/mongo/synchronous-cursor.d.ts +17 -17
  72. package/dist/meteor/mongo/synchronous-cursor.js +261 -261
  73. package/dist/meteor/mongo/synchronous-queue.d.ts +13 -13
  74. package/dist/meteor/mongo/synchronous-queue.js +110 -110
  75. package/dist/meteor/ordered-dict/ordered_dict.d.ts +31 -31
  76. package/dist/meteor/ordered-dict/ordered_dict.js +198 -198
  77. package/dist/meteor/random/AbstractRandomGenerator.d.ts +42 -42
  78. package/dist/meteor/random/AbstractRandomGenerator.js +92 -92
  79. package/dist/meteor/random/AleaRandomGenerator.d.ts +13 -13
  80. package/dist/meteor/random/AleaRandomGenerator.js +90 -90
  81. package/dist/meteor/random/NodeRandomGenerator.d.ts +16 -16
  82. package/dist/meteor/random/NodeRandomGenerator.js +42 -42
  83. package/dist/meteor/random/createAleaGenerator.d.ts +2 -2
  84. package/dist/meteor/random/createAleaGenerator.js +32 -32
  85. package/dist/meteor/random/createRandom.d.ts +1 -1
  86. package/dist/meteor/random/createRandom.js +22 -22
  87. package/dist/meteor/random/main.d.ts +1 -1
  88. package/dist/meteor/random/main.js +12 -12
  89. package/dist/meteor/types.d.ts +1 -1
  90. package/dist/meteor/types.js +2 -2
  91. package/package.json +6 -5
@@ -1,8 +1,8 @@
1
- export declare const hasOwn: (v: PropertyKey) => boolean;
2
- export declare const slice: (start?: number, end?: number) => any[];
3
- export declare function keys(obj: any): string[];
4
- export declare function isEmpty(obj: any): boolean;
5
- export declare function last(array: any, n: any, guard: any): any;
6
- export declare const SUPPORTED_DDP_VERSIONS: string[];
7
- export declare function parseDDP(stringMessage: string): any;
8
- export declare function stringifyDDP(msg: any): string;
1
+ export declare const hasOwn: (v: PropertyKey) => boolean;
2
+ export declare const slice: (start?: number, end?: number) => any[];
3
+ export declare function keys(obj: any): string[];
4
+ export declare function isEmpty(obj: any): boolean;
5
+ export declare function last(array: any, n: any, guard: any): any;
6
+ export declare const SUPPORTED_DDP_VERSIONS: string[];
7
+ export declare function parseDDP(stringMessage: string): any;
8
+ export declare function stringifyDDP(msg: any): string;
@@ -1,104 +1,104 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringifyDDP = exports.parseDDP = exports.SUPPORTED_DDP_VERSIONS = exports.last = exports.isEmpty = exports.keys = exports.slice = exports.hasOwn = void 0;
4
- const ejson_1 = require("../ejson/ejson");
5
- exports.hasOwn = Object.prototype.hasOwnProperty;
6
- exports.slice = Array.prototype.slice;
7
- function keys(obj) {
8
- return Object.keys(Object(obj));
9
- }
10
- exports.keys = keys;
11
- function isEmpty(obj) {
12
- if (obj == null) {
13
- return true;
14
- }
15
- if (Array.isArray(obj) ||
16
- typeof obj === "string") {
17
- return obj.length === 0;
18
- }
19
- for (const key in obj) {
20
- if (exports.hasOwn.call(obj, key)) {
21
- return false;
22
- }
23
- }
24
- return true;
25
- }
26
- exports.isEmpty = isEmpty;
27
- function last(array, n, guard) {
28
- if (array == null) {
29
- return;
30
- }
31
- if ((n == null) || guard) {
32
- return array[array.length - 1];
33
- }
34
- return exports.slice.call(array, Math.max(array.length - n, 0));
35
- }
36
- exports.last = last;
37
- exports.SUPPORTED_DDP_VERSIONS = ['1a', '1', 'pre2', 'pre1'];
38
- function parseDDP(stringMessage) {
39
- try {
40
- var msg = JSON.parse(stringMessage);
41
- }
42
- catch (e) {
43
- console.log("Discarding message with invalid JSON", stringMessage);
44
- return null;
45
- }
46
- // DDP messages must be objects.
47
- if (msg === null || typeof msg !== 'object') {
48
- console.log("Discarding non-object DDP message", stringMessage);
49
- return null;
50
- }
51
- // massage msg to get it into "abstract ddp" rather than "wire ddp" format.
52
- // switch between "cleared" rep of unsetting fields and "undefined"
53
- // rep of same
54
- if (exports.hasOwn.call(msg, 'cleared')) {
55
- if (!exports.hasOwn.call(msg, 'fields')) {
56
- msg.fields = {};
57
- }
58
- msg.cleared.forEach(clearKey => {
59
- msg.fields[clearKey] = undefined;
60
- });
61
- delete msg.cleared;
62
- }
63
- ['fields', 'params', 'result'].forEach(field => {
64
- if (exports.hasOwn.call(msg, field)) {
65
- msg[field] = (0, ejson_1._adjustTypesFromJSONValue)(msg[field]);
66
- }
67
- });
68
- return msg;
69
- }
70
- exports.parseDDP = parseDDP;
71
- ;
72
- function stringifyDDP(msg) {
73
- const copy = (0, ejson_1.clone)(msg);
74
- // swizzle 'changed' messages from 'fields undefined' rep to 'fields
75
- // and cleared' rep
76
- if (exports.hasOwn.call(msg, 'fields')) {
77
- const cleared = [];
78
- Object.keys(msg.fields).forEach(key => {
79
- const value = msg.fields[key];
80
- if (typeof value === "undefined") {
81
- cleared.push(key);
82
- delete copy.fields[key];
83
- }
84
- });
85
- if (!isEmpty(cleared)) {
86
- copy.cleared = cleared;
87
- }
88
- if (isEmpty(copy.fields)) {
89
- delete copy.fields;
90
- }
91
- }
92
- // adjust types to basic
93
- ['fields', 'params', 'result'].forEach(field => {
94
- if (exports.hasOwn.call(copy, field)) {
95
- copy[field] = (0, ejson_1._adjustTypesToJSONValue)(copy[field]);
96
- }
97
- });
98
- if (msg.id && typeof msg.id !== 'string') {
99
- throw new Error("Message id is not a string");
100
- }
101
- return JSON.stringify(copy);
102
- }
103
- exports.stringifyDDP = stringifyDDP;
104
- ;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUPPORTED_DDP_VERSIONS = exports.slice = exports.hasOwn = void 0;
4
+ exports.keys = keys;
5
+ exports.isEmpty = isEmpty;
6
+ exports.last = last;
7
+ exports.parseDDP = parseDDP;
8
+ exports.stringifyDDP = stringifyDDP;
9
+ const ejson_1 = require("../ejson/ejson");
10
+ exports.hasOwn = Object.prototype.hasOwnProperty;
11
+ exports.slice = Array.prototype.slice;
12
+ function keys(obj) {
13
+ return Object.keys(Object(obj));
14
+ }
15
+ function isEmpty(obj) {
16
+ if (obj == null) {
17
+ return true;
18
+ }
19
+ if (Array.isArray(obj) ||
20
+ typeof obj === "string") {
21
+ return obj.length === 0;
22
+ }
23
+ for (const key in obj) {
24
+ if (exports.hasOwn.call(obj, key)) {
25
+ return false;
26
+ }
27
+ }
28
+ return true;
29
+ }
30
+ function last(array, n, guard) {
31
+ if (array == null) {
32
+ return;
33
+ }
34
+ if ((n == null) || guard) {
35
+ return array[array.length - 1];
36
+ }
37
+ return exports.slice.call(array, Math.max(array.length - n, 0));
38
+ }
39
+ exports.SUPPORTED_DDP_VERSIONS = ['1a', '1', 'pre2', 'pre1'];
40
+ function parseDDP(stringMessage) {
41
+ try {
42
+ var msg = JSON.parse(stringMessage);
43
+ }
44
+ catch (e) {
45
+ console.log("Discarding message with invalid JSON", stringMessage, '\r\n' + e.toString());
46
+ return null;
47
+ }
48
+ // DDP messages must be objects.
49
+ if (msg === null || typeof msg !== 'object') {
50
+ console.log("Discarding non-object DDP message", stringMessage);
51
+ return null;
52
+ }
53
+ // massage msg to get it into "abstract ddp" rather than "wire ddp" format.
54
+ // switch between "cleared" rep of unsetting fields and "undefined"
55
+ // rep of same
56
+ if (exports.hasOwn.call(msg, 'cleared')) {
57
+ if (!exports.hasOwn.call(msg, 'fields')) {
58
+ msg.fields = {};
59
+ }
60
+ msg.cleared.forEach(clearKey => {
61
+ msg.fields[clearKey] = undefined;
62
+ });
63
+ delete msg.cleared;
64
+ }
65
+ ['fields', 'params', 'result'].forEach(field => {
66
+ if (exports.hasOwn.call(msg, field)) {
67
+ msg[field] = (0, ejson_1._adjustTypesFromJSONValue)(msg[field]);
68
+ }
69
+ });
70
+ return msg;
71
+ }
72
+ ;
73
+ function stringifyDDP(msg) {
74
+ const copy = (0, ejson_1.clone)(msg);
75
+ // swizzle 'changed' messages from 'fields undefined' rep to 'fields
76
+ // and cleared' rep
77
+ if (exports.hasOwn.call(msg, 'fields')) {
78
+ const cleared = [];
79
+ Object.keys(msg.fields).forEach(key => {
80
+ const value = msg.fields[key];
81
+ if (typeof value === "undefined") {
82
+ cleared.push(key);
83
+ delete copy.fields[key];
84
+ }
85
+ });
86
+ if (!isEmpty(cleared)) {
87
+ copy.cleared = cleared;
88
+ }
89
+ if (isEmpty(copy.fields)) {
90
+ delete copy.fields;
91
+ }
92
+ }
93
+ // adjust types to basic
94
+ ['fields', 'params', 'result'].forEach(field => {
95
+ if (exports.hasOwn.call(copy, field)) {
96
+ copy[field] = (0, ejson_1._adjustTypesToJSONValue)(copy[field]);
97
+ }
98
+ });
99
+ if (msg.id && typeof msg.id !== 'string') {
100
+ throw new Error("Message id is not a string");
101
+ }
102
+ return JSON.stringify(copy);
103
+ }
104
+ ;
@@ -1,20 +1,20 @@
1
- import { OplogObserveDriver } from "../mongo/oplog-observe-driver";
2
- export declare class _WriteFence {
3
- fired: boolean;
4
- _oplogObserveDrivers: Record<string, OplogObserveDriver>;
5
- private armed;
6
- private retired;
7
- private outstanding_writes;
8
- private before_fire_callbacks;
9
- private completion_callbacks;
10
- constructor();
11
- static _CurrentWriteFence: _WriteFence;
12
- beginWrite(): {
13
- committed: () => void;
14
- };
15
- arm(): void;
16
- onBeforeFire(func: any): void;
17
- onAllCommitted(func: any): void;
18
- _maybeFire(): void;
19
- retire(): void;
20
- }
1
+ import { OplogObserveDriver } from "../mongo/oplog-observe-driver";
2
+ export declare class _WriteFence {
3
+ fired: boolean;
4
+ _oplogObserveDrivers: Record<string, OplogObserveDriver>;
5
+ private armed;
6
+ private retired;
7
+ private outstanding_writes;
8
+ private before_fire_callbacks;
9
+ private completion_callbacks;
10
+ constructor();
11
+ static _CurrentWriteFence: _WriteFence;
12
+ beginWrite(): {
13
+ committed: () => void;
14
+ };
15
+ arm(): void;
16
+ onBeforeFire(func: any): void;
17
+ onAllCommitted(func: any): void;
18
+ _maybeFire(): void;
19
+ retire(): void;
20
+ }
@@ -1,111 +1,111 @@
1
- "use strict";
2
- // A write fence collects a group of writes, and provides a callback
3
- // when all of the writes are fully committed and propagated (all
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports._WriteFence = void 0;
6
- // observers have been notified of the write and acknowledged it.)
7
- class _WriteFence {
8
- constructor() {
9
- this.armed = false;
10
- this.fired = false;
11
- this.retired = false;
12
- this.outstanding_writes = 0;
13
- this.before_fire_callbacks = [];
14
- this.completion_callbacks = [];
15
- }
16
- ;
17
- // Start tracking a write, and return an object to represent it. The
18
- // object has a single method, committed(). This method should be
19
- // called when the write is fully committed and propagated. You can
20
- // continue to add writes to the WriteFence up until it is triggered
21
- // (calls its callbacks because all writes have committed.)
22
- beginWrite() {
23
- var self = this;
24
- if (self.retired)
25
- return { committed: function () { } };
26
- if (self.fired)
27
- throw new Error("fence has already activated -- too late to add writes");
28
- self.outstanding_writes++;
29
- var committed = false;
30
- return {
31
- committed: function () {
32
- if (committed)
33
- throw new Error("committed called twice on the same write");
34
- committed = true;
35
- self.outstanding_writes--;
36
- self._maybeFire();
37
- }
38
- };
39
- }
40
- // Arm the fence. Once the fence is armed, and there are no more
41
- // uncommitted writes, it will activate.
42
- arm() {
43
- var self = this;
44
- if (self === _WriteFence._CurrentWriteFence)
45
- throw Error("Can't arm the current fence");
46
- self.armed = true;
47
- self._maybeFire();
48
- }
49
- // Register a function to be called once before firing the fence.
50
- // Callback function can add new writes to the fence, in which case
51
- // it won't fire until those writes are done as well.
52
- onBeforeFire(func) {
53
- var self = this;
54
- if (self.fired)
55
- throw new Error("fence has already activated -- too late to " +
56
- "add a callback");
57
- self.before_fire_callbacks.push(func);
58
- }
59
- // Register a function to be called when the fence fires.
60
- onAllCommitted(func) {
61
- var self = this;
62
- if (self.fired)
63
- throw new Error("fence has already activated -- too late to " +
64
- "add a callback");
65
- self.completion_callbacks.push(func);
66
- }
67
- _maybeFire() {
68
- var self = this;
69
- if (self.fired)
70
- throw new Error("write fence already activated?");
71
- if (self.armed && !self.outstanding_writes) {
72
- self.outstanding_writes++;
73
- while (self.before_fire_callbacks.length > 0) {
74
- var callbacks = self.before_fire_callbacks;
75
- self.before_fire_callbacks = [];
76
- for (const callback of callbacks)
77
- invokeCallback(callback, self);
78
- }
79
- self.outstanding_writes--;
80
- if (!self.outstanding_writes) {
81
- self.fired = true;
82
- var callbacks = self.completion_callbacks;
83
- self.completion_callbacks = [];
84
- for (const callback of callbacks)
85
- invokeCallback(callback, self);
86
- }
87
- }
88
- }
89
- // Deactivate this fence so that adding more writes has no effect.
90
- // The fence must have already fired.
91
- retire() {
92
- var self = this;
93
- if (!self.fired)
94
- throw new Error("Can't retire a fence that hasn't fired.");
95
- self.retired = true;
96
- }
97
- }
98
- exports._WriteFence = _WriteFence;
99
- // The current write fence. When there is a current write fence, code
100
- // that writes to databases should register their writes with it using
101
- // beginWrite().
102
- //
103
- _WriteFence._CurrentWriteFence = new _WriteFence();
104
- function invokeCallback(func, self) {
105
- try {
106
- func(self);
107
- }
108
- catch (err) {
109
- console.error("exception in write fence callback", err);
110
- }
111
- }
1
+ "use strict";
2
+ // A write fence collects a group of writes, and provides a callback
3
+ // when all of the writes are fully committed and propagated (all
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports._WriteFence = void 0;
6
+ // observers have been notified of the write and acknowledged it.)
7
+ class _WriteFence {
8
+ constructor() {
9
+ this.armed = false;
10
+ this.fired = false;
11
+ this.retired = false;
12
+ this.outstanding_writes = 0;
13
+ this.before_fire_callbacks = [];
14
+ this.completion_callbacks = [];
15
+ }
16
+ ;
17
+ // Start tracking a write, and return an object to represent it. The
18
+ // object has a single method, committed(). This method should be
19
+ // called when the write is fully committed and propagated. You can
20
+ // continue to add writes to the WriteFence up until it is triggered
21
+ // (calls its callbacks because all writes have committed.)
22
+ beginWrite() {
23
+ var self = this;
24
+ if (self.retired)
25
+ return { committed: function () { } };
26
+ if (self.fired)
27
+ throw new Error("fence has already activated -- too late to add writes");
28
+ self.outstanding_writes++;
29
+ var committed = false;
30
+ return {
31
+ committed: function () {
32
+ if (committed)
33
+ throw new Error("committed called twice on the same write");
34
+ committed = true;
35
+ self.outstanding_writes--;
36
+ self._maybeFire();
37
+ }
38
+ };
39
+ }
40
+ // Arm the fence. Once the fence is armed, and there are no more
41
+ // uncommitted writes, it will activate.
42
+ arm() {
43
+ var self = this;
44
+ if (self === _WriteFence._CurrentWriteFence)
45
+ throw Error("Can't arm the current fence");
46
+ self.armed = true;
47
+ self._maybeFire();
48
+ }
49
+ // Register a function to be called once before firing the fence.
50
+ // Callback function can add new writes to the fence, in which case
51
+ // it won't fire until those writes are done as well.
52
+ onBeforeFire(func) {
53
+ var self = this;
54
+ if (self.fired)
55
+ throw new Error("fence has already activated -- too late to " +
56
+ "add a callback");
57
+ self.before_fire_callbacks.push(func);
58
+ }
59
+ // Register a function to be called when the fence fires.
60
+ onAllCommitted(func) {
61
+ var self = this;
62
+ if (self.fired)
63
+ throw new Error("fence has already activated -- too late to " +
64
+ "add a callback");
65
+ self.completion_callbacks.push(func);
66
+ }
67
+ _maybeFire() {
68
+ var self = this;
69
+ if (self.fired)
70
+ throw new Error("write fence already activated?");
71
+ if (self.armed && !self.outstanding_writes) {
72
+ self.outstanding_writes++;
73
+ while (self.before_fire_callbacks.length > 0) {
74
+ var callbacks = self.before_fire_callbacks;
75
+ self.before_fire_callbacks = [];
76
+ for (const callback of callbacks)
77
+ invokeCallback(callback, self);
78
+ }
79
+ self.outstanding_writes--;
80
+ if (!self.outstanding_writes) {
81
+ self.fired = true;
82
+ var callbacks = self.completion_callbacks;
83
+ self.completion_callbacks = [];
84
+ for (const callback of callbacks)
85
+ invokeCallback(callback, self);
86
+ }
87
+ }
88
+ }
89
+ // Deactivate this fence so that adding more writes has no effect.
90
+ // The fence must have already fired.
91
+ retire() {
92
+ var self = this;
93
+ if (!self.fired)
94
+ throw new Error("Can't retire a fence that hasn't fired.");
95
+ self.retired = true;
96
+ }
97
+ }
98
+ exports._WriteFence = _WriteFence;
99
+ // The current write fence. When there is a current write fence, code
100
+ // that writes to databases should register their writes with it using
101
+ // beginWrite().
102
+ //
103
+ _WriteFence._CurrentWriteFence = new _WriteFence();
104
+ function invokeCallback(func, self) {
105
+ try {
106
+ func(self);
107
+ }
108
+ catch (err) {
109
+ console.error("exception in write fence callback", err);
110
+ }
111
+ }
@@ -1,17 +1,17 @@
1
- interface DiffCallbacks {
2
- both: (key: string, left: any, right: any) => void;
3
- leftOnly: (key: string, value: any) => void;
4
- rightOnly: (key: string, value: any) => void;
5
- }
6
- interface DiffSequence {
7
- diffQueryChanges(ordered: boolean, oldResults: any[], newResults: any[], observer: any, options?: any): any;
8
- diffQueryChanges(ordered: boolean, oldResults: Map<string, any>, newResults: Map<string, any>, observer: any, options?: any): any;
9
- diffQueryUnorderedChanges(oldResults: any, newResults: any, observer: any, options?: any): any;
10
- diffQueryOrderedChanges(old_results: any, new_results: any, observer: any, options?: any): any;
11
- diffObjects(left: Record<string, any>, right: Record<string, any>, callbacks: DiffCallbacks): any;
12
- diffMaps(left: Map<string, any>, right: Map<string, any>, callbacks: DiffCallbacks): any;
13
- makeChangedFields(newDoc: Record<string, any>, oldDoc: Record<string, any>): any;
14
- applyChanges(doc: Record<string, any>, changeFields: Record<string, any>): void;
15
- }
16
- export declare const DiffSequence: DiffSequence;
17
- export {};
1
+ interface DiffCallbacks {
2
+ both: (key: string, left: any, right: any) => void;
3
+ leftOnly: (key: string, value: any) => void;
4
+ rightOnly: (key: string, value: any) => void;
5
+ }
6
+ interface DiffSequence {
7
+ diffQueryChanges(ordered: boolean, oldResults: any[], newResults: any[], observer: any, options?: any): any;
8
+ diffQueryChanges(ordered: boolean, oldResults: Map<string, any>, newResults: Map<string, any>, observer: any, options?: any): any;
9
+ diffQueryUnorderedChanges(oldResults: any, newResults: any, observer: any, options?: any): any;
10
+ diffQueryOrderedChanges(old_results: any, new_results: any, observer: any, options?: any): any;
11
+ diffObjects(left: Record<string, any>, right: Record<string, any>, callbacks: DiffCallbacks): any;
12
+ diffMaps(left: Map<string, any>, right: Map<string, any>, callbacks: DiffCallbacks): any;
13
+ makeChangedFields(newDoc: Record<string, any>, oldDoc: Record<string, any>): any;
14
+ applyChanges(doc: Record<string, any>, changeFields: Record<string, any>): void;
15
+ }
16
+ export declare const DiffSequence: DiffSequence;
17
+ export {};