Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Nov 10, 2018
1 parent 01b892d commit 738ce7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dev/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class Transaction {

if (refOrQuery instanceof DocumentReference) {
return this._firestore
.getAll_([refOrQuery], null, this._requestTag, this._transactionId)
.getAll_([refOrQuery], /* fieldMask= */ null, this._requestTag, this._transactionId)
.then(res => {
return Promise.resolve(res[0]);
});
Expand Down
17 changes: 10 additions & 7 deletions dev/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,17 @@ export function parseGetAllArguments(
let documents: DocumentReference[];
let readOptions: ReadOptions|undefined = undefined;

const usesVarags = !Array.isArray(documentRefsOrReadOptions[0]);
// In the original release of the SDK, getAll() was documented to accept
// either a varargs list of DocumentReferences or a single array of
// DocumentReferences. To support this usage in the TypeScript client, we have
// to manually verify the arguments to determine which input the user
// provided.
const usesDeprecatedArgumentStyle = Array.isArray(documentRefsOrReadOptions[0]);

if (usesVarags) {
if (usesDeprecatedArgumentStyle) {
documents = documentRefsOrReadOptions[0] as DocumentReference[];
readOptions = documentRefsOrReadOptions[1] as ReadOptions;
} else {
if (documentRefsOrReadOptions.length > 0 &&
isPlainObject(
documentRefsOrReadOptions[documentRefsOrReadOptions.length - 1])) {
Expand All @@ -76,11 +84,6 @@ export function parseGetAllArguments(
} else {
documents = documentRefsOrReadOptions as DocumentReference[];
}
} else {
// Support an array of document references as the first argument for
// backwards compatibility.
documents = documentRefsOrReadOptions[0] as DocumentReference[];
readOptions = documentRefsOrReadOptions[1] as ReadOptions;
}

for (let i = 0; i < documents.length; ++i) {
Expand Down

0 comments on commit 738ce7e

Please sign in to comment.