@@ -5,7 +5,7 @@ import { MutationOps } from '../shared/types'
55import { collectLinkedNodeStatements , collectNodeStatements , findExistingNode , runUpdateTransport } from '../shared/rdfMutationHelpers'
66import { logAndThrowMutationError } from '../shared/mutationErrors'
77import { createIdNode } from '../shared/idNodeFactory'
8- import { contactInfoUpdatesFailedMessageText , updaterUnsupportedStoreErrorMessageText } from '../../texts'
8+ import { saveContactUpdatesFailedMessageText , updaterUnsupportedStoreErrorMessageText } from '../../texts'
99import { buildAddressStatements , buildEmailStatements , buildPhoneStatements } from './rdfBuilders'
1010
1111async function mutatePhoneEntries ( store : LiveStore , subject : NamedNode , phoneOps : MutationOps < ContactPointRow > ) {
@@ -15,8 +15,8 @@ async function mutatePhoneEntries(store: LiveStore, subject: NamedNode, phoneOps
1515 const insertions : any [ ] = [ ]
1616
1717 phoneOps . remove . forEach ( ( phone ) => {
18- if ( ! phone . entryNode ) return
19- const existingNode = findExistingNode ( existingPhoneNodes , phone . entryNode )
18+ if ( ! phone . sourceNode ) return
19+ const existingNode = findExistingNode ( existingPhoneNodes , phone . sourceNode )
2020 if ( existingNode ) {
2121 const linkedPhoneStatements = collectLinkedNodeStatements ( store , subject , ns . vcard ( 'hasTelephone' ) , doc )
2222 const matchingLinkStatement = linkedPhoneStatements . linkStatements . find ( ( statement ) => statement . object ?. value === existingNode . value )
@@ -28,8 +28,8 @@ async function mutatePhoneEntries(store: LiveStore, subject: NamedNode, phoneOps
2828 } )
2929
3030 phoneOps . update . forEach ( ( phone ) => {
31- if ( ! phone . entryNode ) return
32- const existingNode = findExistingNode ( existingPhoneNodes , phone . entryNode )
31+ if ( ! phone . sourceNode ) return
32+ const existingNode = findExistingNode ( existingPhoneNodes , phone . sourceNode )
3333 if ( ! existingNode ) {
3434 insertions . push ( ...buildPhoneStatements ( subject , doc , createIdNode ( doc ) , phone ) )
3535 return
@@ -49,7 +49,7 @@ async function mutatePhoneEntries(store: LiveStore, subject: NamedNode, phoneOps
4949
5050 await runUpdateTransport ( store , doc , deletions , insertions , {
5151 unsupportedMessage : updaterUnsupportedStoreErrorMessageText ,
52- failureMessage : contactInfoUpdatesFailedMessageText ,
52+ failureMessage : saveContactUpdatesFailedMessageText ,
5353 } )
5454}
5555
@@ -60,8 +60,8 @@ async function mutateEmailEntries(store: LiveStore, subject: NamedNode, emailOps
6060 const insertions : any [ ] = [ ]
6161
6262 emailOps . remove . forEach ( ( email ) => {
63- if ( ! email . entryNode ) return
64- const existingNode = findExistingNode ( existingEmailNodes , email . entryNode )
63+ if ( ! email . sourceNode ) return
64+ const existingNode = findExistingNode ( existingEmailNodes , email . sourceNode )
6565 if ( existingNode ) {
6666 const linkedEmailStatements = collectLinkedNodeStatements ( store , subject , ns . vcard ( 'hasEmail' ) , doc )
6767 const matchingLinkStatement = linkedEmailStatements . linkStatements . find ( ( statement ) => statement . object ?. value === existingNode . value )
@@ -73,8 +73,8 @@ async function mutateEmailEntries(store: LiveStore, subject: NamedNode, emailOps
7373 } )
7474
7575 emailOps . update . forEach ( ( email ) => {
76- if ( ! email . entryNode ) return
77- const existingNode = findExistingNode ( existingEmailNodes , email . entryNode )
76+ if ( ! email . sourceNode ) return
77+ const existingNode = findExistingNode ( existingEmailNodes , email . sourceNode )
7878 if ( ! existingNode ) {
7979 insertions . push ( ...buildEmailStatements ( subject , doc , createIdNode ( doc ) , email ) )
8080 return
@@ -89,7 +89,7 @@ async function mutateEmailEntries(store: LiveStore, subject: NamedNode, emailOps
8989
9090 await runUpdateTransport ( store , doc , deletions , insertions , {
9191 unsupportedMessage : updaterUnsupportedStoreErrorMessageText ,
92- failureMessage : contactInfoUpdatesFailedMessageText ,
92+ failureMessage : saveContactUpdatesFailedMessageText ,
9393 } )
9494}
9595
@@ -100,8 +100,8 @@ async function mutateAddressEntries(store: LiveStore, subject: NamedNode, addres
100100 const insertions : any [ ] = [ ]
101101
102102 addressOps . remove . forEach ( ( address ) => {
103- if ( ! address . entryNode ) return
104- const existingNode = findExistingNode ( existingAddressNodes , address . entryNode )
103+ if ( ! address . sourceNode ) return
104+ const existingNode = findExistingNode ( existingAddressNodes , address . sourceNode )
105105 if ( existingNode ) {
106106 const linkedAddressStatements = collectLinkedNodeStatements ( store , subject , ns . vcard ( 'hasAddress' ) , doc )
107107 const matchingLinkStatement = linkedAddressStatements . linkStatements . find ( ( statement ) => statement . object ?. value === existingNode . value )
@@ -113,8 +113,8 @@ async function mutateAddressEntries(store: LiveStore, subject: NamedNode, addres
113113 } )
114114
115115 addressOps . update . forEach ( ( address ) => {
116- if ( ! address . entryNode ) return
117- const existingNode = findExistingNode ( existingAddressNodes , address . entryNode )
116+ if ( ! address . sourceNode ) return
117+ const existingNode = findExistingNode ( existingAddressNodes , address . sourceNode )
118118 if ( ! existingNode ) {
119119 insertions . push ( ...buildAddressStatements ( subject , doc , createIdNode ( doc ) , address ) )
120120 return
@@ -129,7 +129,7 @@ async function mutateAddressEntries(store: LiveStore, subject: NamedNode, addres
129129
130130 await runUpdateTransport ( store , doc , deletions , insertions , {
131131 unsupportedMessage : updaterUnsupportedStoreErrorMessageText ,
132- failureMessage : contactInfoUpdatesFailedMessageText ,
132+ failureMessage : saveContactUpdatesFailedMessageText ,
133133 } )
134134}
135135
@@ -139,6 +139,6 @@ export async function processContactInfoMutations(store: LiveStore, subject: Nam
139139 await mutateEmailEntries ( store , subject , mutationPlan . emailOps )
140140 await mutateAddressEntries ( store , subject , mutationPlan . addressOps )
141141 } catch ( error ) {
142- logAndThrowMutationError ( error )
142+ logAndThrowMutationError ( error , saveContactUpdatesFailedMessageText )
143143 }
144144}
0 commit comments