Skip to content

Remove Cyclic Dependencies #4160

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5599705
Move FieldMask
schmidt-sebastian Dec 3, 2020
b8efc13
Move normalizeTimestamp
schmidt-sebastian Dec 3, 2020
6af13ee
Move TypeOrder
schmidt-sebastian Dec 3, 2020
f315c89
Move query
schmidt-sebastian Dec 3, 2020
bf8f746
Move toDouble, toInteger
schmidt-sebastian Dec 3, 2020
fb16170
Move Serializer
schmidt-sebastian Dec 3, 2020
b682857
Move PersistenceTransaction
schmidt-sebastian Dec 3, 2020
6e32f92
Move ExponentialBackoff
schmidt-sebastian Dec 3, 2020
e2846a9
Move LocalStoreImpl
schmidt-sebastian Dec 3, 2020
8fcc47b
LruGarbageCollector
schmidt-sebastian Dec 3, 2020
3456d83
Move PRIMARY_LEASE_LOST_ERROR_MSG
schmidt-sebastian Dec 3, 2020
0fba935
BundleReader
schmidt-sebastian Dec 3, 2020
3e69755
Move BundleLoader
schmidt-sebastian Dec 3, 2020
a4758a0
IndexedDbBundleCache
schmidt-sebastian Dec 3, 2020
1b1a67d
IndexedDbIndexManager
schmidt-sebastian Dec 3, 2020
11df697
Clean up IndexedDbPersistence
schmidt-sebastian Dec 3, 2020
1159302
Remove unused imports
schmidt-sebastian Dec 3, 2020
e5b9a81
removeMutationBatch/DocumentKey
schmidt-sebastian Dec 3, 2020
b639a29
IndexedDbSchemaConverter
schmidt-sebastian Dec 3, 2020
a503100
IndexedDbBundleCache
schmidt-sebastian Dec 3, 2020
cccabf2
MemoryTargetCache
schmidt-sebastian Dec 3, 2020
0b518f0
Move FieldValue
schmidt-sebastian Dec 3, 2020
cb07140
Move FieldValue implementations
schmidt-sebastian Dec 3, 2020
d9c66ec
Fix Components
schmidt-sebastian Dec 3, 2020
c06dd59
Make Reference unique
schmidt-sebastian Dec 3, 2020
d03efd3
Move ensureClientConfigured/configureClient
schmidt-sebastian Dec 3, 2020
c2f951e
Move SnapshotMetadata
schmidt-sebastian Dec 3, 2020
2c0faa2
Fix lite/.../query.ts
schmidt-sebastian Dec 3, 2020
97b2189
Move UserDataWriter
schmidt-sebastian Dec 3, 2020
ec5ac56
Add onwarn
schmidt-sebastian Dec 3, 2020
fef7824
Cleanup
schmidt-sebastian Dec 3, 2020
7fb2de0
Fix unit tests
schmidt-sebastian Dec 3, 2020
2e666fe
Cleanup imports/exports
schmidt-sebastian Dec 3, 2020
fde4f7f
FieldValue exports
schmidt-sebastian Dec 3, 2020
f324093
Manual cleanup
schmidt-sebastian Dec 4, 2020
a1f8f77
Merge
schmidt-sebastian Dec 4, 2020
e66d39d
Add separate FieldMask
schmidt-sebastian Dec 4, 2020
57ff562
Add TypeOrder comment
schmidt-sebastian Dec 4, 2020
a4001fc
s/numberSerializer/valueSerializer
schmidt-sebastian Dec 4, 2020
618017d
AsyncQueue/AsyncQueueImpl
schmidt-sebastian Dec 5, 2020
a35b1d6
s/_methods/_impl
schmidt-sebastian Dec 5, 2020
a8e3409
getStore
schmidt-sebastian Dec 5, 2020
0294aa3
BATCHID_UNKNOWN
schmidt-sebastian Dec 5, 2020
6482dae
removeMutationBatch
schmidt-sebastian Dec 5, 2020
b15d996
DocumentKey
schmidt-sebastian Dec 5, 2020
045f33f
FirestoreService
schmidt-sebastian Dec 5, 2020
55fb014
Fix bad merge
schmidt-sebastian Dec 5, 2020
d41071c
Feedback
schmidt-sebastian Dec 8, 2020
9f9cfaf
Merge
schmidt-sebastian Dec 8, 2020
25d414c
Fix bundles
schmidt-sebastian Dec 8, 2020
d180871
Undo API Extractor
schmidt-sebastian Dec 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/firestore/src/api/user_data_writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
} from '../model/server_timestamps';
import { fail, hardAssert } from '../util/assert';
import { forEach } from '../util/obj';
import { TypeOrder } from '../model/object_value';
import { ResourcePath } from '../model/path';
import { isValidResourceName } from '../remote/serializer';
import { logError } from '../util/log';
Expand All @@ -48,6 +47,7 @@ import {
normalizeNumber,
normalizeTimestamp
} from '../model/normalize';
import { TypeOrder } from '../model/type_order';

export type ServerTimestampBehavior = 'estimate' | 'previous' | 'none';

Expand Down
23 changes: 4 additions & 19 deletions packages/firestore/src/model/object_value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
*/

import {
Value as ProtoValue,
MapValue as ProtoMapValue
MapValue as ProtoMapValue,
Value as ProtoValue
} from '../protos/firestore_proto_api';

import { debugAssert } from '../util/assert';
import { FieldPath } from './path';
import { isServerTimestamp } from './server_timestamps';
import { valueEquals, isMapValue, typeOrder } from './values';
import { isMapValue, typeOrder, valueEquals } from './values';
import { forEach } from '../util/obj';
import { arrayEquals } from '../util/misc';
import { TypeOrder } from './type_order';

/**
* Provides a set of fields that can be used to partially patch a document.
Expand Down Expand Up @@ -73,22 +74,6 @@ export interface JsonObject<T> {
[name: string]: T;
}

export const enum TypeOrder {
// This order is based on the backend's ordering, but modified to support
// server timestamps.
NullValue = 0,
BooleanValue = 1,
NumberValue = 2,
TimestampValue = 3,
ServerTimestampValue = 4,
StringValue = 5,
BlobValue = 6,
RefValue = 7,
GeoPointValue = 8,
ArrayValue = 9,
ObjectValue = 10
}

/**
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
* ability to add and remove fields (via the ObjectValueBuilder).
Expand Down
32 changes: 32 additions & 0 deletions packages/firestore/src/model/type_order.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export const enum TypeOrder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that this is in a separate file, maybe give it a comment?

https://github.com/firebase/firebase-ios-sdk/blob/master/Firestore/core/src/model/field_value.h#L62 would be suitable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I actually added a small comment in a later commit, but the one you provided is better.

// This order is based on the backend's ordering, but modified to support
// server timestamps.
NullValue = 0,
BooleanValue = 1,
NumberValue = 2,
TimestampValue = 3,
ServerTimestampValue = 4,
StringValue = 5,
BlobValue = 6,
RefValue = 7,
GeoPointValue = 8,
ArrayValue = 9,
ObjectValue = 10
}
2 changes: 1 addition & 1 deletion packages/firestore/src/model/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
Value
} from '../protos/firestore_proto_api';

import { TypeOrder } from './object_value';
import { fail } from '../util/assert';
import { forEach, objectSize } from '../util/obj';
import { isNegativeZero } from '../util/types';
Expand All @@ -40,6 +39,7 @@ import {
normalizeNumber,
normalizeTimestamp
} from './normalize';
import { TypeOrder } from './type_order';

/** Extracts the backend's type order for the provided value. */
export function typeOrder(value: Value): TypeOrder {
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/test/unit/model/object_value.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { expect } from 'chai';
import {
extractFieldMask,
ObjectValue,
ObjectValueBuilder,
TypeOrder
ObjectValueBuilder
} from '../../../src/model/object_value';
import { typeOrder } from '../../../src/model/values';
import { wrap, wrapObject, field, mask } from '../../util/helpers';
import { TypeOrder } from '../../../src/model/type_order';

describe('ObjectValue', () => {
it('can extract fields', () => {
Expand Down