mongodb-livedata-server 0.0.7 → 0.0.8

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.
@@ -121,7 +121,7 @@ export declare class DDPServer {
121
121
  _urlForSession(sessionId: any): string;
122
122
  }
123
123
  export declare function _calculateVersion(clientSupportedVersions: any, serverSupportedVersions: any): any;
124
- export declare function wrapInternalException(exception: any, context: any): any;
124
+ export declare function wrapInternalException(exception: any, context: string): any;
125
125
  export declare function maybeAuditArgumentChecks(f: Function, context: any, args: any[] | null, description: string): any;
126
126
  export declare function ddpError(error: string | number, reason?: string, details?: string): {
127
127
  isClientSafe: boolean;
@@ -1,3 +1,12 @@
1
+ import { SessionConnectionHandle } from "./session";
2
+ interface MethodInvocationOptions {
3
+ isSimulation: boolean;
4
+ isFromCallAsync?: boolean;
5
+ userId: string;
6
+ setUserId: (userId: string) => void;
7
+ connection: SessionConnectionHandle;
8
+ randomSeed: number;
9
+ }
1
10
  /**
2
11
  * @summary The state for a single invocation of a method, referenced by this
3
12
  * inside a method definition.
@@ -7,13 +16,13 @@
7
16
  */
8
17
  export declare class MethodInvocation {
9
18
  userId: string;
10
- connection: any;
19
+ connection: SessionConnectionHandle;
11
20
  private isSimulation;
12
21
  private _isFromCallAsync;
13
22
  private _setUserId;
14
23
  private randomSeed;
15
24
  private randomStream;
16
- constructor(options: any);
25
+ constructor(options: MethodInvocationOptions);
17
26
  /**
18
27
  * @summary Set the logged in user.
19
28
  * @locus Server
@@ -23,3 +32,4 @@ export declare class MethodInvocation {
23
32
  */
24
33
  setUserId(userId: string | null): void;
25
34
  }
35
+ export {};
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MethodInvocation = void 0;
4
2
  // Instance name is this because it is usually referred to as this inside a
5
3
  // method definition
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.MethodInvocation = void 0;
6
6
  /**
7
7
  * @summary The state for a single invocation of a method, referenced by this
8
8
  * inside a method definition.
@@ -6,7 +6,7 @@ export interface SessionConnectionHandle {
6
6
  close: Function;
7
7
  onClose: Function;
8
8
  clientAddress: any;
9
- httpHeaders: Record<string, any>;
9
+ httpHeaders: Record<string, string>;
10
10
  }
11
11
  interface DDPMessage {
12
12
  msg: string;
@@ -139,6 +139,7 @@ class DDPSession {
139
139
  self.send(payload);
140
140
  }, (exception) => {
141
141
  finish();
142
+ console.error(`Exception while invoking method '${msg.method}'`, exception);
142
143
  payload.error = (0, livedata_server_1.wrapInternalException)(exception, `while invoking method '${msg.method}'`);
143
144
  self.send(payload);
144
145
  });
@@ -107,8 +107,8 @@ class OplogObserveDriver {
107
107
  self._stopHandles.push(self._mongoHandle._oplogHandle.onSkippedEntries(finishIfNeedToPollQuery(function () {
108
108
  self._needToPollQuery();
109
109
  })));
110
- (0, observe_driver_utils_1.forEachTrigger)(self._cursorDescription, function (trigger) {
111
- self._stopHandles.push(/*async*/ self._mongoHandle._oplogHandle.onOplogEntry(trigger, function (notification) {
110
+ (0, observe_driver_utils_1.forEachTrigger)(self._cursorDescription, async (trigger) => {
111
+ self._stopHandles.push(await self._mongoHandle._oplogHandle.onOplogEntry(trigger, function (notification) {
112
112
  //Meteor._noYieldsAllowed(finishIfNeedToPollQuery(function () {
113
113
  var op = notification.op;
114
114
  if (notification.dropCollection || notification.dropDatabase) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb-livedata-server",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "MongoDB live data server, extracted from Meteor, Fibers removed and converted to TypeScript",
5
5
  "main": "dist/livedata_server.js",
6
6
  "types": "dist/livedata_server.d.ts",