Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port user|room|event|bridge stores to Typescript #208

Merged
merged 15 commits into from
Aug 24, 2020
Merged

Conversation

Half-Shot
Copy link
Contributor

This is a rather gargantuan PR, but it's mostly just typescriptification. The tests were modified to remove dependence on Bluebird, so this change is breaking, as we use pure promises here now.

@Half-Shot Half-Shot requested a review from a team August 23, 2020 13:11
Copy link
Contributor

@jaller94 jaller94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Comment on lines 96 to 99
* @param {Object} query
* @param {Function} transformFn
* @param {Deferred=} defer
* @return {Promise}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {Object} query
* @param {Function} transformFn
* @param {Deferred=} defer
* @return {Promise}
* @param query
* @param transformFn
* @param defer

Comment on lines 117 to 118
* @param {string} fieldName The field name. Use dot notation for nested objects.
* @param {boolean} sparse Allow sparse entries (undefined won't cause a key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {string} fieldName The field name. Use dot notation for nested objects.
* @param {boolean} sparse Allow sparse entries (undefined won't cause a key
* @param fieldName The field name. Use dot notation for nested objects.
* @param sparse Allow sparse entries (undefined won't cause a key

Comment on lines 121 to 122
public setUnique(fieldName: string, sparse: boolean) {
sparse = sparse || false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public setUnique(fieldName: string, sparse: boolean) {
sparse = sparse || false;
public setUnique(fieldName: string, sparse = false) {

Comment on lines 132 to 134
* @param {Function} func The function which will be called with a single document
* object. Guaranteed not to be null.
* @return {Function} A <code>transformFn</code> function to pass to the standard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {Function} func The function which will be called with a single document
* object. Guaranteed not to be null.
* @return {Function} A <code>transformFn</code> function to pass to the standard
* @param func The function which will be called with a single document
* object. Guaranteed not to be null.
* @return A <code>transformFn</code> function to pass to the standard

/**
* Bridge store base class
* @constructor
* @param {Datastore} db
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {Datastore} db

Comment on lines 56 to 58
* @param {string} roomId The ID of the room.
* @param {string} eventId The ID of the event.
* @return {?StoredEvent} A promise which resolves to the StoredEvent or null.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {string} roomId The ID of the room.
* @param {string} eventId The ID of the event.
* @return {?StoredEvent} A promise which resolves to the StoredEvent or null.
* @param roomId The ID of the room.
* @param eventId The ID of the event.
* @return A promise which resolves to the StoredEvent or null.

Comment on lines 71 to 72
* @param {StoredEvent} event The event to remove.
* @return {Promise}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {StoredEvent} event The event to remove.
* @return {Promise}
* @param event The event to remove.

Comment on lines 82 to 84
* @param {string} roomId The ID of the room.
* @param {string} eventId The ID of the event.
* @return {Promise}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {string} roomId The ID of the room.
* @param {string} eventId The ID of the event.
* @return {Promise}
* @param roomId The ID of the room.
* @param eventId The ID of the event.

Comment on lines 95 to 97
* @param {string} roomId The ID of the room.
* @param {string} eventId The ID of the event.
* @return {Promise}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {string} roomId The ID of the room.
* @param {string} eventId The ID of the event.
* @return {Promise}
* @param roomId The ID of the room.
* @param eventId The ID of the event.

* Construct a store suitable for event mapping information. Data is stored
* as {@link StoredEvent}s.
* @constructor
* @param {Datastore} db The connected NEDB database instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {Datastore} db The connected NEDB database instance
* @param db The connected NEDB database instance

Comment on lines 88 to 90
* @param {Datastore} db The connected NEDB database instance
* @param {Object} opts Options for this store.
* @property {string} delimiter The delimiter between matrix and
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {Datastore} db The connected NEDB database instance
* @param {Object} opts Options for this store.
* @property {string} delimiter The delimiter between matrix and
* @param db The connected NEDB database instance

import { RemoteRoom } from "../models/rooms/remote";

export class RoomBridgeStore extends BridgeStore {
private readonly delimiter = " ";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private readonly delimiter = " ";
public delimiter = " ";

Comment on lines 100 to 101
* @param {RoomBridgeStore~Entry} entry
* @return {Promise}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {RoomBridgeStore~Entry} entry
* @return {Promise}
* @param entry

Comment on lines 111 to 112
* @param {String} id The ID of the entry to retrieve.
* @return {?RoomBridgeStore~Entry} A promise which resolves to the entry or null.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {String} id The ID of the entry to retrieve.
* @return {?RoomBridgeStore~Entry} A promise which resolves to the entry or null.
* @param id The ID of the entry to retrieve.
* @return A promise which resolves to the entry or null.

Comment on lines 124 to 125
* @param {string} matrixId
* @return {RoomBridgeStore~Entry[]}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {string} matrixId
* @return {RoomBridgeStore~Entry[]}

Copy link
Contributor Author

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed things

@Half-Shot Half-Shot merged commit 3c29805 into develop Aug 24, 2020
@jaller94 jaller94 deleted the hs/port-stores branch August 24, 2020 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants