From ad17ecbe68a404f697ae3b9e3bdfc2bcb6e90b67 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 25 Aug 2020 13:25:09 +0200 Subject: [PATCH 1/4] Move parent/doc/collection back --- packages/firestore/exp-types/index.d.ts | 13 +- packages/firestore/exp/dependencies.json | 373 +++++++++------- packages/firestore/exp/index.ts | 1 - packages/firestore/exp/test/shim.ts | 13 +- packages/firestore/lite-types/index.d.ts | 13 +- packages/firestore/lite/dependencies.json | 397 ++++++++++-------- packages/firestore/lite/index.ts | 1 - packages/firestore/lite/src/api/reference.ts | 100 +++-- .../firestore/lite/test/integration.test.ts | 49 ++- 9 files changed, 580 insertions(+), 380 deletions(-) diff --git a/packages/firestore/exp-types/index.d.ts b/packages/firestore/exp-types/index.d.ts index f060e2f3a6d..6ba3842421f 100644 --- a/packages/firestore/exp-types/index.d.ts +++ b/packages/firestore/exp-types/index.d.ts @@ -130,12 +130,6 @@ export function doc( reference: DocumentReference, documentPath: string ): DocumentReference; -export function parent( - reference: CollectionReference -): DocumentReference | null; -export function parent( - reference: DocumentReference -): CollectionReference; export function collectionGroup( firestore: FirebaseFirestore, collectionId: string @@ -247,6 +241,9 @@ export class DocumentReference { readonly path: string; readonly id: string; + get parent(): CollectionReference; + + collection(collectionPath: string): CollectionReference; withConverter(converter: FirestoreDataConverter): DocumentReference; } @@ -359,6 +356,10 @@ export class CollectionReference extends Query { readonly type: 'collection'; readonly id: string; readonly path: string; + + get parent(): DocumentReference | null; + + doc(documentPath?: string): DocumentReference; withConverter( converter: FirestoreDataConverter ): CollectionReference; diff --git a/packages/firestore/exp/dependencies.json b/packages/firestore/exp/dependencies.json index 8a579257ff6..77642a99d46 100644 --- a/packages/firestore/exp/dependencies.json +++ b/packages/firestore/exp/dependencies.json @@ -50,7 +50,7 @@ ], "variables": [] }, - "sizeInBytes": 21515 + "sizeInBytes": 21406 }, "CollectionReference": { "dependencies": { @@ -70,16 +70,23 @@ "registerFirestore", "removeComponents", "removeComponents$1", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument", "wrapInUserErrorIfRecoverable" ], "classes": [ "AsyncQueue", "AutoId", + "BasePath", "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", "DelayedOperation", + "DocumentKey", + "DocumentKeyReference", + "DocumentReference", "ExponentialBackoff", "FirebaseCredentialsProvider", "Firestore", @@ -88,11 +95,12 @@ "OAuthToken", "Query", "QueryImpl", + "ResourcePath", "User" ], "variables": [] }, - "sizeInBytes": 18744 + "sizeInBytes": 23642 }, "DocumentReference": { "dependencies": { @@ -103,19 +111,25 @@ "getMessageOrStack", "hardAssert", "isIndexedDbTransactionError", + "isNullOrUndefined", "logDebug", "logError", + "newQueryForPath", "primitiveComparator", "randomBytes", "registerFirestore", "removeComponents", "removeComponents$1", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument", "wrapInUserErrorIfRecoverable" ], "classes": [ "AsyncQueue", "AutoId", "BasePath", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -129,12 +143,14 @@ "Firestore$1", "FirestoreError", "OAuthToken", + "Query", + "QueryImpl", "ResourcePath", "User" ], "variables": [] }, - "sizeInBytes": 20116 + "sizeInBytes": 23640 }, "DocumentSnapshot": { "dependencies": { @@ -160,11 +176,13 @@ "hardAssert", "invalidClassError", "isIndexedDbTransactionError", + "isNullOrUndefined", "isPlainObject", "isServerTimestamp", "isValidResourceName", "logDebug", "logError", + "newQueryForPath", "normalizeByteString", "normalizeNumber", "normalizeTimestamp", @@ -178,8 +196,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueDescription", "wrapInUserErrorIfRecoverable" @@ -191,6 +212,7 @@ "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -210,8 +232,10 @@ "FirestoreError", "GeoPoint", "OAuthToken", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", + "QueryImpl", "ResourcePath", "Timestamp", "User", @@ -219,7 +243,7 @@ ], "variables": [] }, - "sizeInBytes": 39654 + "sizeInBytes": 43178 }, "FieldPath": { "dependencies": { @@ -269,7 +293,7 @@ ], "variables": [] }, - "sizeInBytes": 23188 + "sizeInBytes": 23079 }, "FieldValue": { "dependencies": { @@ -308,7 +332,7 @@ ], "variables": [] }, - "sizeInBytes": 16818 + "sizeInBytes": 16709 }, "FirebaseFirestore": { "dependencies": { @@ -345,7 +369,7 @@ ], "variables": [] }, - "sizeInBytes": 16727 + "sizeInBytes": 16618 }, "GeoPoint": { "dependencies": { @@ -391,7 +415,7 @@ ], "variables": [] }, - "sizeInBytes": 19636 + "sizeInBytes": 19527 }, "Query": { "dependencies": { @@ -429,7 +453,7 @@ ], "variables": [] }, - "sizeInBytes": 16920 + "sizeInBytes": 16811 }, "QueryConstraint": { "dependencies": { @@ -467,7 +491,7 @@ ], "variables": [] }, - "sizeInBytes": 16733 + "sizeInBytes": 16624 }, "QueryDocumentSnapshot": { "dependencies": { @@ -493,11 +517,13 @@ "hardAssert", "invalidClassError", "isIndexedDbTransactionError", + "isNullOrUndefined", "isPlainObject", "isServerTimestamp", "isValidResourceName", "logDebug", "logError", + "newQueryForPath", "normalizeByteString", "normalizeNumber", "normalizeTimestamp", @@ -511,8 +537,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueDescription", "wrapInUserErrorIfRecoverable" @@ -524,6 +553,7 @@ "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -543,8 +573,10 @@ "FirestoreError", "GeoPoint", "OAuthToken", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", + "QueryImpl", "ResourcePath", "Timestamp", "User", @@ -552,7 +584,7 @@ ], "variables": [] }, - "sizeInBytes": 39664 + "sizeInBytes": 43188 }, "QuerySnapshot": { "dependencies": { @@ -579,11 +611,13 @@ "hardAssert", "invalidClassError", "isIndexedDbTransactionError", + "isNullOrUndefined", "isPlainObject", "isServerTimestamp", "isValidResourceName", "logDebug", "logError", + "newQueryForPath", "normalizeByteString", "normalizeNumber", "normalizeTimestamp", @@ -598,8 +632,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueDescription", "wrapInUserErrorIfRecoverable" @@ -611,6 +648,7 @@ "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -630,8 +668,10 @@ "FirestoreError", "GeoPoint", "OAuthToken", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", + "QueryImpl", "QuerySnapshot", "ResourcePath", "SnapshotMetadata", @@ -641,7 +681,7 @@ ], "variables": [] }, - "sizeInBytes": 42295 + "sizeInBytes": 45819 }, "SnapshotMetadata": { "dependencies": { @@ -679,7 +719,7 @@ ], "variables": [] }, - "sizeInBytes": 16942 + "sizeInBytes": 16833 }, "Timestamp": { "dependencies": { @@ -717,7 +757,7 @@ ], "variables": [] }, - "sizeInBytes": 18328 + "sizeInBytes": 18219 }, "Transaction": { "dependencies": { @@ -753,6 +793,7 @@ "isIndexedDbTransactionError", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isSafeInteger", "isServerTimestamp", @@ -761,6 +802,7 @@ "logDebug", "logError", "looksLikeJsonObject", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -794,8 +836,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -810,6 +855,7 @@ "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -843,8 +889,10 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "SetMutation", @@ -859,7 +907,7 @@ ], "variables": [] }, - "sizeInBytes": 63180 + "sizeInBytes": 66704 }, "WriteBatch": { "dependencies": { @@ -893,6 +941,7 @@ "isIndexedDbTransactionError", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isSafeInteger", "isServerTimestamp", @@ -900,6 +949,7 @@ "logDebug", "logError", "looksLikeJsonObject", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -933,8 +983,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -949,6 +1002,7 @@ "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -978,6 +1032,8 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "SetMutation", @@ -989,7 +1045,7 @@ ], "variables": [] }, - "sizeInBytes": 55917 + "sizeInBytes": 59441 }, "addDoc": { "dependencies": { @@ -1007,7 +1063,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -1231,9 +1287,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueCompare", @@ -1366,7 +1424,7 @@ ], "variables": [] }, - "sizeInBytes": 214087 + "sizeInBytes": 215482 }, "arrayRemove": { "dependencies": { @@ -1455,7 +1513,7 @@ ], "variables": [] }, - "sizeInBytes": 36209 + "sizeInBytes": 36100 }, "arrayUnion": { "dependencies": { @@ -1544,7 +1602,7 @@ ], "variables": [] }, - "sizeInBytes": 36201 + "sizeInBytes": 36092 }, "clearIndexedDbPersistence": { "dependencies": { @@ -1593,7 +1651,7 @@ ], "variables": [] }, - "sizeInBytes": 30195 + "sizeInBytes": 30086 }, "collection": { "dependencies": { @@ -1606,21 +1664,17 @@ "hardAssert", "isIndexedDbTransactionError", "isNullOrUndefined", - "isPlainObject", "logDebug", "logError", "newQueryForPath", - "ordinal", "primitiveComparator", "randomBytes", "registerFirestore", "removeComponents", "removeComponents$1", - "tryGetCustomObjectType", - "validateArgType", "validateCollectionPath", - "validateType", - "valueDescription", + "validateDocumentPath", + "validateNonEmptyArgument", "wrapInUserErrorIfRecoverable" ], "classes": [ @@ -1648,7 +1702,7 @@ ], "variables": [] }, - "sizeInBytes": 24823 + "sizeInBytes": 24375 }, "collectionGroup": { "dependencies": { @@ -1662,20 +1716,15 @@ "hardAssert", "isIndexedDbTransactionError", "isNullOrUndefined", - "isPlainObject", "logDebug", "logError", "newQueryForCollectionGroup", - "ordinal", "primitiveComparator", "randomBytes", "registerFirestore", "removeComponents", "removeComponents$1", - "tryGetCustomObjectType", - "validateArgType", - "validateType", - "valueDescription", + "validateNonEmptyArgument", "wrapInUserErrorIfRecoverable" ], "classes": [ @@ -1699,7 +1748,7 @@ ], "variables": [] }, - "sizeInBytes": 23208 + "sizeInBytes": 21622 }, "deleteDoc": { "dependencies": { @@ -1715,7 +1764,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -1916,6 +1965,9 @@ "transformOperationEquals", "typeOrder", "uint8ArrayFromBinaryString", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument", "valueCompare", "valueEquals", "verifyNotTerminated", @@ -1931,6 +1983,7 @@ "BasePath", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -1999,6 +2052,7 @@ "PersistentStream", "PersistentWriteStream", "Precondition", + "Query", "QueryImpl", "QueryListenersInfo", "QueryView", @@ -2035,7 +2089,7 @@ ], "variables": [] }, - "sizeInBytes": 196418 + "sizeInBytes": 198668 }, "deleteField": { "dependencies": { @@ -2077,7 +2131,7 @@ ], "variables": [] }, - "sizeInBytes": 17784 + "sizeInBytes": 17675 }, "disableNetwork": { "dependencies": { @@ -2093,7 +2147,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -2412,7 +2466,7 @@ ], "variables": [] }, - "sizeInBytes": 196036 + "sizeInBytes": 196151 }, "doc": { "dependencies": { @@ -2425,21 +2479,17 @@ "hardAssert", "isIndexedDbTransactionError", "isNullOrUndefined", - "isPlainObject", "logDebug", "logError", "newQueryForPath", - "ordinal", "primitiveComparator", "randomBytes", "registerFirestore", "removeComponents", "removeComponents$1", - "tryGetCustomObjectType", - "validateArgType", + "validateCollectionPath", "validateDocumentPath", - "validateType", - "valueDescription", + "validateNonEmptyArgument", "wrapInUserErrorIfRecoverable" ], "classes": [ @@ -2467,7 +2517,7 @@ ], "variables": [] }, - "sizeInBytes": 24874 + "sizeInBytes": 24430 }, "documentId": { "dependencies": { @@ -2518,7 +2568,7 @@ ], "variables": [] }, - "sizeInBytes": 23238 + "sizeInBytes": 23129 }, "enableIndexedDbPersistence": { "dependencies": { @@ -2642,6 +2692,7 @@ "getPostMutationVersion", "getWindow", "globalTargetStore", + "handleUserChange", "hardAssert", "ignoreIfPrimaryLeaseLoss", "immediateSuccessor", @@ -2885,7 +2936,7 @@ ], "variables": [] }, - "sizeInBytes": 199048 + "sizeInBytes": 200588 }, "enableMultiTabIndexedDbPersistence": { "dependencies": { @@ -2904,7 +2955,7 @@ "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", "applyPrimaryState", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTargetState", @@ -3364,7 +3415,7 @@ ], "variables": [] }, - "sizeInBytes": 304821 + "sizeInBytes": 304936 }, "enableNetwork": { "dependencies": { @@ -3380,7 +3431,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -3699,7 +3750,7 @@ ], "variables": [] }, - "sizeInBytes": 196033 + "sizeInBytes": 196148 }, "endAt": { "dependencies": { @@ -3742,6 +3793,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -3772,8 +3824,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription", @@ -3787,6 +3842,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -3822,7 +3878,7 @@ ], "variables": [] }, - "sizeInBytes": 53208 + "sizeInBytes": 55148 }, "endBefore": { "dependencies": { @@ -3865,6 +3921,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -3895,8 +3952,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription", @@ -3910,6 +3970,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -3945,7 +4006,7 @@ ], "variables": [] }, - "sizeInBytes": 53219 + "sizeInBytes": 55159 }, "getDoc": { "dependencies": { @@ -3961,7 +4022,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -4177,8 +4238,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueCompare", "valueDescription", @@ -4199,6 +4263,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -4272,6 +4337,7 @@ "PersistentStream", "PersistentWriteStream", "Precondition", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", "QueryImpl", @@ -4313,7 +4379,7 @@ ], "variables": [] }, - "sizeInBytes": 212441 + "sizeInBytes": 214691 }, "getDocFromCache": { "dependencies": { @@ -4391,6 +4457,7 @@ "getOfflineComponentProvider", "getPostMutationVersion", "getPreviousValue", + "handleUserChange", "hardAssert", "invalidClassError", "isArray", @@ -4414,6 +4481,7 @@ "mutationEquals", "newLocalStore", "newQueryComparator", + "newQueryForPath", "newTarget", "normalizeByteString", "normalizeNumber", @@ -4460,8 +4528,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueCompare", "valueDescription", @@ -4479,6 +4550,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -4530,6 +4602,7 @@ "PersistencePromise", "PersistenceTransaction", "Precondition", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", "QueryImpl", @@ -4555,7 +4628,7 @@ ], "variables": [] }, - "sizeInBytes": 118383 + "sizeInBytes": 122116 }, "getDocFromServer": { "dependencies": { @@ -4571,7 +4644,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -4787,8 +4860,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueCompare", "valueDescription", @@ -4809,6 +4885,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -4882,6 +4959,7 @@ "PersistentStream", "PersistentWriteStream", "Precondition", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", "QueryImpl", @@ -4923,7 +5001,7 @@ ], "variables": [] }, - "sizeInBytes": 212497 + "sizeInBytes": 214747 }, "getDocs": { "dependencies": { @@ -4939,7 +5017,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -5156,9 +5234,12 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateHasExplicitOrderByForLimitToLast", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueCompare", "valueDescription", @@ -5179,6 +5260,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -5295,7 +5377,7 @@ ], "variables": [] }, - "sizeInBytes": 215004 + "sizeInBytes": 217034 }, "getDocsFromCache": { "dependencies": { @@ -5377,6 +5459,7 @@ "getOfflineComponentProvider", "getPostMutationVersion", "getPreviousValue", + "handleUserChange", "hardAssert", "invalidClassError", "isArray", @@ -5400,6 +5483,7 @@ "mutationEquals", "newLocalStore", "newQueryComparator", + "newQueryForPath", "newTarget", "normalizeByteString", "normalizeNumber", @@ -5447,8 +5531,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueCompare", "valueDescription", @@ -5467,6 +5554,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -5550,7 +5638,7 @@ ], "variables": [] }, - "sizeInBytes": 131563 + "sizeInBytes": 135076 }, "getDocsFromServer": { "dependencies": { @@ -5566,7 +5654,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -5783,8 +5871,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueCompare", "valueDescription", @@ -5805,6 +5896,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -5921,7 +6013,7 @@ ], "variables": [] }, - "sizeInBytes": 214742 + "sizeInBytes": 216772 }, "getFirestore": { "dependencies": { @@ -5959,7 +6051,7 @@ ], "variables": [] }, - "sizeInBytes": 16803 + "sizeInBytes": 16694 }, "increment": { "dependencies": { @@ -6009,7 +6101,7 @@ ], "variables": [] }, - "sizeInBytes": 18649 + "sizeInBytes": 18540 }, "initializeFirestore": { "dependencies": { @@ -6048,7 +6140,7 @@ ], "variables": [] }, - "sizeInBytes": 18107 + "sizeInBytes": 17998 }, "limit": { "dependencies": { @@ -6094,7 +6186,7 @@ ], "variables": [] }, - "sizeInBytes": 19234 + "sizeInBytes": 19125 }, "limitToLast": { "dependencies": { @@ -6140,7 +6232,7 @@ ], "variables": [] }, - "sizeInBytes": 19258 + "sizeInBytes": 19149 }, "onSnapshot": { "dependencies": { @@ -6156,7 +6248,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -6375,9 +6467,12 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateHasExplicitOrderByForLimitToLast", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueCompare", "valueDescription", @@ -6398,6 +6493,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -6514,7 +6610,7 @@ ], "variables": [] }, - "sizeInBytes": 216087 + "sizeInBytes": 218117 }, "onSnapshotsInSync": { "dependencies": { @@ -6530,7 +6626,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -6851,7 +6947,7 @@ ], "variables": [] }, - "sizeInBytes": 196882 + "sizeInBytes": 196997 }, "orderBy": { "dependencies": { @@ -6919,56 +7015,7 @@ ], "variables": [] }, - "sizeInBytes": 28879 - }, - "parent": { - "dependencies": { - "functions": [ - "argToString", - "cast", - "fail", - "formatJSON", - "getMessageOrStack", - "hardAssert", - "isIndexedDbTransactionError", - "isNullOrUndefined", - "logDebug", - "logError", - "newQueryForPath", - "parent", - "primitiveComparator", - "randomBytes", - "registerFirestore", - "removeComponents", - "removeComponents$1", - "wrapInUserErrorIfRecoverable" - ], - "classes": [ - "AsyncQueue", - "AutoId", - "BasePath", - "CollectionReference", - "DatabaseId", - "DatabaseInfo", - "Deferred", - "DelayedOperation", - "DocumentKey", - "DocumentKeyReference", - "DocumentReference", - "ExponentialBackoff", - "FirebaseCredentialsProvider", - "Firestore", - "Firestore$1", - "FirestoreError", - "OAuthToken", - "Query", - "QueryImpl", - "ResourcePath", - "User" - ], - "variables": [] - }, - "sizeInBytes": 22884 + "sizeInBytes": 28770 }, "query": { "dependencies": { @@ -7008,7 +7055,7 @@ ], "variables": [] }, - "sizeInBytes": 17501 + "sizeInBytes": 17392 }, "queryEqual": { "dependencies": { @@ -7084,7 +7131,7 @@ ], "variables": [] }, - "sizeInBytes": 33450 + "sizeInBytes": 33341 }, "refEqual": { "dependencies": { @@ -7105,6 +7152,9 @@ "registerFirestore", "removeComponents", "removeComponents$1", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument", "wrapInUserErrorIfRecoverable" ], "classes": [ @@ -7132,7 +7182,7 @@ ], "variables": [] }, - "sizeInBytes": 22431 + "sizeInBytes": 23925 }, "runTransaction": { "dependencies": { @@ -7198,6 +7248,7 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "newUserDataReader", "nodePromise", @@ -7240,8 +7291,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -7258,6 +7312,7 @@ "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -7296,8 +7351,10 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", "QueryDocumentSnapshot", "QueryDocumentSnapshot$1", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "ServerTimestampTransform", @@ -7319,7 +7376,7 @@ ], "variables": [] }, - "sizeInBytes": 82111 + "sizeInBytes": 85597 }, "serverTimestamp": { "dependencies": { @@ -7364,7 +7421,7 @@ ], "variables": [] }, - "sizeInBytes": 17795 + "sizeInBytes": 17686 }, "setDoc": { "dependencies": { @@ -7381,7 +7438,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -7605,8 +7662,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueCompare", @@ -7627,6 +7687,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -7699,6 +7760,7 @@ "PersistentStream", "PersistentWriteStream", "Precondition", + "Query", "QueryImpl", "QueryListenersInfo", "QueryView", @@ -7737,7 +7799,7 @@ ], "variables": [] }, - "sizeInBytes": 212369 + "sizeInBytes": 214619 }, "setLogLevel": { "dependencies": { @@ -7775,7 +7837,7 @@ ], "variables": [] }, - "sizeInBytes": 16769 + "sizeInBytes": 16660 }, "snapshotEqual": { "dependencies": { @@ -7814,6 +7876,7 @@ "isValidResourceName", "logDebug", "logError", + "newQueryForPath", "newTarget", "normalizeByteString", "normalizeNumber", @@ -7840,8 +7903,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueDescription", "valueEquals", @@ -7855,6 +7921,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -7889,7 +7956,7 @@ ], "variables": [] }, - "sizeInBytes": 50939 + "sizeInBytes": 52879 }, "startAfter": { "dependencies": { @@ -7931,6 +7998,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -7962,8 +8030,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription", @@ -7977,6 +8048,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -8012,7 +8084,7 @@ ], "variables": [] }, - "sizeInBytes": 53229 + "sizeInBytes": 55169 }, "startAt": { "dependencies": { @@ -8054,6 +8126,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -8085,8 +8158,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription", @@ -8100,6 +8176,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -8135,7 +8212,7 @@ ], "variables": [] }, - "sizeInBytes": 53219 + "sizeInBytes": 55159 }, "terminate": { "dependencies": { @@ -8174,7 +8251,7 @@ ], "variables": [] }, - "sizeInBytes": 17299 + "sizeInBytes": 17190 }, "updateDoc": { "dependencies": { @@ -8190,7 +8267,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -8416,8 +8493,11 @@ "uint8ArrayFromBinaryString", "updateDoc", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueCompare", @@ -8438,6 +8518,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -8512,6 +8593,7 @@ "PersistentStream", "PersistentWriteStream", "Precondition", + "Query", "QueryImpl", "QueryListenersInfo", "QueryView", @@ -8550,7 +8632,7 @@ ], "variables": [] }, - "sizeInBytes": 213868 + "sizeInBytes": 216118 }, "waitForPendingWrites": { "dependencies": { @@ -8566,7 +8648,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -8884,7 +8966,7 @@ ], "variables": [] }, - "sizeInBytes": 195825 + "sizeInBytes": 195940 }, "where": { "dependencies": { @@ -9031,7 +9113,7 @@ ], "variables": [] }, - "sizeInBytes": 59634 + "sizeInBytes": 59601 }, "writeBatch": { "dependencies": { @@ -9048,7 +9130,7 @@ "applyNumericIncrementTransformOperationToLocalView", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", - "applyRemoteEvent", + "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -9274,8 +9356,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -9298,6 +9383,7 @@ "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -9373,6 +9459,7 @@ "PersistentStream", "PersistentWriteStream", "Precondition", + "Query", "QueryImpl", "QueryListenersInfo", "QueryView", @@ -9412,6 +9499,6 @@ ], "variables": [] }, - "sizeInBytes": 217535 + "sizeInBytes": 219785 } } \ No newline at end of file diff --git a/packages/firestore/exp/index.ts b/packages/firestore/exp/index.ts index 86349b2b238..ed038ee1afe 100644 --- a/packages/firestore/exp/index.ts +++ b/packages/firestore/exp/index.ts @@ -51,7 +51,6 @@ export { doc, collection, collectionGroup, - parent, startAt, startAfter, endAt, diff --git a/packages/firestore/exp/test/shim.ts b/packages/firestore/exp/test/shim.ts index 6c6ac2f532e..8a42ab36299 100644 --- a/packages/firestore/exp/test/shim.ts +++ b/packages/firestore/exp/test/shim.ts @@ -47,7 +47,6 @@ import { initializeFirestore, onSnapshot, onSnapshotsInSync, - parent, query, queryEqual, refEqual, @@ -298,7 +297,7 @@ export class DocumentReference readonly path = this._delegate.path; get parent(): legacy.CollectionReference { - return new CollectionReference(this.firestore, parent(this._delegate)); + return new CollectionReference(this.firestore, this._delegate.parent); } collection( @@ -306,7 +305,7 @@ export class DocumentReference ): legacy.CollectionReference { return new CollectionReference( this.firestore, - collection(this._delegate, collectionPath) + this._delegate.collection(collectionPath) ); } @@ -640,7 +639,7 @@ export class CollectionReference extends Query readonly path = this._delegate.path; get parent(): DocumentReference | null { - const docRef = parent(this._delegate); + const docRef = this._delegate.parent; return docRef ? new DocumentReference(this.firestore, docRef) : null; @@ -648,12 +647,12 @@ export class CollectionReference extends Query doc(documentPath?: string): DocumentReference { if (documentPath !== undefined) { - return new DocumentReference( + return new DocumentReference( this.firestore, - doc(this._delegate, documentPath) + this._delegate.doc(documentPath) ); } else { - return new DocumentReference(this.firestore, doc(this._delegate)); + return new DocumentReference(this.firestore, this._delegate.doc()); } } diff --git a/packages/firestore/lite-types/index.d.ts b/packages/firestore/lite-types/index.d.ts index e168c9382a5..5904aaa2ec7 100644 --- a/packages/firestore/lite-types/index.d.ts +++ b/packages/firestore/lite-types/index.d.ts @@ -90,12 +90,6 @@ export function doc( reference: DocumentReference, documentPath: string ): DocumentReference; -export function parent( - reference: CollectionReference -): DocumentReference | null; -export function parent( - reference: DocumentReference -): CollectionReference; export function collectionGroup( firestore: FirebaseFirestore, collectionId: string @@ -207,6 +201,9 @@ export class DocumentReference { readonly path: string; readonly id: string; + get parent(): CollectionReference; + + collection(collectionPath: string): CollectionReference; withConverter(converter: FirestoreDataConverter): DocumentReference; } @@ -302,6 +299,10 @@ export class CollectionReference extends Query { readonly type: 'collection'; readonly id: string; readonly path: string; + + get parent(): DocumentReference | null; + + doc(documentPath?: string): DocumentReference; withConverter( converter: FirestoreDataConverter ): CollectionReference; diff --git a/packages/firestore/lite/dependencies.json b/packages/firestore/lite/dependencies.json index 0ce96318736..038c9e5a588 100644 --- a/packages/firestore/lite/dependencies.json +++ b/packages/firestore/lite/dependencies.json @@ -38,7 +38,7 @@ ], "variables": [] }, - "sizeInBytes": 12362 + "sizeInBytes": 12225 }, "CollectionReference": { "dependencies": { @@ -52,23 +52,33 @@ "logError", "newQueryForPath", "primitiveComparator", + "randomBytes", "registerFirestore", - "removeComponents" + "removeComponents", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument" ], "classes": [ + "AutoId", + "BasePath", "CollectionReference", "DatabaseId", + "DocumentKey", + "DocumentKeyReference", + "DocumentReference", "FirebaseCredentialsProvider", "Firestore", "FirestoreError", "OAuthToken", "Query", "QueryImpl", + "ResourcePath", "User" ], "variables": [] }, - "sizeInBytes": 9591 + "sizeInBytes": 14962 }, "DocumentReference": { "dependencies": { @@ -77,14 +87,22 @@ "fail", "formatJSON", "hardAssert", + "isNullOrUndefined", "logDebug", "logError", + "newQueryForPath", "primitiveComparator", + "randomBytes", "registerFirestore", - "removeComponents" + "removeComponents", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument" ], "classes": [ + "AutoId", "BasePath", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", @@ -93,12 +111,14 @@ "Firestore", "FirestoreError", "OAuthToken", + "Query", + "QueryImpl", "ResourcePath", "User" ], "variables": [] }, - "sizeInBytes": 10963 + "sizeInBytes": 14960 }, "DocumentSnapshot": { "dependencies": { @@ -122,32 +142,40 @@ "getPreviousValue", "hardAssert", "invalidClassError", + "isNullOrUndefined", "isPlainObject", "isServerTimestamp", "isValidResourceName", "logDebug", "logError", + "newQueryForPath", "normalizeByteString", "normalizeNumber", "normalizeTimestamp", "ordinal", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "tryGetCustomObjectType", "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueDescription" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", @@ -161,7 +189,9 @@ "FirestoreError", "GeoPoint", "OAuthToken", + "Query", "QueryDocumentSnapshot", + "QueryImpl", "ResourcePath", "Timestamp", "User", @@ -169,7 +199,7 @@ ], "variables": [] }, - "sizeInBytes": 28960 + "sizeInBytes": 33081 }, "FieldPath": { "dependencies": { @@ -207,7 +237,7 @@ ], "variables": [] }, - "sizeInBytes": 14035 + "sizeInBytes": 13898 }, "FieldValue": { "dependencies": { @@ -234,7 +264,7 @@ ], "variables": [] }, - "sizeInBytes": 7665 + "sizeInBytes": 7528 }, "FirebaseFirestore": { "dependencies": { @@ -259,7 +289,7 @@ ], "variables": [] }, - "sizeInBytes": 7572 + "sizeInBytes": 7435 }, "GeoPoint": { "dependencies": { @@ -293,7 +323,7 @@ ], "variables": [] }, - "sizeInBytes": 10426 + "sizeInBytes": 10346 }, "Query": { "dependencies": { @@ -319,7 +349,7 @@ ], "variables": [] }, - "sizeInBytes": 7767 + "sizeInBytes": 7630 }, "QueryConstraint": { "dependencies": { @@ -345,7 +375,7 @@ ], "variables": [] }, - "sizeInBytes": 7580 + "sizeInBytes": 7443 }, "QueryDocumentSnapshot": { "dependencies": { @@ -369,32 +399,40 @@ "getPreviousValue", "hardAssert", "invalidClassError", + "isNullOrUndefined", "isPlainObject", "isServerTimestamp", "isValidResourceName", "logDebug", "logError", + "newQueryForPath", "normalizeByteString", "normalizeNumber", "normalizeTimestamp", "ordinal", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "tryGetCustomObjectType", "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueDescription" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", @@ -408,7 +446,9 @@ "FirestoreError", "GeoPoint", "OAuthToken", + "Query", "QueryDocumentSnapshot", + "QueryImpl", "ResourcePath", "Timestamp", "User", @@ -416,7 +456,7 @@ ], "variables": [] }, - "sizeInBytes": 28965 + "sizeInBytes": 33086 }, "QuerySnapshot": { "dependencies": { @@ -442,7 +482,7 @@ ], "variables": [] }, - "sizeInBytes": 7806 + "sizeInBytes": 7669 }, "Timestamp": { "dependencies": { @@ -468,7 +508,7 @@ ], "variables": [] }, - "sizeInBytes": 9108 + "sizeInBytes": 9038 }, "Transaction": { "dependencies": { @@ -502,6 +542,7 @@ "isEmpty", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isSafeInteger", "isServerTimestamp", @@ -510,6 +551,7 @@ "logDebug", "logError", "looksLikeJsonObject", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -528,6 +570,7 @@ "parseUpdateData", "parseUpdateVarargs", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "timestampEquals", @@ -541,8 +584,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -550,10 +596,12 @@ "valueEquals" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DeleteFieldValueImpl", "Document", @@ -581,7 +629,9 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", "QueryDocumentSnapshot", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "SetMutation", @@ -594,7 +644,7 @@ ], "variables": [] }, - "sizeInBytes": 51878 + "sizeInBytes": 55999 }, "WriteBatch": { "dependencies": { @@ -626,6 +676,7 @@ "isEmpty", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isSafeInteger", "isServerTimestamp", @@ -633,6 +684,7 @@ "logDebug", "logError", "looksLikeJsonObject", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -651,6 +703,7 @@ "parseUpdateData", "parseUpdateVarargs", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "timestampEquals", @@ -664,8 +717,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -673,10 +729,12 @@ "valueEquals" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DeleteFieldValueImpl", "DeleteMutation", @@ -701,6 +759,8 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "SetMutation", @@ -712,7 +772,7 @@ ], "variables": [] }, - "sizeInBytes": 46640 + "sizeInBytes": 50761 }, "addDoc": { "dependencies": { @@ -802,9 +862,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription", @@ -861,7 +923,7 @@ ], "variables": [] }, - "sizeInBytes": 55128 + "sizeInBytes": 56642 }, "arrayRemove": { "dependencies": { @@ -938,7 +1000,7 @@ ], "variables": [] }, - "sizeInBytes": 26932 + "sizeInBytes": 26919 }, "arrayUnion": { "dependencies": { @@ -1015,7 +1077,7 @@ ], "variables": [] }, - "sizeInBytes": 26924 + "sizeInBytes": 26911 }, "collection": { "dependencies": { @@ -1026,21 +1088,19 @@ "formatJSON", "hardAssert", "isNullOrUndefined", - "isPlainObject", "logDebug", "logError", "newQueryForPath", - "ordinal", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", - "tryGetCustomObjectType", - "validateArgType", "validateCollectionPath", - "validateType", - "valueDescription" + "validateDocumentPath", + "validateNonEmptyArgument" ], "classes": [ + "AutoId", "BasePath", "CollectionReference", "DatabaseId", @@ -1058,7 +1118,7 @@ ], "variables": [] }, - "sizeInBytes": 15670 + "sizeInBytes": 15695 }, "collectionGroup": { "dependencies": { @@ -1070,18 +1130,13 @@ "formatJSON", "hardAssert", "isNullOrUndefined", - "isPlainObject", "logDebug", "logError", "newQueryForCollectionGroup", - "ordinal", "primitiveComparator", "registerFirestore", "removeComponents", - "tryGetCustomObjectType", - "validateArgType", - "validateType", - "valueDescription" + "validateNonEmptyArgument" ], "classes": [ "BasePath", @@ -1097,7 +1152,7 @@ ], "variables": [] }, - "sizeInBytes": 14055 + "sizeInBytes": 12441 }, "deleteDoc": { "dependencies": { @@ -1114,6 +1169,7 @@ "getEncodedDatabaseId", "hardAssert", "invokeCommitRpc", + "isNullOrUndefined", "loadProtos", "logDebug", "logError", @@ -1121,9 +1177,11 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "nodePromise", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "toDocumentMask", @@ -1134,12 +1192,17 @@ "toPrecondition", "toResourceName", "toTimestamp", - "toVersion" + "toVersion", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument" ], "classes": [ "ArrayRemoveTransformOperation", "ArrayUnionTransformOperation", + "AutoId", "BasePath", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -1159,6 +1222,8 @@ "OAuthToken", "PatchMutation", "Precondition", + "Query", + "QueryImpl", "ResourcePath", "ServerTimestampTransform", "SetMutation", @@ -1170,7 +1235,7 @@ ], "variables": [] }, - "sizeInBytes": 25037 + "sizeInBytes": 29205 }, "deleteField": { "dependencies": { @@ -1200,7 +1265,7 @@ ], "variables": [] }, - "sizeInBytes": 8631 + "sizeInBytes": 8494 }, "doc": { "dependencies": { @@ -1211,20 +1276,16 @@ "formatJSON", "hardAssert", "isNullOrUndefined", - "isPlainObject", "logDebug", "logError", "newQueryForPath", - "ordinal", "primitiveComparator", "randomBytes", "registerFirestore", "removeComponents", - "tryGetCustomObjectType", - "validateArgType", + "validateCollectionPath", "validateDocumentPath", - "validateType", - "valueDescription" + "validateNonEmptyArgument" ], "classes": [ "AutoId", @@ -1245,7 +1306,7 @@ ], "variables": [] }, - "sizeInBytes": 16222 + "sizeInBytes": 15750 }, "documentId": { "dependencies": { @@ -1284,7 +1345,7 @@ ], "variables": [] }, - "sizeInBytes": 14085 + "sizeInBytes": 13948 }, "endAt": { "dependencies": { @@ -1325,6 +1386,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -1340,6 +1402,7 @@ "primitiveComparator", "queryOrderBy", "queryWithEndAt", + "randomBytes", "refValue", "registerFirestore", "removeComponents", @@ -1353,18 +1416,23 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", @@ -1395,7 +1463,7 @@ ], "variables": [] }, - "sizeInBytes": 43931 + "sizeInBytes": 46468 }, "endBefore": { "dependencies": { @@ -1436,6 +1504,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -1451,6 +1520,7 @@ "primitiveComparator", "queryOrderBy", "queryWithEndAt", + "randomBytes", "refValue", "registerFirestore", "removeComponents", @@ -1464,18 +1534,23 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", @@ -1506,7 +1581,7 @@ ], "variables": [] }, - "sizeInBytes": 43942 + "sizeInBytes": 46479 }, "getDoc": { "dependencies": { @@ -1551,6 +1626,7 @@ "invokeBatchGetDocumentsRpc", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isServerTimestamp", "isValidResourceName", @@ -1561,6 +1637,7 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "nodePromise", "normalizeByteString", @@ -1571,6 +1648,7 @@ "objectSize", "ordinal", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "timestampEquals", @@ -1580,17 +1658,22 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", "valueDescription", "valueEquals" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -1614,7 +1697,9 @@ "NoDocument", "OAuthToken", "ObjectValue", + "Query", "QueryDocumentSnapshot", + "QueryImpl", "ResourcePath", "SnapshotVersion", "StreamBridge", @@ -1624,25 +1709,17 @@ ], "variables": [] }, - "sizeInBytes": 45402 + "sizeInBytes": 49683 }, "getDocs": { "dependencies": { "functions": [ "argToString", "arrayEquals", - "arrayValueContains", "assertUint8ArrayAvailable", "binaryStringFromUint8Array", "blobEquals", "cast", - "compareArrays", - "compareBlobs", - "compareGeoPoints", - "compareMaps", - "compareNumbers", - "compareReferences", - "compareTimestamps", "createError", "createMetadata", "debugCast", @@ -1666,13 +1743,11 @@ "geoPointEquals", "getDatastore", "getDocs", - "getEncodedDatabaseId", "getLocalWriteTime", "getPreviousValue", "hardAssert", "invalidClassError", "invokeRunQueryRpc", - "isArray", "isMapValue", "isNanValue", "isNegativeZero", @@ -1688,6 +1763,7 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "newTarget", "nodePromise", @@ -1701,6 +1777,7 @@ "primitiveComparator", "queryOrderBy", "queryToTarget", + "randomBytes", "registerFirestore", "removeComponents", "timestampEquals", @@ -1720,22 +1797,24 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateHasExplicitOrderByForLimitToLast", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", - "valueCompare", "valueDescription", "valueEquals" ], "classes": [ - "ArrayContainsAnyFilter", - "ArrayContainsFilter", + "AutoId", "BaseFieldPath", "BasePath", "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -1746,20 +1825,15 @@ "DocumentKeyReference", "DocumentReference", "DocumentSnapshot", - "FieldFilter", "FieldPath", "FieldPath$1", "FieldPath$2", - "Filter", "FirebaseCredentialsProvider", "Firestore", "FirestoreError", "GeoPoint", "GrpcConnection", - "InFilter", "JsonProtoSerializer", - "KeyFieldFilter", - "KeyFieldInFilter", "MaybeDocument", "OAuthToken", "ObjectValue", @@ -1778,7 +1852,7 @@ ], "variables": [] }, - "sizeInBytes": 57670 + "sizeInBytes": 54167 }, "getFirestore": { "dependencies": { @@ -1804,7 +1878,7 @@ ], "variables": [] }, - "sizeInBytes": 7651 + "sizeInBytes": 7514 }, "increment": { "dependencies": { @@ -1842,7 +1916,7 @@ ], "variables": [] }, - "sizeInBytes": 9496 + "sizeInBytes": 9359 }, "initializeFirestore": { "dependencies": { @@ -1868,7 +1942,7 @@ ], "variables": [] }, - "sizeInBytes": 7737 + "sizeInBytes": 7600 }, "limit": { "dependencies": { @@ -1902,7 +1976,7 @@ ], "variables": [] }, - "sizeInBytes": 10081 + "sizeInBytes": 9944 }, "limitToLast": { "dependencies": { @@ -1936,7 +2010,7 @@ ], "variables": [] }, - "sizeInBytes": 10105 + "sizeInBytes": 9968 }, "orderBy": { "dependencies": { @@ -1992,44 +2066,7 @@ ], "variables": [] }, - "sizeInBytes": 19726 - }, - "parent": { - "dependencies": { - "functions": [ - "argToString", - "cast", - "fail", - "formatJSON", - "hardAssert", - "isNullOrUndefined", - "logDebug", - "logError", - "newQueryForPath", - "parent", - "primitiveComparator", - "registerFirestore", - "removeComponents" - ], - "classes": [ - "BasePath", - "CollectionReference", - "DatabaseId", - "DocumentKey", - "DocumentKeyReference", - "DocumentReference", - "FirebaseCredentialsProvider", - "Firestore", - "FirestoreError", - "OAuthToken", - "Query", - "QueryImpl", - "ResourcePath", - "User" - ], - "variables": [] - }, - "sizeInBytes": 13731 + "sizeInBytes": 19589 }, "query": { "dependencies": { @@ -2057,25 +2094,17 @@ ], "variables": [] }, - "sizeInBytes": 8348 + "sizeInBytes": 8211 }, "queryEqual": { "dependencies": { "functions": [ "argToString", "arrayEquals", - "arrayValueContains", "binaryStringFromUint8Array", "blobEquals", "boundEquals", "cast", - "compareArrays", - "compareBlobs", - "compareGeoPoints", - "compareMaps", - "compareNumbers", - "compareReferences", - "compareTimestamps", "decodeBase64", "encodeBase64", "fail", @@ -2084,11 +2113,8 @@ "geoPointEquals", "getLocalWriteTime", "hardAssert", - "isArray", - "isNanValue", "isNegativeZero", "isNullOrUndefined", - "isNullValue", "isServerTimestamp", "logDebug", "logError", @@ -2111,38 +2137,28 @@ "timestampEquals", "typeOrder", "uint8ArrayFromBinaryString", - "valueCompare", "valueEquals" ], "classes": [ - "ArrayContainsAnyFilter", - "ArrayContainsFilter", "BasePath", "Bound", "ByteString", "DatabaseId", - "DocumentKey", - "FieldFilter", "FieldPath", - "Filter", "FirebaseCredentialsProvider", "Firestore", "FirestoreError", - "InFilter", - "KeyFieldFilter", - "KeyFieldInFilter", "OAuthToken", "OrderBy", "Query", "QueryImpl", - "ResourcePath", "TargetImpl", "Timestamp", "User" ], "variables": [] }, - "sizeInBytes": 31633 + "sizeInBytes": 24160 }, "refEqual": { "dependencies": { @@ -2156,11 +2172,16 @@ "logError", "newQueryForPath", "primitiveComparator", + "randomBytes", "refEqual", "registerFirestore", - "removeComponents" + "removeComponents", + "validateCollectionPath", + "validateDocumentPath", + "validateNonEmptyArgument" ], "classes": [ + "AutoId", "BasePath", "CollectionReference", "DatabaseId", @@ -2178,7 +2199,7 @@ ], "variables": [] }, - "sizeInBytes": 13278 + "sizeInBytes": 15245 }, "runTransaction": { "dependencies": { @@ -2221,7 +2242,6 @@ "getLocalWriteTime", "getMessageOrStack", "getPreviousValue", - "getWindow", "hardAssert", "invalidClassError", "invokeBatchGetDocumentsRpc", @@ -2245,6 +2265,7 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "newUserDataReader", "nodePromise", @@ -2264,6 +2285,7 @@ "parseUpdateData", "parseUpdateVarargs", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "runTransaction", @@ -2285,8 +2307,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -2297,10 +2322,12 @@ "ArrayRemoveTransformOperation", "ArrayUnionTransformOperation", "AsyncQueue", + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -2337,7 +2364,9 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", "QueryDocumentSnapshot", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "ServerTimestampTransform", @@ -2357,7 +2386,7 @@ ], "variables": [] }, - "sizeInBytes": 77256 + "sizeInBytes": 81012 }, "serverTimestamp": { "dependencies": { @@ -2390,7 +2419,7 @@ ], "variables": [] }, - "sizeInBytes": 8619 + "sizeInBytes": 8482 }, "setDoc": { "dependencies": { @@ -2426,6 +2455,7 @@ "isEmpty", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isSafeInteger", "isServerTimestamp", @@ -2438,6 +2468,7 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "newUserDataReader", "nodePromise", @@ -2455,6 +2486,7 @@ "parseSentinelFieldValue", "parseSetData", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "setDoc", @@ -2476,8 +2508,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription", @@ -2486,10 +2521,12 @@ "classes": [ "ArrayRemoveTransformOperation", "ArrayUnionTransformOperation", + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -2516,6 +2553,8 @@ "ParsedSetData", "PatchMutation", "Precondition", + "Query", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "ServerTimestampTransform", @@ -2530,7 +2569,7 @@ ], "variables": [] }, - "sizeInBytes": 51491 + "sizeInBytes": 55783 }, "setLogLevel": { "dependencies": { @@ -2556,26 +2595,18 @@ ], "variables": [] }, - "sizeInBytes": 7616 + "sizeInBytes": 7479 }, "snapshotEqual": { "dependencies": { "functions": [ "argToString", "arrayEquals", - "arrayValueContains", "assertUint8ArrayAvailable", "binaryStringFromUint8Array", "blobEquals", "boundEquals", "cast", - "compareArrays", - "compareBlobs", - "compareGeoPoints", - "compareMaps", - "compareNumbers", - "compareReferences", - "compareTimestamps", "createError", "decodeBase64", "encodeBase64", @@ -2593,16 +2624,14 @@ "getPreviousValue", "hardAssert", "invalidClassError", - "isArray", - "isNanValue", "isNegativeZero", "isNullOrUndefined", - "isNullValue", "isPlainObject", "isServerTimestamp", "isValidResourceName", "logDebug", "logError", + "newQueryForPath", "newTarget", "normalizeByteString", "normalizeNumber", @@ -2617,6 +2646,7 @@ "queryEquals", "queryOrderBy", "queryToTarget", + "randomBytes", "registerFirestore", "removeComponents", "snapshotEqual", @@ -2626,38 +2656,35 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validateType", - "valueCompare", "valueDescription", "valueEquals" ], "classes": [ - "ArrayContainsAnyFilter", - "ArrayContainsFilter", + "AutoId", "BaseFieldPath", "BasePath", "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", "DocumentReference", "DocumentSnapshot", - "FieldFilter", "FieldPath", "FieldPath$1", "FieldPath$2", - "Filter", "FirebaseCredentialsProvider", "Firestore", "FirestoreError", "GeoPoint", - "InFilter", - "KeyFieldFilter", - "KeyFieldInFilter", "OAuthToken", "OrderBy", "Query", @@ -2672,7 +2699,7 @@ ], "variables": [] }, - "sizeInBytes": 44083 + "sizeInBytes": 40318 }, "startAfter": { "dependencies": { @@ -2712,6 +2739,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -2727,6 +2755,7 @@ "primitiveComparator", "queryOrderBy", "queryWithStartAt", + "randomBytes", "refValue", "registerFirestore", "removeComponents", @@ -2741,18 +2770,23 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", @@ -2783,7 +2817,7 @@ ], "variables": [] }, - "sizeInBytes": 43952 + "sizeInBytes": 46489 }, "startAt": { "dependencies": { @@ -2823,6 +2857,7 @@ "newQueryBoundFromDocOrFields", "newQueryBoundFromDocument", "newQueryBoundFromFields", + "newQueryForPath", "newSerializer", "newUserDataReader", "normalizeByteString", @@ -2838,6 +2873,7 @@ "primitiveComparator", "queryOrderBy", "queryWithStartAt", + "randomBytes", "refValue", "registerFirestore", "removeComponents", @@ -2852,18 +2888,23 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription" ], "classes": [ + "AutoId", "BaseFieldPath", "BasePath", "Blob", "Bound", "ByteString", + "CollectionReference", "DatabaseId", "DocumentKey", "DocumentKeyReference", @@ -2894,7 +2935,7 @@ ], "variables": [] }, - "sizeInBytes": 43942 + "sizeInBytes": 46479 }, "terminate": { "dependencies": { @@ -2921,7 +2962,7 @@ ], "variables": [] }, - "sizeInBytes": 8149 + "sizeInBytes": 8012 }, "updateDoc": { "dependencies": { @@ -2957,6 +2998,7 @@ "isEmpty", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isSafeInteger", "isServerTimestamp", @@ -2969,6 +3011,7 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "newUserDataReader", "nodePromise", @@ -2987,6 +3030,7 @@ "parseUpdateData", "parseUpdateVarargs", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "timestampEquals", @@ -3008,8 +3052,11 @@ "uint8ArrayFromBinaryString", "updateDoc", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateType", "valueDescription", @@ -3018,10 +3065,12 @@ "classes": [ "ArrayRemoveTransformOperation", "ArrayUnionTransformOperation", + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -3051,6 +3100,8 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "ServerTimestampTransform", @@ -3065,7 +3116,7 @@ ], "variables": [] }, - "sizeInBytes": 54598 + "sizeInBytes": 58890 }, "where": { "dependencies": { @@ -3084,10 +3135,12 @@ "compareNumbers", "compareReferences", "compareTimestamps", + "conflictingOps", "createError", "decodeBase64", "encodeBase64", "errorMessage", + "extractDocumentKeysFromArrayValue", "fail", "fieldPathFromArgument$1", "fieldPathFromDotSeparatedString", @@ -3182,6 +3235,8 @@ "JsonProtoSerializer", "KeyFieldFilter", "KeyFieldInFilter", + "KeyFieldNotInFilter", + "NotInFilter", "OAuthToken", "ParseContext", "Query", @@ -3196,7 +3251,7 @@ ], "variables": [] }, - "sizeInBytes": 49321 + "sizeInBytes": 50420 }, "writeBatch": { "dependencies": { @@ -3233,6 +3288,7 @@ "isEmpty", "isMapValue", "isNegativeZero", + "isNullOrUndefined", "isPlainObject", "isSafeInteger", "isServerTimestamp", @@ -3245,6 +3301,7 @@ "mapCodeFromRpcCode", "newConnection", "newDatastore", + "newQueryForPath", "newSerializer", "newUserDataReader", "nodePromise", @@ -3264,6 +3321,7 @@ "parseUpdateData", "parseUpdateVarargs", "primitiveComparator", + "randomBytes", "registerFirestore", "removeComponents", "timestampEquals", @@ -3284,8 +3342,11 @@ "typeOrder", "uint8ArrayFromBinaryString", "validateArgType", + "validateCollectionPath", + "validateDocumentPath", "validateExactNumberOfArgs", "validateNamedArrayAtLeastNumberOfElements", + "validateNonEmptyArgument", "validatePlainObject", "validateReference", "validateType", @@ -3296,10 +3357,12 @@ "classes": [ "ArrayRemoveTransformOperation", "ArrayUnionTransformOperation", + "AutoId", "BaseFieldPath", "BasePath", "Blob", "ByteString", + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -3330,6 +3393,8 @@ "ParsedUpdateData", "PatchMutation", "Precondition", + "Query", + "QueryImpl", "ResourcePath", "SerializableFieldValue", "ServerTimestampTransform", @@ -3345,6 +3410,6 @@ ], "variables": [] }, - "sizeInBytes": 58299 + "sizeInBytes": 62591 } } \ No newline at end of file diff --git a/packages/firestore/lite/index.ts b/packages/firestore/lite/index.ts index 1c9d2475578..83ea3e16b2e 100644 --- a/packages/firestore/lite/index.ts +++ b/packages/firestore/lite/index.ts @@ -34,7 +34,6 @@ export { collection, collectionGroup, doc, - parent, getDoc, getDocs, deleteDoc, diff --git a/packages/firestore/lite/src/api/reference.ts b/packages/firestore/lite/src/api/reference.ts index eb758d40647..339b6069fc8 100644 --- a/packages/firestore/lite/src/api/reference.ts +++ b/packages/firestore/lite/src/api/reference.ts @@ -72,7 +72,6 @@ import { import { FieldPath } from './field_path'; import { cast } from './util'; import { - validateArgType, validateCollectionPath, validateDocumentPath, validateExactNumberOfArgs, @@ -107,6 +106,27 @@ export class DocumentReference return this._path.canonicalString(); } + get parent(): CollectionReference { + return new CollectionReference( + this.firestore, + this._key.path.popLast(), + this._converter + ); + } + + collection(path: string): CollectionReference { + validateNonEmptyArgument('DocumentReference.collection', 'path', path); + const absolutePath = ResourcePath.fromString(this.path).child( + ResourcePath.fromString(path) + ); + validateCollectionPath(absolutePath); + return new CollectionReference( + this.firestore, + absolutePath, + /* converter= */ null + ); + } + withConverter( converter: firestore.FirestoreDataConverter ): firestore.DocumentReference { @@ -382,6 +402,31 @@ export class CollectionReference extends Query return this._query.path.canonicalString(); } + get parent(): DocumentReference | null { + const parentPath = this._path.popLast(); + if (parentPath.isEmpty()) { + return null; + } else { + return new DocumentReference( + this.firestore, + /* converter= */ null, + parentPath + ); + } + } + + doc(path?: string): DocumentReference { + // We allow omission of 'pathString' but explicitly prohibit passing in both + // 'undefined' and 'null'. + if (arguments.length === 0) { + path = AutoId.newId(); + } + validateNonEmptyArgument('CollectionReference.doc', 'path', path); + const absolutePath = this._path.child(ResourcePath.fromString(path!)); + validateDocumentPath(absolutePath); + return new DocumentReference(this.firestore, this.converter, absolutePath); + } + withConverter( converter: firestore.FirestoreDataConverter ): firestore.CollectionReference { @@ -408,7 +453,7 @@ export function collection( | firestore.CollectionReference, relativePath: string ): CollectionReference { - validateArgType('collection', 'non-empty string', 2, relativePath); + validateNonEmptyArgument('collection', 'path', relativePath); if (parent instanceof Firestore) { const absolutePath = ResourcePath.fromString(relativePath); validateCollectionPath(absolutePath); @@ -444,7 +489,7 @@ export function collectionGroup( ): Query { const firestoreClient = cast(firestore, Firestore); - validateArgType('collectionGroup', 'non-empty string', 1, collectionId); + validateNonEmptyArgument('collectionGroup', 'collection id', collectionId); if (collectionId.indexOf('/') >= 0) { throw new FirestoreError( Code.INVALID_ARGUMENT, @@ -484,10 +529,10 @@ export function doc( if (arguments.length === 1) { relativePath = AutoId.newId(); } - validateArgType('doc', 'non-empty string', 2, relativePath); + validateNonEmptyArgument('doc', 'path', relativePath); if (parent instanceof Firestore) { - const absolutePath = ResourcePath.fromString(relativePath!); + const absolutePath = ResourcePath.fromString(relativePath); validateDocumentPath(absolutePath); return new DocumentReference(parent, /* converter= */ null, absolutePath); } else { @@ -502,7 +547,7 @@ export function doc( ); } const absolutePath = parent._path.child( - ResourcePath.fromString(relativePath!) + ResourcePath.fromString(relativePath) ); validateDocumentPath(absolutePath); return new DocumentReference( @@ -513,36 +558,6 @@ export function doc( } } -export function parent( - reference: firestore.CollectionReference -): DocumentReference | null; -export function parent( - reference: firestore.DocumentReference -): CollectionReference; -export function parent( - child: firestore.CollectionReference | firestore.DocumentReference -): DocumentReference | CollectionReference | null { - if (child instanceof CollectionReference) { - const parentPath = child._path.popLast(); - if (parentPath.isEmpty()) { - return null; - } else { - return new DocumentReference( - child.firestore, - /* converter= */ null, - parentPath - ); - } - } else { - const doc = cast>(child, DocumentReference); - return new CollectionReference( - doc.firestore, - doc._key.path.popLast(), - doc._converter - ); - } -} - export function getDoc( reference: firestore.DocumentReference ): Promise> { @@ -753,3 +768,16 @@ export function newUserDataReader(firestore: Firestore): UserDataReader { serializer ); } + +function validateNonEmptyArgument( + functionName: string, + argumentName: string, + argument?: string +): asserts argument is string { + if (!argument) { + throw new FirestoreError( + Code.INVALID_ARGUMENT, + `Function ${functionName}() cannot be called with an empty ${argumentName}.` + ); + } +} diff --git a/packages/firestore/lite/test/integration.test.ts b/packages/firestore/lite/test/integration.test.ts index 145fe8de45e..36901deda75 100644 --- a/packages/firestore/lite/test/integration.test.ts +++ b/packages/firestore/lite/test/integration.test.ts @@ -39,7 +39,6 @@ import { withTestDocAndInitialData } from './helpers'; import { - parent, collection, CollectionReference, doc, @@ -178,6 +177,15 @@ describe('doc', () => { }); }); + it('can be used relative to collection (via CollectionReference.doc())', () => { + return withTestDb(db => { + const result = collection(db, 'coll').doc('doc'); + expect(result).to.be.an.instanceOf(DocumentReference); + expect(result.id).to.equal('doc'); + expect(result.path).to.equal('coll/doc'); + }); + }); + it('can be relative to doc', () => { return withTestDb(db => { const result = doc(doc(db, 'coll/doc'), 'subcoll/subdoc'); @@ -194,8 +202,7 @@ describe('doc', () => { 'number of segments, but coll has 1.' ); expect(() => doc(db, '')).to.throw( - 'Function doc() requires its second argument to be of type non-empty ' + - 'string, but it was: ""' + 'Function doc() cannot be called with an empty path.' ); expect(() => doc(collection(db, 'coll'), 'doc/coll')).to.throw( 'Invalid document reference. Document references must have an even ' + @@ -214,6 +221,14 @@ describe('doc', () => { expect(ref.id.length).to.equal(20); }); }); + + it('supports AutoId (via CollectionReference.doc())', () => { + return withTestDb(db => { + const coll = collection(db, 'coll'); + const ref = coll.doc(); + expect(ref.id.length).to.equal(20); + }); + }); }); describe('collection', () => { @@ -244,17 +259,23 @@ describe('collection', () => { }); }); + it('can be used relative to doc (via DocumentReference.collection())', () => { + return withTestDb(db => { + const result = doc(db, 'coll/doc').collection('subcoll'); + expect(result).to.be.an.instanceOf(CollectionReference); + expect(result.id).to.equal('subcoll'); + expect(result.path).to.equal('coll/doc/subcoll'); + }); + }); + it('validates path', () => { return withTestDb(db => { expect(() => collection(db, 'coll/doc')).to.throw( 'Invalid collection reference. Collection references must have an odd ' + 'number of segments, but coll/doc has 2.' ); - // TODO(firestorelite): Explore returning a more helpful message - // (e.g. "Empty document paths are not supported.") expect(() => collection(doc(db, 'coll/doc'), '')).to.throw( - 'Function collection() requires its second argument to be of type ' + - 'non-empty string, but it was: ""' + 'Function collection() cannot be called with an empty path' ); expect(() => collection(doc(db, 'coll/doc'), 'coll/doc')).to.throw( 'Invalid collection reference. Collection references must have an odd ' + @@ -268,7 +289,7 @@ describe('parent', () => { it('returns CollectionReferences for DocumentReferences', () => { return withTestDb(db => { const coll = collection(db, 'coll/doc/coll'); - const result = parent(coll); + const result = coll.parent; expect(result).to.be.an.instanceOf(DocumentReference); expect(result!.path).to.equal('coll/doc'); }); @@ -277,7 +298,7 @@ describe('parent', () => { it('returns DocumentReferences for CollectionReferences', () => { return withTestDb(db => { const coll = doc(db, 'coll/doc'); - const result = parent(coll); + const result = coll.parent; expect(result).to.be.an.instanceOf(CollectionReference); expect(result.path).to.equal('coll'); }); @@ -286,7 +307,7 @@ describe('parent', () => { it('returns null for root collection', () => { return withTestDb(db => { const coll = collection(db, 'coll'); - const result = parent(coll); + const result = coll.parent; expect(result).to.be.null; }); }); @@ -962,7 +983,7 @@ describe('Query', () => { it('validates collection groups', () => { return withTestDb(firestore => { expect(() => collectionGroup(firestore, '')).to.throw( - 'Function collectionGroup() requires its first argument to be of type non-empty string, but it was: ""' + 'Function collectionGroup() cannot be called with an empty collection id.' ); expect(() => collectionGroup(firestore, '/')).to.throw( "Invalid collection ID '/' passed to function collectionGroup(). Collection IDs must not contain '/'." @@ -975,7 +996,7 @@ describe('equality', () => { it('for collection references', () => { return withTestDb(firestore => { const coll1a = collection(firestore, 'a'); - const coll1b = parent(doc(firestore, 'a/b')); + const coll1b = doc(firestore, 'a/b').parent; const coll2 = collection(firestore, 'c'); expect(refEqual(coll1a, coll1b)).to.be.true; @@ -1105,7 +1126,7 @@ describe('withConverter() support', () => { it('keeps the converter when calling parent() with a DocumentReference', () => { return withTestDb(async db => { const coll = doc(db, 'root/doc').withConverter(postConverter); - const typedColl = parent(coll)!; + const typedColl = coll.parent!; expect( refEqual(typedColl, collection(db, 'root').withConverter(postConverter)) ).to.be.true; @@ -1117,7 +1138,7 @@ describe('withConverter() support', () => { const coll = collection(db, 'root/doc/parent').withConverter( postConverter ); - const untypedDoc = parent(coll)!; + const untypedDoc = coll.parent!; expect(refEqual(untypedDoc, doc(db, 'root/doc'))).to.be.true; }); }); From e11615f5dff94c450be84b9460adfd60ff9a0e41 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 25 Aug 2020 19:22:42 +0200 Subject: [PATCH 2/4] Fix tests --- .../test/integration/api/validation.test.ts | 61 ++++++++++--------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index e192fff49d0..b425661f6ad 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -238,22 +238,23 @@ apiDescribe('Validation:', (persistence: boolean) => { describe('Collection paths', () => { validationIt(persistence, 'must be non-empty strings', db => { const baseDocRef = db.doc('foo/bar'); - const argumentPosition = usesFunctionalApi() ? 'second' : 'first'; - expect(() => db.collection('')).to.throw( - `Function ${ - usesFunctionalApi() ? 'collection' : 'Firestore.collection' - }() requires its ${argumentPosition} argument to be of type ` + - 'non-empty string, but it was: ""' - ); - expect(() => baseDocRef.collection('')).to.throw( - `Function ${ - usesFunctionalApi() ? 'collection' : 'DocumentReference.collection' - }() requires its ${argumentPosition} argument to be of type ` + - 'non-empty string, but it was: ""' - ); - - if (validatesJsInput) { + if (usesFunctionalApi()) { + expect(() => db.collection('')).to.throw( + 'Function collection() cannot be called with an empty path.' + ); + expect(() => baseDocRef.collection('')).to.throw( + 'Function DocumentReference.collection() cannot be called with an empty path.' + ); + } else { + expect(() => db.collection('')).to.throw( + 'Function Firestore.collection() requires its first ' + + 'argument to be of type non-empty string, but it was: ""' + ); + expect(() => baseDocRef.collection('')).to.throw( + 'Function DocumentReference.collection() requires its first ' + + 'argument to be of type non-empty string, but it was: ""' + ); expect(() => db.collection(null as any)).to.throw( 'Function Firestore.collection() requires its first argument ' + 'to be of type non-empty string, but it was: null' @@ -309,21 +310,23 @@ apiDescribe('Validation:', (persistence: boolean) => { describe('Document paths', () => { validationIt(persistence, 'must be strings', db => { const baseCollectionRef = db.collection('foo'); - const argumentPosition = usesFunctionalApi() ? 'second' : 'first'; - expect(() => db.doc('')).to.throw( - `Function ${usesFunctionalApi() ? 'doc' : 'Firestore.doc'}() ` + - `requires its ${argumentPosition} argument to be of type non-empty ` + - 'string, but it was: ""' - ); - expect(() => baseCollectionRef.doc('')).to.throw( - `Function ${ - usesFunctionalApi() ? 'doc' : 'CollectionReference.doc' - }() requires its ${argumentPosition} argument to be of type ` + - 'non-empty string, but it was: ""' - ); - - if (validatesJsInput) { + if (usesFunctionalApi()) { + expect(() => db.doc('')).to.throw( + 'Function doc() cannot be called with an empty path.' + ); + expect(() => baseCollectionRef.doc('')).to.throw( + 'Function CollectionReference.doc() cannot be called with an empty path.' + ); + } else { + expect(() => db.doc('')).to.throw( + 'Function Firestore.doc() requires its first ' + + 'argument to be of type non-empty string, but it was: ""' + ); + expect(() => baseCollectionRef.doc('')).to.throw( + 'Function CollectionReference.doc() requires its first ' + + 'argument to be of type non-empty string, but it was: ""' + ); expect(() => db.doc(null as any)).to.throw( 'Function Firestore.doc() requires its first argument to be ' + 'of type non-empty string, but it was: null' From a4059b1008f0ba7ffbe4c13bdd167aaf60a261fd Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 27 Aug 2020 19:06:13 +0200 Subject: [PATCH 3/4] Merge --- packages/firestore/exp/dependencies.json | 513 +++-------------------- 1 file changed, 54 insertions(+), 459 deletions(-) diff --git a/packages/firestore/exp/dependencies.json b/packages/firestore/exp/dependencies.json index a585ea26b30..41a9fdb6863 100644 --- a/packages/firestore/exp/dependencies.json +++ b/packages/firestore/exp/dependencies.json @@ -40,11 +40,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 21406 -======= "sizeInBytes": 18458 ->>>>>>> master }, "CollectionReference": { "dependencies": { @@ -94,11 +90,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 23642 -======= - "sizeInBytes": 18637 ->>>>>>> master + "sizeInBytes": 23644 }, "DocumentReference": { "dependencies": { @@ -148,11 +140,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 23640 -======= - "sizeInBytes": 20085 ->>>>>>> master + "sizeInBytes": 23642 }, "DocumentSnapshot": { "dependencies": { @@ -212,11 +200,8 @@ "BaseFieldPath", "BasePath", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -247,11 +232,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 43178 -======= - "sizeInBytes": 39149 ->>>>>>> master + "sizeInBytes": 42706 }, "FieldPath": { "dependencies": { @@ -301,11 +282,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 23079 -======= "sizeInBytes": 23081 ->>>>>>> master }, "FieldValue": { "dependencies": { @@ -344,11 +321,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 16709 -======= "sizeInBytes": 16711 ->>>>>>> master }, "FirebaseFirestore": { "dependencies": { @@ -385,11 +358,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 16618 -======= "sizeInBytes": 16620 ->>>>>>> master }, "GeoPoint": { "dependencies": { @@ -435,11 +404,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 19527 -======= "sizeInBytes": 19529 ->>>>>>> master }, "Query": { "dependencies": { @@ -477,11 +442,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 16811 -======= "sizeInBytes": 16813 ->>>>>>> master }, "QueryConstraint": { "dependencies": { @@ -519,11 +480,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 16624 -======= "sizeInBytes": 16626 ->>>>>>> master }, "QueryDocumentSnapshot": { "dependencies": { @@ -583,11 +540,8 @@ "BaseFieldPath", "BasePath", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -618,11 +572,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 43188 -======= - "sizeInBytes": 39159 ->>>>>>> master + "sizeInBytes": 42716 }, "QuerySnapshot": { "dependencies": { @@ -684,11 +634,8 @@ "BaseFieldPath", "BasePath", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -721,11 +668,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 45819 -======= - "sizeInBytes": 41790 ->>>>>>> master + "sizeInBytes": 45347 }, "SnapshotMetadata": { "dependencies": { @@ -763,11 +706,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 16833 -======= "sizeInBytes": 16835 ->>>>>>> master }, "Timestamp": { "dependencies": { @@ -805,11 +744,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 18219 -======= "sizeInBytes": 18221 ->>>>>>> master }, "Transaction": { "dependencies": { @@ -905,11 +840,8 @@ "BaseFieldPath", "BasePath", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -961,11 +893,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 66704 -======= - "sizeInBytes": 62689 ->>>>>>> master + "sizeInBytes": 66246 }, "WriteBatch": { "dependencies": { @@ -1058,11 +986,8 @@ "BaseFieldPath", "BasePath", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -1105,11 +1030,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 59441 -======= - "sizeInBytes": 55277 ->>>>>>> master + "sizeInBytes": 58834 }, "addDoc": { "dependencies": { @@ -1128,10 +1049,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applySuccessfulWrite", @@ -1486,11 +1403,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 215482 -======= - "sizeInBytes": 190505 ->>>>>>> master + "sizeInBytes": 191785 }, "arrayRemove": { "dependencies": { @@ -1577,11 +1490,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 36100 -======= "sizeInBytes": 35216 ->>>>>>> master }, "arrayUnion": { "dependencies": { @@ -1668,11 +1577,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 36092 -======= "sizeInBytes": 35208 ->>>>>>> master }, "clearIndexedDbPersistence": { "dependencies": { @@ -1721,11 +1626,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 30086 -======= "sizeInBytes": 30088 ->>>>>>> master }, "collection": { "dependencies": { @@ -1776,11 +1677,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 24375 -======= - "sizeInBytes": 24792 ->>>>>>> master + "sizeInBytes": 24377 }, "collectionGroup": { "dependencies": { @@ -1826,11 +1723,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 21622 -======= - "sizeInBytes": 23101 ->>>>>>> master + "sizeInBytes": 21624 }, "deleteDoc": { "dependencies": { @@ -1847,10 +1740,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applySuccessfulWrite", @@ -1972,6 +1861,7 @@ "newPersistentWatchStream", "newPersistentWriteStream", "newQueryComparator", + "newQueryForPath", "newSerializer", "newSyncEngine", "newTarget", @@ -2169,11 +2059,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 198668 -======= - "sizeInBytes": 173387 ->>>>>>> master + "sizeInBytes": 175580 }, "deleteField": { "dependencies": { @@ -2215,11 +2101,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 17675 -======= "sizeInBytes": 17677 ->>>>>>> master }, "disableNetwork": { "dependencies": { @@ -2234,10 +2116,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -2536,11 +2414,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 196151 -======= "sizeInBytes": 165460 ->>>>>>> master }, "doc": { "dependencies": { @@ -2591,11 +2465,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 24430 -======= - "sizeInBytes": 24843 ->>>>>>> master + "sizeInBytes": 24432 }, "documentId": { "dependencies": { @@ -2646,11 +2516,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 23129 -======= "sizeInBytes": 23131 ->>>>>>> master }, "enableIndexedDbPersistence": { "dependencies": { @@ -3018,11 +2884,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 200588 -======= "sizeInBytes": 200591 ->>>>>>> master }, "enableMultiTabIndexedDbPersistence": { "dependencies": { @@ -3043,10 +2905,7 @@ "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", "applyPrimaryState", -<<<<<<< HEAD -======= "applyRemoteEvent", ->>>>>>> master "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", @@ -3519,11 +3378,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 304936 -======= "sizeInBytes": 302272 ->>>>>>> master }, "enableNetwork": { "dependencies": { @@ -3538,10 +3393,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -3840,11 +3691,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 196148 -======= "sizeInBytes": 165457 ->>>>>>> master }, "endAt": { "dependencies": { @@ -3934,11 +3781,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -3974,11 +3818,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 55148 -======= - "sizeInBytes": 52669 ->>>>>>> master + "sizeInBytes": 54642 }, "endBefore": { "dependencies": { @@ -4068,11 +3908,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -4108,11 +3945,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 55159 -======= - "sizeInBytes": 52680 ->>>>>>> master + "sizeInBytes": 54653 }, "getDoc": { "dependencies": { @@ -4129,10 +3962,7 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD -======= "applyRemoteEvent", ->>>>>>> master "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", @@ -4379,11 +4209,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -4498,11 +4325,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 214691 -======= - "sizeInBytes": 207270 ->>>>>>> master + "sizeInBytes": 209405 }, "getDocFromCache": { "dependencies": { @@ -4671,11 +4494,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -4753,11 +4573,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 122116 -======= - "sizeInBytes": 119452 ->>>>>>> master + "sizeInBytes": 121645 }, "getDocFromServer": { "dependencies": { @@ -4774,10 +4590,7 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD -======= "applyRemoteEvent", ->>>>>>> master "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", @@ -5024,11 +4837,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -5143,11 +4953,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 214747 -======= - "sizeInBytes": 207326 ->>>>>>> master + "sizeInBytes": 209461 }, "getDocs": { "dependencies": { @@ -5164,10 +4970,7 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD -======= "applyRemoteEvent", ->>>>>>> master "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", @@ -5416,11 +5219,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -5536,11 +5336,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 217034 -======= - "sizeInBytes": 209833 ->>>>>>> master + "sizeInBytes": 211748 }, "getDocsFromCache": { "dependencies": { @@ -5715,11 +5511,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -5803,11 +5596,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 135076 -======= - "sizeInBytes": 132632 ->>>>>>> master + "sizeInBytes": 134605 }, "getDocsFromServer": { "dependencies": { @@ -5824,10 +5613,7 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD -======= "applyRemoteEvent", ->>>>>>> master "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", @@ -6075,11 +5861,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -6195,11 +5978,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 216772 -======= - "sizeInBytes": 209571 ->>>>>>> master + "sizeInBytes": 211486 }, "getFirestore": { "dependencies": { @@ -6237,11 +6016,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 16694 -======= "sizeInBytes": 16696 ->>>>>>> master }, "increment": { "dependencies": { @@ -6291,11 +6066,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 18540 -======= "sizeInBytes": 18542 ->>>>>>> master }, "initializeFirestore": { "dependencies": { @@ -6334,11 +6105,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 17998 -======= "sizeInBytes": 18000 ->>>>>>> master }, "limit": { "dependencies": { @@ -6384,11 +6151,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 19125 -======= "sizeInBytes": 19127 ->>>>>>> master }, "limitToLast": { "dependencies": { @@ -6434,11 +6197,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 19149 -======= "sizeInBytes": 19151 ->>>>>>> master }, "onSnapshot": { "dependencies": { @@ -6455,10 +6214,7 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD -======= "applyRemoteEvent", ->>>>>>> master "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", @@ -6709,11 +6465,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -6829,11 +6582,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 218117 -======= - "sizeInBytes": 210916 ->>>>>>> master + "sizeInBytes": 212831 }, "onSnapshotsInSync": { "dependencies": { @@ -6850,10 +6599,7 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD -======= "applyRemoteEvent", ->>>>>>> master "applyRemoteEventToLocalCache", "applySetMutationToLocalView", "applySetMutationToRemoteDocument", @@ -7181,11 +6927,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 196997 -======= "sizeInBytes": 192185 ->>>>>>> master }, "orderBy": { "dependencies": { @@ -7253,61 +6995,8 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 28770 -======= "sizeInBytes": 28772 }, - "parent": { - "dependencies": { - "functions": [ - "argToString", - "cast", - "fail", - "formatJSON", - "getMessageOrStack", - "hardAssert", - "isIndexedDbTransactionError", - "isNullOrUndefined", - "logDebug", - "logError", - "newQueryForPath", - "parent", - "primitiveComparator", - "randomBytes", - "registerFirestore", - "removeComponents", - "removeComponents$1", - "wrapInUserErrorIfRecoverable" - ], - "classes": [ - "AsyncQueue", - "AutoId", - "BasePath", - "CollectionReference", - "DatabaseId", - "DatabaseInfo", - "Deferred", - "DelayedOperation", - "DocumentKey", - "DocumentKeyReference", - "DocumentReference", - "ExponentialBackoff", - "FirebaseCredentialsProvider", - "Firestore", - "Firestore$1", - "FirestoreError", - "OAuthToken", - "Query", - "QueryImpl", - "ResourcePath", - "User" - ], - "variables": [] - }, - "sizeInBytes": 22853 ->>>>>>> master - }, "query": { "dependencies": { "functions": [ @@ -7346,11 +7035,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 17392 -======= "sizeInBytes": 17394 ->>>>>>> master }, "queryEqual": { "dependencies": { @@ -7426,11 +7111,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 33341 -======= "sizeInBytes": 33343 ->>>>>>> master }, "refEqual": { "dependencies": { @@ -7481,11 +7162,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 23925 -======= - "sizeInBytes": 22400 ->>>>>>> master + "sizeInBytes": 23927 }, "runTransaction": { "dependencies": { @@ -7613,11 +7290,8 @@ "BaseFieldPath", "BasePath", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -7681,11 +7355,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 85597 -======= - "sizeInBytes": 81655 ->>>>>>> master + "sizeInBytes": 85139 }, "serverTimestamp": { "dependencies": { @@ -7730,11 +7400,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 17686 -======= "sizeInBytes": 17688 ->>>>>>> master }, "setDoc": { "dependencies": { @@ -7752,10 +7418,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applySuccessfulWrite", @@ -7887,6 +7549,7 @@ "newPersistentWatchStream", "newPersistentWriteStream", "newQueryComparator", + "newQueryForPath", "newSerializer", "newSyncEngine", "newTarget", @@ -8003,11 +7666,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -8112,11 +7772,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 214619 -======= - "sizeInBytes": 188729 ->>>>>>> master + "sizeInBytes": 190922 }, "setLogLevel": { "dependencies": { @@ -8154,11 +7810,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 16660 -======= "sizeInBytes": 16662 ->>>>>>> master }, "snapshotEqual": { "dependencies": { @@ -8240,11 +7892,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -8279,11 +7928,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 52879 -======= - "sizeInBytes": 50434 ->>>>>>> master + "sizeInBytes": 52407 }, "startAfter": { "dependencies": { @@ -8373,11 +8018,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -8413,11 +8055,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 55169 -======= - "sizeInBytes": 52690 ->>>>>>> master + "sizeInBytes": 54663 }, "startAt": { "dependencies": { @@ -8507,11 +8145,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Deferred", @@ -8547,11 +8182,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 55159 -======= - "sizeInBytes": 52680 ->>>>>>> master + "sizeInBytes": 54653 }, "terminate": { "dependencies": { @@ -8590,11 +8221,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 17190 -======= "sizeInBytes": 17193 ->>>>>>> master }, "updateDoc": { "dependencies": { @@ -8611,10 +8238,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applySuccessfulWrite", @@ -8747,6 +8370,7 @@ "newPersistentWatchStream", "newPersistentWriteStream", "newQueryComparator", + "newQueryForPath", "newSerializer", "newSyncEngine", "newTarget", @@ -8864,11 +8488,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -8975,11 +8596,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 216118 -======= - "sizeInBytes": 190228 ->>>>>>> master + "sizeInBytes": 192421 }, "waitForPendingWrites": { "dependencies": { @@ -8994,10 +8611,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applyTransformMutationToLocalView", @@ -9297,11 +8910,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 195940 -======= "sizeInBytes": 166293 ->>>>>>> master }, "where": { "dependencies": { @@ -9447,11 +9056,7 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 59601 -======= "sizeInBytes": 58994 ->>>>>>> master }, "writeBatch": { "dependencies": { @@ -9469,10 +9074,6 @@ "applyOnlineStateChange", "applyPatchMutationToLocalView", "applyPatchMutationToRemoteDocument", -<<<<<<< HEAD - "applyRemoteEventToLocalCache", -======= ->>>>>>> master "applySetMutationToLocalView", "applySetMutationToRemoteDocument", "applySuccessfulWrite", @@ -9605,6 +9206,7 @@ "newPersistentWatchStream", "newPersistentWriteStream", "newQueryComparator", + "newQueryForPath", "newSerializer", "newSyncEngine", "newTarget", @@ -9724,11 +9326,8 @@ "BasePath", "Bound", "ByteString", -<<<<<<< HEAD - "CollectionReference", -======= "Bytes", ->>>>>>> master + "CollectionReference", "DatabaseId", "DatabaseInfo", "Datastore", @@ -9837,10 +9436,6 @@ ], "variables": [] }, -<<<<<<< HEAD - "sizeInBytes": 219785 -======= - "sizeInBytes": 193895 ->>>>>>> master + "sizeInBytes": 196088 } } \ No newline at end of file From d2fc5945b1a2cfda1cd0b56c5063792f460b2407 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 27 Aug 2020 19:13:29 +0200 Subject: [PATCH 4/4] Change argument order --- packages/firestore/lite/src/api/reference.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/firestore/lite/src/api/reference.ts b/packages/firestore/lite/src/api/reference.ts index 8fcc752cd75..a78080df7fd 100644 --- a/packages/firestore/lite/src/api/reference.ts +++ b/packages/firestore/lite/src/api/reference.ts @@ -109,8 +109,8 @@ export class DocumentReference get parent(): CollectionReference { return new CollectionReference( this.firestore, - this._key.path.popLast(), - this._converter + this._converter, + this._key.path.popLast() ); } @@ -122,8 +122,8 @@ export class DocumentReference validateCollectionPath(absolutePath); return new CollectionReference( this.firestore, - absolutePath, - /* converter= */ null + /* converter= */ null, + absolutePath ); } @@ -389,8 +389,8 @@ export class CollectionReference constructor( readonly firestore: Firestore, - readonly _path: ResourcePath, - converter: firestore.FirestoreDataConverter | null + converter: firestore.FirestoreDataConverter | null, + readonly _path: ResourcePath ) { super(firestore, converter, newQueryForPath(_path)); } @@ -431,7 +431,7 @@ export class CollectionReference withConverter( converter: firestore.FirestoreDataConverter ): firestore.CollectionReference { - return new CollectionReference(this.firestore, this._path, converter); + return new CollectionReference(this.firestore, converter, this._path); } } @@ -458,7 +458,7 @@ export function collection( if (parent instanceof Firestore) { const absolutePath = ResourcePath.fromString(relativePath); validateCollectionPath(absolutePath); - return new CollectionReference(parent, absolutePath, /* converter= */ null); + return new CollectionReference(parent, /* converter= */ null, absolutePath); } else { if ( !(parent instanceof DocumentReference) && @@ -476,8 +476,8 @@ export function collection( validateCollectionPath(absolutePath); return new CollectionReference( parent.firestore, - absolutePath, - /* converter= */ null + /* converter= */ null, + absolutePath ); } }