@internal
(change: TChange | null)
| 982 | |
| 983 | /** @internal */ |
| 984 | private _processChange(change: TChange | null): TChange { |
| 985 | if (this.isClosed) { |
| 986 | // TODO(NODE-3485): Replace with MongoChangeStreamClosedError |
| 987 | throw new MongoAPIError(CHANGESTREAM_CLOSED_ERROR); |
| 988 | } |
| 989 | |
| 990 | // a null change means the cursor has been notified, implicitly closing the change stream |
| 991 | if (change == null) { |
| 992 | // TODO(NODE-3485): Replace with MongoChangeStreamClosedError |
| 993 | throw new MongoRuntimeError(CHANGESTREAM_CLOSED_ERROR); |
| 994 | } |
| 995 | |
| 996 | if (change && !change._id) { |
| 997 | throw new MongoChangeStreamError(NO_RESUME_TOKEN_ERROR); |
| 998 | } |
| 999 | |
| 1000 | // cache the resume token |
| 1001 | this.cursor.cacheResumeToken(change._id); |
| 1002 | |
| 1003 | // wipe the startAtOperationTime if there was one so that there won't be a conflict |
| 1004 | // between resumeToken and startAtOperationTime if we need to reconnect the cursor |
| 1005 | this.options.startAtOperationTime = undefined; |
| 1006 | |
| 1007 | return change; |
| 1008 | } |
| 1009 | |
| 1010 | /** @internal */ |
| 1011 | private _processErrorStreamMode(changeStreamError: AnyError, cursorInitialized: boolean) { |
no test coverage detected