mongodb-livedata-server 0.0.4 → 0.0.6
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/{livedata_server.ts → dist/livedata_server.d.ts} +1 -1
- package/dist/livedata_server.js +3 -1
- package/dist/meteor/binary-heap/max_heap.d.ts +31 -0
- package/dist/meteor/binary-heap/min_heap.d.ts +6 -0
- package/dist/meteor/binary-heap/min_max_heap.d.ts +11 -0
- package/dist/meteor/callback-hook/hook.d.ts +11 -0
- package/dist/meteor/ddp/crossbar.d.ts +15 -0
- package/dist/meteor/ddp/heartbeat.d.ts +19 -0
- package/dist/meteor/ddp/livedata_server.d.ts +141 -0
- package/dist/meteor/ddp/method-invocation.d.ts +25 -0
- package/dist/meteor/ddp/random-stream.d.ts +8 -0
- package/dist/meteor/ddp/session-collection-view.d.ts +27 -0
- package/dist/meteor/ddp/session-document-view.d.ts +8 -0
- package/dist/meteor/ddp/session.d.ts +69 -0
- package/dist/meteor/ddp/stream_server.d.ts +21 -0
- package/dist/meteor/ddp/subscription.d.ts +89 -0
- package/dist/meteor/ddp/utils.d.ts +8 -0
- package/dist/meteor/ddp/writefence.d.ts +20 -0
- package/dist/meteor/diff-sequence/diff.d.ts +13 -0
- package/dist/meteor/ejson/ejson.d.ts +82 -0
- package/dist/meteor/ejson/stringify.d.ts +2 -0
- package/dist/meteor/ejson/utils.d.ts +12 -0
- package/dist/meteor/id-map/id_map.d.ts +16 -0
- package/dist/meteor/mongo/caching_change_observer.d.ts +16 -0
- package/dist/meteor/mongo/doc_fetcher.d.ts +7 -0
- package/dist/meteor/mongo/geojson_utils.d.ts +3 -0
- package/dist/meteor/mongo/live_connection.d.ts +27 -0
- package/dist/meteor/mongo/live_cursor.d.ts +25 -0
- package/dist/meteor/mongo/minimongo_common.d.ts +84 -0
- package/dist/meteor/mongo/minimongo_matcher.d.ts +22 -0
- package/dist/meteor/mongo/minimongo_sorter.d.ts +16 -0
- package/dist/meteor/mongo/observe_driver_utils.d.ts +9 -0
- package/dist/meteor/mongo/observe_multiplexer.d.ts +36 -0
- package/dist/meteor/mongo/oplog-observe-driver.d.ts +67 -0
- package/dist/meteor/mongo/oplog_tailing.d.ts +35 -0
- package/dist/meteor/mongo/oplog_v2_converter.d.ts +1 -0
- package/dist/meteor/mongo/polling_observe_driver.d.ts +30 -0
- package/dist/meteor/mongo/synchronous-cursor.d.ts +17 -0
- package/dist/meteor/mongo/synchronous-queue.d.ts +14 -0
- package/dist/meteor/ordered-dict/ordered_dict.d.ts +31 -0
- package/dist/meteor/random/AbstractRandomGenerator.d.ts +42 -0
- package/dist/meteor/random/AleaRandomGenerator.d.ts +13 -0
- package/dist/meteor/random/NodeRandomGenerator.d.ts +16 -0
- package/dist/meteor/random/createAleaGenerator.d.ts +2 -0
- package/dist/meteor/random/createRandom.d.ts +1 -0
- package/dist/meteor/random/main.d.ts +1 -0
- package/package.json +2 -2
- package/meteor/LICENSE +0 -28
- package/meteor/binary-heap/max_heap.ts +0 -225
- package/meteor/binary-heap/min_heap.ts +0 -15
- package/meteor/binary-heap/min_max_heap.ts +0 -53
- package/meteor/callback-hook/hook.ts +0 -85
- package/meteor/ddp/crossbar.ts +0 -148
- package/meteor/ddp/heartbeat.ts +0 -97
- package/meteor/ddp/livedata_server.ts +0 -474
- package/meteor/ddp/method-invocation.ts +0 -86
- package/meteor/ddp/random-stream.ts +0 -102
- package/meteor/ddp/session-collection-view.ts +0 -119
- package/meteor/ddp/session-document-view.ts +0 -92
- package/meteor/ddp/session.ts +0 -708
- package/meteor/ddp/stream_server.ts +0 -204
- package/meteor/ddp/subscription.ts +0 -392
- package/meteor/ddp/utils.ts +0 -119
- package/meteor/ddp/writefence.ts +0 -130
- package/meteor/diff-sequence/diff.ts +0 -295
- package/meteor/ejson/ejson.ts +0 -601
- package/meteor/ejson/stringify.ts +0 -122
- package/meteor/ejson/utils.ts +0 -38
- package/meteor/id-map/id_map.ts +0 -84
- package/meteor/mongo/caching_change_observer.ts +0 -120
- package/meteor/mongo/doc_fetcher.ts +0 -52
- package/meteor/mongo/geojson_utils.ts +0 -42
- package/meteor/mongo/live_connection.ts +0 -302
- package/meteor/mongo/live_cursor.ts +0 -79
- package/meteor/mongo/minimongo_common.ts +0 -2440
- package/meteor/mongo/minimongo_matcher.ts +0 -275
- package/meteor/mongo/minimongo_sorter.ts +0 -331
- package/meteor/mongo/observe_driver_utils.ts +0 -79
- package/meteor/mongo/observe_multiplexer.ts +0 -256
- package/meteor/mongo/oplog-observe-driver.ts +0 -1049
- package/meteor/mongo/oplog_tailing.ts +0 -414
- package/meteor/mongo/oplog_v2_converter.ts +0 -124
- package/meteor/mongo/polling_observe_driver.ts +0 -247
- package/meteor/mongo/synchronous-cursor.ts +0 -293
- package/meteor/mongo/synchronous-queue.ts +0 -119
- package/meteor/ordered-dict/ordered_dict.ts +0 -229
- package/meteor/random/AbstractRandomGenerator.ts +0 -99
- package/meteor/random/AleaRandomGenerator.ts +0 -96
- package/meteor/random/NodeRandomGenerator.ts +0 -37
- package/meteor/random/createAleaGenerator.ts +0 -31
- package/meteor/random/createRandom.ts +0 -19
- package/meteor/random/main.ts +0 -8
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class IdMap {
|
|
2
|
+
private _map;
|
|
3
|
+
private _idStringify;
|
|
4
|
+
private _idParse;
|
|
5
|
+
constructor(idStringify?: (obj: any) => string, idParse?: (str: string) => any);
|
|
6
|
+
get(id: any): any;
|
|
7
|
+
set(id: any, value: any): void;
|
|
8
|
+
remove(id: any): void;
|
|
9
|
+
has(id: any): boolean;
|
|
10
|
+
empty(): boolean;
|
|
11
|
+
clear(): void;
|
|
12
|
+
forEach(iterator: any): void;
|
|
13
|
+
size(): number;
|
|
14
|
+
setDefault(id: any, def: any): any;
|
|
15
|
+
clone(): IdMap;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OrderedDict } from "../ordered-dict/ordered_dict";
|
|
2
|
+
export declare class _CachingChangeObserver {
|
|
3
|
+
docs: OrderedDict | Map<string, any>;
|
|
4
|
+
applyChange: {
|
|
5
|
+
added?: (id: string, fields: any) => void;
|
|
6
|
+
changed?: (id: string, fields: any) => void;
|
|
7
|
+
removed?: (id: string) => void;
|
|
8
|
+
addedBefore?: (id: string, fields: any, before: any) => void;
|
|
9
|
+
movedBefore?: (id: string, before: any) => void;
|
|
10
|
+
};
|
|
11
|
+
private ordered;
|
|
12
|
+
constructor(options?: {
|
|
13
|
+
callbacks?: any;
|
|
14
|
+
ordered?: boolean;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Db } from "mongodb";
|
|
2
|
+
import { CursorDescription } from "./live_cursor";
|
|
3
|
+
import { OplogHandle } from "./oplog_tailing";
|
|
4
|
+
import { DocFetcher } from "./doc_fetcher";
|
|
5
|
+
export declare class LiveMongoConnection {
|
|
6
|
+
private client;
|
|
7
|
+
db: Db;
|
|
8
|
+
_oplogHandle: OplogHandle;
|
|
9
|
+
_docFetcher: DocFetcher;
|
|
10
|
+
private _observeMultiplexers;
|
|
11
|
+
private _onFailoverHook;
|
|
12
|
+
constructor(url: string, options?: any);
|
|
13
|
+
close(): void;
|
|
14
|
+
tail<T>(cursorDescription: CursorDescription<T>, docCallback: (doc: T) => void, timeoutMS?: number): {
|
|
15
|
+
stop: () => void;
|
|
16
|
+
};
|
|
17
|
+
_observeChanges(cursorDescription: CursorDescription<any>, ordered: boolean, callbacks: any, nonMutatingCallbacks: boolean): {
|
|
18
|
+
stop: () => void;
|
|
19
|
+
};
|
|
20
|
+
_observeChangesTailable(cursorDescription: CursorDescription<any>, ordered: boolean, callbacks: any): {
|
|
21
|
+
stop: () => void;
|
|
22
|
+
};
|
|
23
|
+
_onFailover(callback: Function): {
|
|
24
|
+
callback: any;
|
|
25
|
+
stop: () => void;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Subscription } from "../ddp/subscription";
|
|
2
|
+
import MongoDB, { WithId } from "mongodb";
|
|
3
|
+
import { LiveMongoConnection } from "./live_connection";
|
|
4
|
+
interface CustomFindOptions<T> extends MongoDB.FindOptions<WithId<T>> {
|
|
5
|
+
pollingThrottleMs?: number;
|
|
6
|
+
pollingIntervalMs?: number;
|
|
7
|
+
transform?: (doc: T) => T;
|
|
8
|
+
maxTimeMs?: number;
|
|
9
|
+
disableOplog?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class CursorDescription<T> {
|
|
12
|
+
collectionName: string;
|
|
13
|
+
selector: MongoDB.Filter<WithId<T>>;
|
|
14
|
+
options: CustomFindOptions<WithId<T>>;
|
|
15
|
+
constructor(collectionName: string, selector: MongoDB.Filter<WithId<T>>, options?: CustomFindOptions<WithId<T>>);
|
|
16
|
+
}
|
|
17
|
+
export declare class LiveCursor<T> {
|
|
18
|
+
mongo: LiveMongoConnection;
|
|
19
|
+
cursorDescription: CursorDescription<T>;
|
|
20
|
+
constructor(mongo: LiveMongoConnection, collectionName: string, selector: MongoDB.Filter<WithId<T>>, options: CustomFindOptions<WithId<T>>);
|
|
21
|
+
_publishCursor(sub: Subscription): {
|
|
22
|
+
stop: () => void;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export declare const hasOwn: (v: PropertyKey) => boolean;
|
|
2
|
+
export declare const ELEMENT_OPERATORS: {
|
|
3
|
+
$lt: {
|
|
4
|
+
compileElementSelector(operand: any): (value: any) => any;
|
|
5
|
+
};
|
|
6
|
+
$gt: {
|
|
7
|
+
compileElementSelector(operand: any): (value: any) => any;
|
|
8
|
+
};
|
|
9
|
+
$lte: {
|
|
10
|
+
compileElementSelector(operand: any): (value: any) => any;
|
|
11
|
+
};
|
|
12
|
+
$gte: {
|
|
13
|
+
compileElementSelector(operand: any): (value: any) => any;
|
|
14
|
+
};
|
|
15
|
+
$mod: {
|
|
16
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
17
|
+
};
|
|
18
|
+
$in: {
|
|
19
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
20
|
+
};
|
|
21
|
+
$size: {
|
|
22
|
+
dontExpandLeafArrays: boolean;
|
|
23
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
24
|
+
};
|
|
25
|
+
$type: {
|
|
26
|
+
dontIncludeLeafArrays: boolean;
|
|
27
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
28
|
+
};
|
|
29
|
+
$bitsAllSet: {
|
|
30
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
31
|
+
};
|
|
32
|
+
$bitsAnySet: {
|
|
33
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
34
|
+
};
|
|
35
|
+
$bitsAllClear: {
|
|
36
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
37
|
+
};
|
|
38
|
+
$bitsAnyClear: {
|
|
39
|
+
compileElementSelector(operand: any): (value: any) => boolean;
|
|
40
|
+
};
|
|
41
|
+
$regex: {
|
|
42
|
+
compileElementSelector(operand: any, valueSelector: any): (value: any) => any;
|
|
43
|
+
};
|
|
44
|
+
$elemMatch: {
|
|
45
|
+
dontExpandLeafArrays: boolean;
|
|
46
|
+
compileElementSelector(operand: any, valueSelector: any, matcher: any): (value: any) => number | false;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function compileDocumentSelector(docSelector: any, matcher: any, options?: {
|
|
50
|
+
isRoot?: boolean;
|
|
51
|
+
inElemMatch?: boolean;
|
|
52
|
+
}): any;
|
|
53
|
+
export declare function equalityElementMatcher(elementSelector: any): (value: any) => any;
|
|
54
|
+
export declare function expandArraysInBranches(branches: any, skipTheArrays?: boolean): any[];
|
|
55
|
+
export declare function isIndexable(obj: any): boolean;
|
|
56
|
+
export declare function isNumericKey(s: any): boolean;
|
|
57
|
+
export declare function isOperatorObject(valueSelector: any, inconsistentOK?: any): boolean;
|
|
58
|
+
export declare function makeLookupFunction(key: any, options?: {
|
|
59
|
+
forSort?: boolean;
|
|
60
|
+
}): (doc: any, arrayIndices?: any[]) => any[];
|
|
61
|
+
export declare function nothingMatcher(docOrBranchedValues: any): {
|
|
62
|
+
result: boolean;
|
|
63
|
+
};
|
|
64
|
+
export declare function pathsToTree(paths: any, newLeafFn: any, conflictFn: any, root?: {}): {};
|
|
65
|
+
export declare function populateDocumentWithQueryFields(query: any, document?: {}): {};
|
|
66
|
+
export declare function projectionDetails(fields: any): {
|
|
67
|
+
including: any;
|
|
68
|
+
tree: {};
|
|
69
|
+
};
|
|
70
|
+
export declare function regexpElementMatcher(regexp: any): (value: any) => any;
|
|
71
|
+
export declare const _f: {
|
|
72
|
+
_type(v: any): 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 13;
|
|
73
|
+
_equal(a: any, b: any): any;
|
|
74
|
+
_typeorder(t: any): number;
|
|
75
|
+
_cmp(a: any, b: any): any;
|
|
76
|
+
};
|
|
77
|
+
export declare function _checkSupportedProjection(fields: any): void;
|
|
78
|
+
export declare function _modify(doc: any, modifier: any, options?: {
|
|
79
|
+
isInsert?: boolean;
|
|
80
|
+
arrayIndices?: number[];
|
|
81
|
+
}): void;
|
|
82
|
+
export declare function combineImportantPathsIntoProjection(paths: any, projection: any): {};
|
|
83
|
+
export declare function _pathsElidingNumericKeys(paths: any): any;
|
|
84
|
+
export declare function _compileProjection(fields: any): (doc: any) => any;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Filter } from 'mongodb';
|
|
2
|
+
export declare class MinimongoMatcher {
|
|
3
|
+
private _paths;
|
|
4
|
+
private _hasGeoQuery;
|
|
5
|
+
private _hasWhere;
|
|
6
|
+
private _isSimple;
|
|
7
|
+
private _matchingDocument;
|
|
8
|
+
private _selector;
|
|
9
|
+
private _docMatcher;
|
|
10
|
+
private _isUpdate;
|
|
11
|
+
constructor(selector: Filter<any>, isUpdate?: boolean);
|
|
12
|
+
documentMatches(doc: any): any;
|
|
13
|
+
hasGeoQuery(): boolean;
|
|
14
|
+
hasWhere(): boolean;
|
|
15
|
+
isSimple(): boolean;
|
|
16
|
+
_compileSelector(selector: Filter<any>): any;
|
|
17
|
+
affectedByModifier(modifier: any): boolean;
|
|
18
|
+
canBecomeTrueByModifier: (modifier: any) => any;
|
|
19
|
+
combineIntoProjection(projection: any): {};
|
|
20
|
+
_getPaths(): string[];
|
|
21
|
+
_recordPathUsed(path: any): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default class MinimongoSorter {
|
|
2
|
+
private _sortSpecParts;
|
|
3
|
+
private _sortFunction;
|
|
4
|
+
private _keyComparator;
|
|
5
|
+
private _selectorForAffectedByModifier;
|
|
6
|
+
constructor(spec: any);
|
|
7
|
+
affectedByModifier(modifier: any): boolean;
|
|
8
|
+
getComparator(options?: any): (a: any, b: any) => number;
|
|
9
|
+
_compareKeys(key1: any, key2: any): number;
|
|
10
|
+
_generateKeysFromDoc(doc: any, cb: any): void;
|
|
11
|
+
_getBaseComparator(): (a: any, b: any) => number;
|
|
12
|
+
_getMinKeyFromDoc(doc: any): any;
|
|
13
|
+
_getPaths(): string[];
|
|
14
|
+
_keyFieldComparator(i: number): (key1: any, key2: any) => any;
|
|
15
|
+
combineIntoProjection: (projection: any) => {};
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import MongoDB from "mongodb";
|
|
2
|
+
import { CursorDescription } from "./live_cursor";
|
|
3
|
+
export declare function listenAll(cursorDescription: CursorDescription<any>, listenCallback: Function): {
|
|
4
|
+
stop: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function forEachTrigger(cursorDescription: CursorDescription<any>, triggerCallback: Function): void;
|
|
7
|
+
export declare function _idsMatchedBySelector(selector: MongoDB.Filter<{
|
|
8
|
+
_id: string;
|
|
9
|
+
}>): any;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare class ObserveMultiplexer {
|
|
2
|
+
private _ordered;
|
|
3
|
+
private _onStop;
|
|
4
|
+
private _queue;
|
|
5
|
+
private _handles;
|
|
6
|
+
private _readyFuture;
|
|
7
|
+
private _cache;
|
|
8
|
+
private _addHandleTasksScheduledButNotPerformed;
|
|
9
|
+
added: (id: string, fields: Record<string, any>) => void;
|
|
10
|
+
changed: (id: string, fields: Record<string, any>) => void;
|
|
11
|
+
removed: (id: string) => void;
|
|
12
|
+
constructor(options: any);
|
|
13
|
+
addHandleAndSendInitialAdds(handle: ObserveHandle): Promise<void>;
|
|
14
|
+
removeHandle(id: number): void;
|
|
15
|
+
_stop(options?: any): void;
|
|
16
|
+
ready(): void;
|
|
17
|
+
queryError(err: Error): void;
|
|
18
|
+
onFlush(cb: any): void;
|
|
19
|
+
callbackNames(): string[];
|
|
20
|
+
_ready(): boolean;
|
|
21
|
+
_applyCallback(callbackName: string, args: any): void;
|
|
22
|
+
_sendAdds(handle: ObserveHandle): void;
|
|
23
|
+
}
|
|
24
|
+
export declare class ObserveHandle {
|
|
25
|
+
private _multiplexer;
|
|
26
|
+
nonMutatingCallbacks: boolean;
|
|
27
|
+
_id: number;
|
|
28
|
+
_addedBefore: Function;
|
|
29
|
+
_movedBefore: Function;
|
|
30
|
+
_added: Function;
|
|
31
|
+
_changed: Function;
|
|
32
|
+
_removed: Function;
|
|
33
|
+
private _stopped;
|
|
34
|
+
constructor(_multiplexer: ObserveMultiplexer, callbacks: Record<string, Function>, nonMutatingCallbacks?: boolean);
|
|
35
|
+
stop(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LiveMongoConnection } from "./live_connection";
|
|
2
|
+
import { MinimongoMatcher } from "./minimongo_matcher";
|
|
3
|
+
import MinimongoSorter from "./minimongo_sorter";
|
|
4
|
+
import { ObserveMultiplexer } from "./observe_multiplexer";
|
|
5
|
+
import { CursorDescription } from "./live_cursor";
|
|
6
|
+
import { IdMap } from "../id-map/id_map";
|
|
7
|
+
import { SynchronousCursor } from "./synchronous-cursor";
|
|
8
|
+
interface OplogObserveDriverOptions {
|
|
9
|
+
cursorDescription: CursorDescription<any>;
|
|
10
|
+
mongoHandle: LiveMongoConnection;
|
|
11
|
+
ordered: boolean;
|
|
12
|
+
multiplexer: ObserveMultiplexer;
|
|
13
|
+
matcher: MinimongoMatcher;
|
|
14
|
+
sorter: MinimongoSorter;
|
|
15
|
+
}
|
|
16
|
+
export declare class OplogObserveDriver {
|
|
17
|
+
private _usesOplog;
|
|
18
|
+
private _id;
|
|
19
|
+
private _cursorDescription;
|
|
20
|
+
private _mongoHandle;
|
|
21
|
+
private _multiplexer;
|
|
22
|
+
private _safeAppendToBuffer;
|
|
23
|
+
private _stopped;
|
|
24
|
+
private _stopHandles;
|
|
25
|
+
private _matcher;
|
|
26
|
+
private _projectionFn;
|
|
27
|
+
private _sharedProjection;
|
|
28
|
+
private _sharedProjectionFn;
|
|
29
|
+
private _limit;
|
|
30
|
+
private _comparator;
|
|
31
|
+
private _sorter;
|
|
32
|
+
private _unpublishedBuffer;
|
|
33
|
+
private _published;
|
|
34
|
+
private _needToFetch;
|
|
35
|
+
private _currentlyFetching;
|
|
36
|
+
private _fetchGeneration;
|
|
37
|
+
private _requeryWhenDoneThisQuery;
|
|
38
|
+
private _writesToCommitWhenWeReachSteady;
|
|
39
|
+
private _phase;
|
|
40
|
+
private _phaseStartTime;
|
|
41
|
+
constructor(options: OplogObserveDriverOptions);
|
|
42
|
+
_addPublished(id: any, doc: any): void;
|
|
43
|
+
_removePublished(id: any): void;
|
|
44
|
+
_changePublished(id: any, oldDoc: any, newDoc: any): void;
|
|
45
|
+
_addBuffered(id: any, doc: any): void;
|
|
46
|
+
_removeBuffered(id: any): void;
|
|
47
|
+
_addMatching(doc: any): void;
|
|
48
|
+
_removeMatching(id: any): void;
|
|
49
|
+
_handleDoc(id: any, newDoc: any): void;
|
|
50
|
+
_fetchModifiedDocuments(): void;
|
|
51
|
+
_beSteady(): void;
|
|
52
|
+
_handleOplogEntryQuerying(op: any): void;
|
|
53
|
+
_handleOplogEntrySteadyOrFetching(op: any): void;
|
|
54
|
+
_runInitialQuery(): void;
|
|
55
|
+
_pollQuery(): void;
|
|
56
|
+
_runQuery(options?: any): Promise<void>;
|
|
57
|
+
_needToPollQuery(): void;
|
|
58
|
+
_doneQuerying(): Promise<void>;
|
|
59
|
+
_cursorForQuery(optionsOverwrite: {
|
|
60
|
+
limit: number;
|
|
61
|
+
}): SynchronousCursor;
|
|
62
|
+
_publishNewResults(newResults: IdMap, newBuffer: IdMap): void;
|
|
63
|
+
stop(): void;
|
|
64
|
+
_registerPhaseChange(phase: any): void;
|
|
65
|
+
static cursorSupported(cursorDescription: CursorDescription<any>, matcher: MinimongoMatcher): boolean;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const OPLOG_COLLECTION = "oplog.rs";
|
|
2
|
+
export declare function idForOp(op: any): any;
|
|
3
|
+
export declare class OplogHandle {
|
|
4
|
+
private _oplogUrl;
|
|
5
|
+
private _dbName;
|
|
6
|
+
private _oplogLastEntryConnection;
|
|
7
|
+
private _oplogTailConnection;
|
|
8
|
+
private _stopped;
|
|
9
|
+
private _tailHandle;
|
|
10
|
+
private _crossbar;
|
|
11
|
+
private _baseOplogSelector;
|
|
12
|
+
private _catchingUpFutures;
|
|
13
|
+
private _onSkippedEntriesHook;
|
|
14
|
+
private _entryQueue;
|
|
15
|
+
private _workerActive;
|
|
16
|
+
private _lastProcessedTS;
|
|
17
|
+
private _readyFuture;
|
|
18
|
+
constructor(oplogUrl: string, dbName: string);
|
|
19
|
+
stop(): void;
|
|
20
|
+
onOplogEntry(trigger: Record<string, any>, callback: (notification: Record<string, any>) => void): Promise<{
|
|
21
|
+
stop: () => void;
|
|
22
|
+
}>;
|
|
23
|
+
onSkippedEntries(callback: any): {
|
|
24
|
+
callback: any;
|
|
25
|
+
stop: () => void;
|
|
26
|
+
};
|
|
27
|
+
waitUntilCaughtUp(): Promise<void>;
|
|
28
|
+
_startTailing(): Promise<void>;
|
|
29
|
+
_maybeStartWorker(): void;
|
|
30
|
+
_setLastProcessedTS(ts: any): void;
|
|
31
|
+
_defineTooFarBehind(value: any): void;
|
|
32
|
+
_resetTooFarBehind(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function _sleepForMs(ms: number): Promise<unknown>;
|
|
35
|
+
export declare function _escapeRegExp(s: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function oplogV2V1Converter(oplogEntry: any): any;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LiveMongoConnection } from "./live_connection";
|
|
2
|
+
import { ObserveMultiplexer } from "./observe_multiplexer";
|
|
3
|
+
import { CursorDescription } from "./live_cursor";
|
|
4
|
+
interface PollingObserveDriverOptions<TOrdered extends boolean> {
|
|
5
|
+
cursorDescription: CursorDescription<any>;
|
|
6
|
+
mongoHandle: LiveMongoConnection;
|
|
7
|
+
ordered: TOrdered;
|
|
8
|
+
multiplexer: ObserveMultiplexer;
|
|
9
|
+
stopCallbacks?: (() => void)[];
|
|
10
|
+
matcher?: any;
|
|
11
|
+
sorter?: any;
|
|
12
|
+
}
|
|
13
|
+
export declare class PollingObserveDriver<TOrdered extends boolean> {
|
|
14
|
+
private _cursorDescription;
|
|
15
|
+
private _mongoHandle;
|
|
16
|
+
private _ordered;
|
|
17
|
+
private _multiplexer;
|
|
18
|
+
private _stopCallbacks;
|
|
19
|
+
private _stopped;
|
|
20
|
+
private _results;
|
|
21
|
+
private _pollsScheduledButNotStarted;
|
|
22
|
+
private _pendingWrites;
|
|
23
|
+
private _ensurePollIsScheduled;
|
|
24
|
+
private _taskQueue;
|
|
25
|
+
constructor(options: PollingObserveDriverOptions<TOrdered>);
|
|
26
|
+
_unthrottledEnsurePollIsScheduled(): void;
|
|
27
|
+
_pollMongo(): Promise<void>;
|
|
28
|
+
stop(): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import MongoDB from "mongodb";
|
|
2
|
+
import { CursorDescription } from "./live_cursor";
|
|
3
|
+
export declare function _createSynchronousCursor(db: MongoDB.Db, cursorDescription: CursorDescription<any>, options?: any): SynchronousCursor;
|
|
4
|
+
export declare class SynchronousCursor {
|
|
5
|
+
private _dbCursor;
|
|
6
|
+
private _cursorDescription;
|
|
7
|
+
private _transform;
|
|
8
|
+
private _visitedIds;
|
|
9
|
+
constructor(_dbCursor: MongoDB.FindCursor, _cursorDescription: CursorDescription<any>, options: {
|
|
10
|
+
useTransform?: boolean;
|
|
11
|
+
});
|
|
12
|
+
_nextObjectPromise(): Promise<any>;
|
|
13
|
+
_nextObjectPromiseWithTimeout(timeoutMS: number): Promise<any>;
|
|
14
|
+
close(): void;
|
|
15
|
+
forEach(callback: (doc: any, index: number, cursor: SynchronousCursor) => void, thisArg?: any): Promise<void>;
|
|
16
|
+
_rewind(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare type AsyncFunction = (...args: any[]) => Promise<any>;
|
|
2
|
+
export declare class _SynchronousQueue {
|
|
3
|
+
private _taskHandles;
|
|
4
|
+
private _runningOrRunScheduled;
|
|
5
|
+
private _draining;
|
|
6
|
+
constructor();
|
|
7
|
+
runTask(task: AsyncFunction): Promise<unknown>;
|
|
8
|
+
queueTask(task: AsyncFunction): void;
|
|
9
|
+
flush(): Promise<void>;
|
|
10
|
+
drain(): Promise<void>;
|
|
11
|
+
_scheduleRun(): void;
|
|
12
|
+
_run(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare class OrderedDict {
|
|
2
|
+
static BREAK: {
|
|
3
|
+
break: boolean;
|
|
4
|
+
};
|
|
5
|
+
private _dict;
|
|
6
|
+
private _first;
|
|
7
|
+
private _last;
|
|
8
|
+
private _size;
|
|
9
|
+
private _stringify;
|
|
10
|
+
constructor(...args: any[]);
|
|
11
|
+
_k(key: any): string;
|
|
12
|
+
empty(): boolean;
|
|
13
|
+
size(): number;
|
|
14
|
+
_linkEltIn(elt: any): void;
|
|
15
|
+
_linkEltOut(elt: any): void;
|
|
16
|
+
putBefore(key: any, item: any, before: any): void;
|
|
17
|
+
append(key: any, item: any): void;
|
|
18
|
+
remove(key: any): any;
|
|
19
|
+
get(key: any): any;
|
|
20
|
+
has(key: any): any;
|
|
21
|
+
forEach(iter: any, context?: any): void;
|
|
22
|
+
first(): any;
|
|
23
|
+
firstValue(): any;
|
|
24
|
+
last(): any;
|
|
25
|
+
lastValue(): any;
|
|
26
|
+
prev(key: any): any;
|
|
27
|
+
next(key: any): any;
|
|
28
|
+
moveBefore(key: any, before: any): void;
|
|
29
|
+
indexOf(key: any): any;
|
|
30
|
+
_checkRep(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export default class RandomGenerator {
|
|
2
|
+
/**
|
|
3
|
+
* @name Random.fraction
|
|
4
|
+
* @summary Return a number between 0 and 1, like `Math.random`.
|
|
5
|
+
* @locus Anywhere
|
|
6
|
+
*/
|
|
7
|
+
fraction(): number;
|
|
8
|
+
/**
|
|
9
|
+
* @name Random.hexString
|
|
10
|
+
* @summary Return a random string of `n` hexadecimal digits.
|
|
11
|
+
* @locus Anywhere
|
|
12
|
+
* @param {Number} n Length of the string
|
|
13
|
+
*/
|
|
14
|
+
hexString(digits: any): string;
|
|
15
|
+
_randomString(charsCount: any, alphabet: any): string;
|
|
16
|
+
/**
|
|
17
|
+
* @name Random.id
|
|
18
|
+
* @summary Return a unique identifier, such as `"Jjwjg6gouWLXhMGKW"`, that is
|
|
19
|
+
* likely to be unique in the whole world.
|
|
20
|
+
* @locus Anywhere
|
|
21
|
+
* @param {Number} [n] Optional length of the identifier in characters
|
|
22
|
+
* (defaults to 17)
|
|
23
|
+
*/
|
|
24
|
+
id(charsCount: any): string;
|
|
25
|
+
/**
|
|
26
|
+
* @name Random.secret
|
|
27
|
+
* @summary Return a random string of printable characters with 6 bits of
|
|
28
|
+
* entropy per character. Use `Random.secret` for security-critical secrets
|
|
29
|
+
* that are intended for machine, rather than human, consumption.
|
|
30
|
+
* @locus Anywhere
|
|
31
|
+
* @param {Number} [n] Optional length of the secret string (defaults to 43
|
|
32
|
+
* characters, or 256 bits of entropy)
|
|
33
|
+
*/
|
|
34
|
+
secret(charsCount: any): string;
|
|
35
|
+
/**
|
|
36
|
+
* @name Random.choice
|
|
37
|
+
* @summary Return a random element of the given array or string.
|
|
38
|
+
* @locus Anywhere
|
|
39
|
+
* @param {Array|String} arrayOrString Array or string to choose from
|
|
40
|
+
*/
|
|
41
|
+
choice(arrayOrString: any): any;
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RandomGenerator from './AbstractRandomGenerator';
|
|
2
|
+
export default class AleaRandomGenerator extends RandomGenerator {
|
|
3
|
+
private alea;
|
|
4
|
+
constructor({ seeds }?: {
|
|
5
|
+
seeds?: any[];
|
|
6
|
+
});
|
|
7
|
+
/**
|
|
8
|
+
* @name Random.fraction
|
|
9
|
+
* @summary Return a number between 0 and 1, like `Math.random`.
|
|
10
|
+
* @locus Anywhere
|
|
11
|
+
*/
|
|
12
|
+
fraction(): number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import RandomGenerator from './AbstractRandomGenerator';
|
|
2
|
+
export default class NodeRandomGenerator extends RandomGenerator {
|
|
3
|
+
/**
|
|
4
|
+
* @name Random.fraction
|
|
5
|
+
* @summary Return a number between 0 and 1, like `Math.random`.
|
|
6
|
+
* @locus Anywhere
|
|
7
|
+
*/
|
|
8
|
+
fraction(): number;
|
|
9
|
+
/**
|
|
10
|
+
* @name Random.hexString
|
|
11
|
+
* @summary Return a random string of `n` hexadecimal digits.
|
|
12
|
+
* @locus Anywhere
|
|
13
|
+
* @param {Number} n Length of the string
|
|
14
|
+
*/
|
|
15
|
+
hexString(digits: any): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createRandom(generator: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Random: any;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb-livedata-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "MongoDB live data server, extracted from Meteor, Fibers removed and converted to TypeScript",
|
|
5
5
|
"main": "dist/livedata_server.js",
|
|
6
|
-
"types": "livedata_server.ts",
|
|
6
|
+
"types": "dist/livedata_server.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
9
|
},
|
package/meteor/LICENSE
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2011 - present Meteor Software Ltd.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
====================================================================
|
|
25
|
-
This license applies to all code in Meteor that is not an externally
|
|
26
|
-
maintained library. Externally maintained libraries have their own
|
|
27
|
-
licenses, included in the LICENSES directory.
|
|
28
|
-
====================================================================
|