1
1
import { ApplicationError } from "@js-soft/ts-utils" ;
2
- import { CoreError , CoreId } from "@nmshd/transport" ;
2
+ import { CoreAddress , CoreError , CoreId } from "@nmshd/transport" ;
3
3
4
4
class Attributes {
5
5
public successorIsNotAValidAttribute ( error : any ) {
@@ -38,10 +38,17 @@ class Attributes {
38
38
) ;
39
39
}
40
40
41
- public sourceContentIsNotEqualToCopyContent ( ) {
41
+ public predecessorSourceContentIsNotEqualToCopyContent ( ) {
42
42
return new CoreError (
43
- "error.consumption.attributes.sourceContentIsNotEqualToCopyContent" ,
44
- "Successor source attribute contents don't match successor shared attribute copy."
43
+ "error.consumption.attributes.predecessorSourceContentIsNotEqualToCopyContent" ,
44
+ "Predecessor source attribute content doesn't match predecessor shared attribute copy."
45
+ ) ;
46
+ }
47
+
48
+ public successorSourceContentIsNotEqualToCopyContent ( ) {
49
+ return new CoreError (
50
+ "error.consumption.attributes.successorSourceContentIsNotEqualToCopyContent" ,
51
+ "Successor source attribute content doesn't match successor shared attribute copy."
45
52
) ;
46
53
}
47
54
@@ -116,6 +123,18 @@ class Attributes {
116
123
return new CoreError ( "error.consumption.attributes.predecessorDoesNotExist" , "The predecessor does not exist." ) ;
117
124
}
118
125
126
+ public successorDoesNotExist ( ) {
127
+ return new CoreError ( "error.consumption.attributes.successorDoesNotExist" , "The successor does not exist." ) ;
128
+ }
129
+
130
+ public successorSourceAttributeIsNotSpecified ( ) {
131
+ return new CoreError ( "error.consumption.attributes.successorSourceAttributeIsNotSpecified" , "You must specify the source attribute of the successor." ) ;
132
+ }
133
+
134
+ public successorSourceAttributeDoesNotExist ( ) {
135
+ return new CoreError ( "error.consumption.attributes.successorSourceAttributeDoesNotExist" , "The successor source Attribute does not exist." ) ;
136
+ }
137
+
119
138
public successionMustNotChangeOwner ( ) {
120
139
return new CoreError (
121
140
"error.consumption.attributes.successionMustNotChangeOwner" ,
@@ -154,9 +173,70 @@ class Attributes {
154
173
return new CoreError ( "error.consumption.attributes.invalidParentSuccessor" , `The complex parent successor (id: ${ parentSuccessorId } ) does not exist.` ) ;
155
174
}
156
175
176
+ public cannotSucceedAttributesWithDeletionInfo ( ) {
177
+ return new CoreError (
178
+ "error.consumption.attributes.cannotSucceedAttributesWithDeletionInfo" ,
179
+ "You cannot succeed attributes with a deletionInfo, since the peer may have already deleted it or marked it for deletion."
180
+ ) ;
181
+ }
182
+
183
+ public cannotSetDeletionInfoOfRepositoryAttributes ( ) {
184
+ return new CoreError (
185
+ "error.consumption.attributes.cannotSetDeletionInfoOfRepositoryAttributes" ,
186
+ "RepositoryAttributes can not have a deletionInfo, since they are not shared with a peer and you can delete them directly."
187
+ ) ;
188
+ }
189
+
190
+ public invalidDeletionInfoOfOwnSharedAttribute ( ) {
191
+ return new CoreError (
192
+ "error.consumption.attributes.invalidDeletionInfoOfOwnSharedAttribute" ,
193
+ "The only valid deletionStatuses for own shared Attributes are 'DeletedByPeer' or 'ToBeDeletedByPeer'."
194
+ ) ;
195
+ }
196
+
197
+ public invalidDeletionInfoOfPeerSharedAttribute ( ) {
198
+ return new CoreError (
199
+ "error.consumption.attributes.invalidDeletionInfoOfPeerSharedAttribute" ,
200
+ "The only valid deletionStatuses for peer shared Attributes are 'DeletedByOwner' or 'ToBeDeleted'."
201
+ ) ;
202
+ }
203
+
204
+ public invalidDeletionInfoOfThirdPartyOwnedRelationshipAttribute ( ) {
205
+ return new CoreError (
206
+ "error.consumption.attributes.invalidDeletionInfoOfThirdPartyOwnedRelationshipAttribute" ,
207
+ "The only valid deletionStatus for third party owned RelationshipAttributes is 'DeletedByPeer'."
208
+ ) ;
209
+ }
210
+
157
211
public invalidPropertyValue ( message : string ) {
158
212
return new CoreError ( "error.consumption.attributes.invalidPropertyValue" , message ) ;
159
213
}
214
+
215
+ public isNotSharedAttribute ( attributeId : string | CoreId ) {
216
+ return new CoreError ( "error.consumption.attributes.isNotSharedAttribute" , `The attribute (id: ${ attributeId } ) is not a shared attribute.` ) ;
217
+ }
218
+
219
+ public isNotOwnSharedAttribute ( attributeId : string | CoreId ) {
220
+ return new CoreError ( "error.consumption.attributes.isNotOwnSharedAttribute" , `The attribute (id: ${ attributeId } ) is not an own shared attribute.` ) ;
221
+ }
222
+
223
+ public isNotPeerSharedAttribute ( attributeId : string | CoreId ) {
224
+ return new CoreError ( "error.consumption.attributes.isNotPeerSharedAttribute" , `The attribute (id: ${ attributeId } ) is not a peer shared attribute.` ) ;
225
+ }
226
+
227
+ public isNotThirdPartyOwnedRelationshipAttribute ( attributeId : string | CoreId ) {
228
+ return new CoreError (
229
+ "error.consumption.attributes.isNotThirdPartyOwnedRelationshipAttribute" ,
230
+ `The attribute (id: ${ attributeId } ) is not a third party owned RelationshipAttribute.`
231
+ ) ;
232
+ }
233
+
234
+ public senderIsNotPeerOfSharedAttribute ( senderId : string | CoreAddress , attributeId : string | CoreId ) {
235
+ return new CoreError (
236
+ "error.consumption.attributes.senderIsNotPeerOfSharedAttribute" ,
237
+ `The sender (id: ${ senderId } ) is not the peer you shared the attribute (id: ${ attributeId } ) with.`
238
+ ) ;
239
+ }
160
240
}
161
241
162
242
class Requests {
@@ -180,8 +260,8 @@ class Requests {
180
260
) ;
181
261
}
182
262
183
- public invalidAcceptParameters ( ) : ApplicationError {
184
- return new ApplicationError ( "error.consumption.requests.canAccept. invalidAcceptParameters" , "The RequestItem was answered with incorrect parameters." ) ;
263
+ public invalidAcceptParameters ( message : string ) : ApplicationError {
264
+ return new ApplicationError ( "error.consumption.requests.invalidAcceptParameters" , message ) ;
185
265
}
186
266
187
267
public invalidRequestItem ( message : string ) {
0 commit comments