@@ -21,7 +21,14 @@ import {
2121 resolveDeferredValueTree
2222} from './util/ServerValues' ;
2323import { nodeFromJSON } from './snap/nodeFromJSON' ;
24- import { Path } from './util/Path' ;
24+ import {
25+ newEmptyPath ,
26+ newRelativePath ,
27+ Path ,
28+ pathChild ,
29+ pathGetFront ,
30+ pathPopFront
31+ } from './util/Path' ;
2532import { SparseSnapshotTree } from './SparseSnapshotTree' ;
2633import { SyncTree } from './SyncTree' ;
2734import { SnapshotHolder } from './SnapshotHolder' ;
@@ -496,7 +503,7 @@ export class Repo {
496503 each ( childrenToMerge , ( changedKey : string , changedValue : unknown ) => {
497504 empty = false ;
498505 changedChildren [ changedKey ] = resolveDeferredValueTree (
499- path . child ( changedKey ) ,
506+ pathChild ( path , changedKey ) ,
500507 nodeFromJSON ( changedValue ) ,
501508 this . serverSyncTree_ ,
502509 serverValues
@@ -536,7 +543,9 @@ export class Repo {
536543 ) ;
537544
538545 each ( childrenToMerge , ( changedPath : string ) => {
539- const affectedPath = this . abortTransactions_ ( path . child ( changedPath ) ) ;
546+ const affectedPath = this . abortTransactions_ (
547+ pathChild ( path , changedPath )
548+ ) ;
540549 this . rerunTransactions_ ( affectedPath ) ;
541550 } ) ;
542551
@@ -556,7 +565,7 @@ export class Repo {
556565
557566 const serverValues = this . generateServerValues ( ) ;
558567 const resolvedOnDisconnectTree = new SparseSnapshotTree ( ) ;
559- this . onDisconnect_ . forEachTree ( Path . Empty , ( path , node ) => {
568+ this . onDisconnect_ . forEachTree ( newEmptyPath ( ) , ( path , node ) => {
560569 const resolved = resolveDeferredValueTree (
561570 path ,
562571 node ,
@@ -567,7 +576,7 @@ export class Repo {
567576 } ) ;
568577 let events : Event [ ] = [ ] ;
569578
570- resolvedOnDisconnectTree . forEachTree ( Path . Empty , ( path , snap ) => {
579+ resolvedOnDisconnectTree . forEachTree ( newEmptyPath ( ) , ( path , snap ) => {
571580 events = events . concat (
572581 this . serverSyncTree_ . applyServerOverwrite ( path , snap )
573582 ) ;
@@ -576,7 +585,11 @@ export class Repo {
576585 } ) ;
577586
578587 this . onDisconnect_ = new SparseSnapshotTree ( ) ;
579- eventQueueRaiseEventsForChangedPath ( this . eventQueue_ , Path . Empty , events ) ;
588+ eventQueueRaiseEventsForChangedPath (
589+ this . eventQueue_ ,
590+ newEmptyPath ( ) ,
591+ events
592+ ) ;
580593 }
581594
582595 onDisconnectCancel (
@@ -648,7 +661,10 @@ export class Repo {
648661 if ( status === 'ok' ) {
649662 each ( childrenToMerge , ( childName : string , childNode : unknown ) => {
650663 const newChildNode = nodeFromJSON ( childNode ) ;
651- this . onDisconnect_ . remember ( path . child ( childName ) , newChildNode ) ;
664+ this . onDisconnect_ . remember (
665+ pathChild ( path , childName ) ,
666+ newChildNode
667+ ) ;
652668 } ) ;
653669 }
654670 this . callOnCompleteCallback ( onComplete , status , errorReason ) ;
@@ -658,7 +674,7 @@ export class Repo {
658674
659675 addEventCallbackForQuery ( query : Query , eventRegistration : EventRegistration ) {
660676 let events ;
661- if ( query . path . getFront ( ) === '.info' ) {
677+ if ( pathGetFront ( query . path ) === '.info' ) {
662678 events = this . infoSyncTree_ . addEventRegistration (
663679 query ,
664680 eventRegistration
@@ -679,7 +695,7 @@ export class Repo {
679695 // These are guaranteed not to raise events, since we're not passing in a cancelError. However, we can future-proof
680696 // a little bit by handling the return values anyways.
681697 let events ;
682- if ( query . path . getFront ( ) === '.info' ) {
698+ if ( pathGetFront ( query . path ) === '.info' ) {
683699 events = this . infoSyncTree_ . removeEventRegistration (
684700 query ,
685701 eventRegistration
@@ -978,7 +994,7 @@ export class Repo {
978994 ) ;
979995 txn . status = TransactionStatus . SENT ;
980996 txn . retryCount ++ ;
981- const relativePath = Path . relativePath ( path , txn . path ) ;
997+ const relativePath = newRelativePath ( path , txn . path ) ;
982998 // If we've gotten to this point, the output snapshot must be defined.
983999 snapToSend = snapToSend . updateChild (
9841000 relativePath /** @type {!Node } */ ,
@@ -1112,7 +1128,7 @@ export class Repo {
11121128 } ) ;
11131129 for ( let i = 0 ; i < queue . length ; i ++ ) {
11141130 const transaction = queue [ i ] ;
1115- const relativePath = Path . relativePath ( path , transaction . path ) ;
1131+ const relativePath = newRelativePath ( path , transaction . path ) ;
11161132 let abortTransaction = false ,
11171133 abortReason ;
11181134 assert (
@@ -1258,11 +1274,11 @@ export class Repo {
12581274 // Start at the root and walk deeper into the tree towards path until we
12591275 // find a node with pending transactions.
12601276 let transactionNode = this . transactionQueueTree_ ;
1261- front = path . getFront ( ) ;
1277+ front = pathGetFront ( path ) ;
12621278 while ( front !== null && transactionNode . getValue ( ) === null ) {
12631279 transactionNode = transactionNode . subTree ( front ) ;
1264- path = path . popFront ( ) ;
1265- front = path . getFront ( ) ;
1280+ path = pathPopFront ( path ) ;
1281+ front = pathGetFront ( path ) ;
12661282 }
12671283
12681284 return transactionNode ;
0 commit comments