@nmshd/transport 7.0.0-alpha.52 → 7.0.0-alpha.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +5 -5
- package/dist/core/CoreSynchronizable.d.ts +1 -0
- package/dist/core/CoreSynchronizable.d.ts.map +1 -1
- package/dist/core/CoreSynchronizable.js +1 -0
- package/dist/core/CoreSynchronizable.js.map +1 -1
- package/dist/core/DbCollectionName.d.ts +0 -1
- package/dist/core/DbCollectionName.d.ts.map +1 -1
- package/dist/core/DbCollectionName.js +0 -1
- package/dist/core/DbCollectionName.js.map +1 -1
- package/dist/core/TransportController.d.ts +0 -4
- package/dist/core/TransportController.d.ts.map +1 -1
- package/dist/core/TransportController.js +0 -6
- package/dist/core/TransportController.js.map +1 -1
- package/dist/core/TransportCoreErrors.d.ts +0 -1
- package/dist/core/TransportCoreErrors.d.ts.map +1 -1
- package/dist/core/TransportCoreErrors.js +0 -3
- package/dist/core/TransportCoreErrors.js.map +1 -1
- package/dist/core/backbone/RESTClient.d.ts.map +1 -1
- package/dist/core/backbone/RESTClient.js +8 -10
- package/dist/core/backbone/RESTClient.js.map +1 -1
- package/dist/modules/accounts/AccountController.d.ts +0 -6
- package/dist/modules/accounts/AccountController.d.ts.map +1 -1
- package/dist/modules/accounts/AccountController.js +2 -9
- package/dist/modules/accounts/AccountController.js.map +1 -1
- package/dist/modules/accounts/IdentityDeletionProcessController.d.ts +2 -8
- package/dist/modules/accounts/IdentityDeletionProcessController.d.ts.map +1 -1
- package/dist/modules/accounts/IdentityDeletionProcessController.js +4 -24
- package/dist/modules/accounts/IdentityDeletionProcessController.js.map +1 -1
- package/dist/modules/accounts/data/IdentityDeletionProcess.d.ts +35 -8
- package/dist/modules/accounts/data/IdentityDeletionProcess.d.ts.map +1 -1
- package/dist/modules/accounts/data/IdentityDeletionProcess.js +65 -10
- package/dist/modules/accounts/data/IdentityDeletionProcess.js.map +1 -1
- package/dist/modules/announcements/data/Announcement.d.ts +1 -9
- package/dist/modules/announcements/data/Announcement.d.ts.map +1 -1
- package/dist/modules/announcements/data/Announcement.js +3 -21
- package/dist/modules/announcements/data/Announcement.js.map +1 -1
- package/dist/modules/announcements/data/AnnouncementAction.d.ts +11 -0
- package/dist/modules/announcements/data/AnnouncementAction.d.ts.map +1 -0
- package/dist/modules/{certificates/data/items/CertificateRoleItem.js → announcements/data/AnnouncementAction.js} +13 -17
- package/dist/modules/announcements/data/AnnouncementAction.js.map +1 -0
- package/dist/modules/devices/DeviceController.d.ts +0 -1
- package/dist/modules/devices/DeviceController.d.ts.map +1 -1
- package/dist/modules/devices/DeviceController.js +0 -3
- package/dist/modules/devices/DeviceController.js.map +1 -1
- package/dist/modules/devices/local/Device.d.ts +0 -2
- package/dist/modules/devices/local/Device.d.ts.map +1 -1
- package/dist/modules/devices/local/Device.js +0 -6
- package/dist/modules/devices/local/Device.js.map +1 -1
- package/dist/modules/files/FileController.d.ts +2 -9
- package/dist/modules/files/FileController.d.ts.map +1 -1
- package/dist/modules/files/FileController.js +37 -82
- package/dist/modules/files/FileController.js.map +1 -1
- package/dist/modules/files/local/File.d.ts +49 -9
- package/dist/modules/files/local/File.d.ts.map +1 -1
- package/dist/modules/files/local/File.js +134 -12
- package/dist/modules/files/local/File.js.map +1 -1
- package/dist/modules/index.d.ts +2 -23
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +2 -23
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/messages/MessageController.d.ts +3 -8
- package/dist/modules/messages/MessageController.d.ts.map +1 -1
- package/dist/modules/messages/MessageController.js +28 -54
- package/dist/modules/messages/MessageController.js.map +1 -1
- package/dist/modules/messages/local/Message.d.ts +28 -7
- package/dist/modules/messages/local/Message.d.ts.map +1 -1
- package/dist/modules/messages/local/Message.js +53 -12
- package/dist/modules/messages/local/Message.js.map +1 -1
- package/dist/modules/messages/local/{CachedMessageRecipient.d.ts → MessageRecipient.d.ts} +4 -4
- package/dist/modules/messages/local/MessageRecipient.d.ts.map +1 -0
- package/dist/modules/messages/local/{CachedMessageRecipient.js → MessageRecipient.js} +12 -12
- package/dist/modules/messages/local/MessageRecipient.js.map +1 -0
- package/dist/modules/messages/transmission/MessageContentWrapper.js +1 -2
- package/dist/modules/messages/transmission/MessageContentWrapper.js.map +1 -1
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.d.ts +1 -10
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.d.ts.map +1 -1
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +42 -125
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -1
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.d.ts +25 -8
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.d.ts.map +1 -1
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js +68 -14
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js.map +1 -1
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js +2 -2
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js.map +1 -1
- package/dist/modules/relationships/RelationshipSecretController.d.ts +3 -3
- package/dist/modules/relationships/RelationshipSecretController.d.ts.map +1 -1
- package/dist/modules/relationships/RelationshipSecretController.js +2 -2
- package/dist/modules/relationships/RelationshipSecretController.js.map +1 -1
- package/dist/modules/relationships/RelationshipsController.d.ts +0 -10
- package/dist/modules/relationships/RelationshipsController.d.ts.map +1 -1
- package/dist/modules/relationships/RelationshipsController.js +41 -117
- package/dist/modules/relationships/RelationshipsController.js.map +1 -1
- package/dist/modules/relationships/local/Relationship.d.ts +14 -10
- package/dist/modules/relationships/local/Relationship.d.ts.map +1 -1
- package/dist/modules/relationships/local/Relationship.js +30 -28
- package/dist/modules/relationships/local/Relationship.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationMapper.js +3 -3
- package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationsProcessor.d.ts +2 -60
- package/dist/modules/sync/DatawalletModificationsProcessor.d.ts.map +1 -1
- package/dist/modules/sync/DatawalletModificationsProcessor.js +11 -158
- package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -1
- package/dist/modules/sync/SyncController.d.ts +0 -2
- package/dist/modules/sync/SyncController.d.ts.map +1 -1
- package/dist/modules/sync/SyncController.js +3 -9
- package/dist/modules/sync/SyncController.js.map +1 -1
- package/dist/modules/sync/SynchronizedCollection.d.ts.map +1 -1
- package/dist/modules/sync/SynchronizedCollection.js +24 -10
- package/dist/modules/sync/SynchronizedCollection.js.map +1 -1
- package/dist/modules/sync/externalEventProcessors/FileOwnershipClaimedExternalEventProcessor.d.ts.map +1 -1
- package/dist/modules/sync/externalEventProcessors/FileOwnershipClaimedExternalEventProcessor.js +1 -4
- package/dist/modules/sync/externalEventProcessors/FileOwnershipClaimedExternalEventProcessor.js.map +1 -1
- package/dist/modules/sync/externalEventProcessors/IdentityDeletionProcessStatusChangedExternalEventProcessor.js +1 -1
- package/dist/modules/sync/externalEventProcessors/IdentityDeletionProcessStatusChangedExternalEventProcessor.js.map +1 -1
- package/dist/modules/sync/externalEventProcessors/MessageDeliveredExternalEventProcessor.js +1 -1
- package/dist/modules/sync/externalEventProcessors/MessageDeliveredExternalEventProcessor.js.map +1 -1
- package/dist/modules/sync/externalEventProcessors/RelationshipExternalEventProcessor.js +1 -1
- package/dist/modules/sync/externalEventProcessors/RelationshipExternalEventProcessor.js.map +1 -1
- package/dist/modules/sync/local/DatawalletModification.d.ts +2 -2
- package/dist/modules/sync/local/DatawalletModification.d.ts.map +1 -1
- package/dist/modules/sync/local/DatawalletModification.js +1 -1
- package/dist/modules/sync/local/DatawalletModification.js.map +1 -1
- package/dist/modules/sync/migrations/DeviceMigrations.d.ts +2 -2
- package/dist/modules/sync/migrations/DeviceMigrations.d.ts.map +1 -1
- package/dist/modules/sync/migrations/DeviceMigrations.js +5 -15
- package/dist/modules/sync/migrations/DeviceMigrations.js.map +1 -1
- package/dist/modules/tokens/AnonymousTokenController.d.ts.map +1 -1
- package/dist/modules/tokens/AnonymousTokenController.js +1 -5
- package/dist/modules/tokens/AnonymousTokenController.js.map +1 -1
- package/dist/modules/tokens/TokenController.d.ts +1 -10
- package/dist/modules/tokens/TokenController.d.ts.map +1 -1
- package/dist/modules/tokens/TokenController.js +28 -122
- package/dist/modules/tokens/TokenController.js.map +1 -1
- package/dist/modules/tokens/local/Token.d.ts +15 -7
- package/dist/modules/tokens/local/Token.d.ts.map +1 -1
- package/dist/modules/tokens/local/Token.js +38 -13
- package/dist/modules/tokens/local/Token.js.map +1 -1
- package/package.json +10 -10
- package/dist/core/ICacheable.d.ts +0 -6
- package/dist/core/ICacheable.d.ts.map +0 -1
- package/dist/core/ICacheable.js +0 -17
- package/dist/core/ICacheable.js.map +0 -1
- package/dist/modules/accounts/data/CachedIdentityDeletionProcess.d.ts +0 -44
- package/dist/modules/accounts/data/CachedIdentityDeletionProcess.d.ts.map +0 -1
- package/dist/modules/accounts/data/CachedIdentityDeletionProcess.js +0 -80
- package/dist/modules/accounts/data/CachedIdentityDeletionProcess.js.map +0 -1
- package/dist/modules/certificates/CertificateController.d.ts +0 -15
- package/dist/modules/certificates/CertificateController.d.ts.map +0 -1
- package/dist/modules/certificates/CertificateController.js +0 -20
- package/dist/modules/certificates/CertificateController.js.map +0 -1
- package/dist/modules/certificates/CertificateIssuer.d.ts +0 -29
- package/dist/modules/certificates/CertificateIssuer.d.ts.map +0 -1
- package/dist/modules/certificates/CertificateIssuer.js +0 -43
- package/dist/modules/certificates/CertificateIssuer.js.map +0 -1
- package/dist/modules/certificates/CertificateValidator.d.ts +0 -15
- package/dist/modules/certificates/CertificateValidator.d.ts.map +0 -1
- package/dist/modules/certificates/CertificateValidator.js +0 -20
- package/dist/modules/certificates/CertificateValidator.js.map +0 -1
- package/dist/modules/certificates/data/Certificate.d.ts +0 -34
- package/dist/modules/certificates/data/Certificate.d.ts.map +0 -1
- package/dist/modules/certificates/data/Certificate.js +0 -61
- package/dist/modules/certificates/data/Certificate.js.map +0 -1
- package/dist/modules/certificates/data/CertificateConstraint.d.ts +0 -10
- package/dist/modules/certificates/data/CertificateConstraint.d.ts.map +0 -1
- package/dist/modules/certificates/data/CertificateConstraint.js +0 -23
- package/dist/modules/certificates/data/CertificateConstraint.js.map +0 -1
- package/dist/modules/certificates/data/CertificateContent.d.ts +0 -29
- package/dist/modules/certificates/data/CertificateContent.d.ts.map +0 -1
- package/dist/modules/certificates/data/CertificateContent.js +0 -66
- package/dist/modules/certificates/data/CertificateContent.js.map +0 -1
- package/dist/modules/certificates/data/CertificateItem.d.ts +0 -11
- package/dist/modules/certificates/data/CertificateItem.d.ts.map +0 -1
- package/dist/modules/certificates/data/CertificateItem.js +0 -24
- package/dist/modules/certificates/data/CertificateItem.js.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.d.ts +0 -30
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.d.ts.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js +0 -56
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.d.ts +0 -32
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.d.ts.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js +0 -59
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.d.ts +0 -10
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.d.ts.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js +0 -30
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.d.ts +0 -17
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.d.ts.map +0 -1
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js +0 -40
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js.map +0 -1
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.d.ts +0 -18
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.d.ts.map +0 -1
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js +0 -38
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js.map +0 -1
- package/dist/modules/certificates/data/items/CertificateDelegateItem.d.ts +0 -19
- package/dist/modules/certificates/data/items/CertificateDelegateItem.d.ts.map +0 -1
- package/dist/modules/certificates/data/items/CertificateDelegateItem.js +0 -45
- package/dist/modules/certificates/data/items/CertificateDelegateItem.js.map +0 -1
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.d.ts +0 -21
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.d.ts.map +0 -1
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js +0 -41
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js.map +0 -1
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.d.ts +0 -26
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.d.ts.map +0 -1
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js +0 -54
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js.map +0 -1
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.d.ts +0 -15
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.d.ts.map +0 -1
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js +0 -38
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js.map +0 -1
- package/dist/modules/certificates/data/items/CertificateRoleItem.d.ts +0 -17
- package/dist/modules/certificates/data/items/CertificateRoleItem.d.ts.map +0 -1
- package/dist/modules/certificates/data/items/CertificateRoleItem.js.map +0 -1
- package/dist/modules/files/local/CachedFile.d.ts +0 -52
- package/dist/modules/files/local/CachedFile.d.ts.map +0 -1
- package/dist/modules/files/local/CachedFile.js +0 -145
- package/dist/modules/files/local/CachedFile.js.map +0 -1
- package/dist/modules/messages/local/CachedMessage.d.ts +0 -23
- package/dist/modules/messages/local/CachedMessage.d.ts.map +0 -1
- package/dist/modules/messages/local/CachedMessage.js +0 -65
- package/dist/modules/messages/local/CachedMessage.js.map +0 -1
- package/dist/modules/messages/local/CachedMessageRecipient.d.ts.map +0 -1
- package/dist/modules/messages/local/CachedMessageRecipient.js.map +0 -1
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.d.ts +0 -30
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.d.ts.map +0 -1
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js +0 -80
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js.map +0 -1
- package/dist/modules/relationships/local/CachedRelationship.d.ts +0 -20
- package/dist/modules/relationships/local/CachedRelationship.d.ts.map +0 -1
- package/dist/modules/relationships/local/CachedRelationship.js +0 -57
- package/dist/modules/relationships/local/CachedRelationship.js.map +0 -1
- package/dist/modules/tokens/local/CachedToken.d.ts +0 -20
- package/dist/modules/tokens/local/CachedToken.d.ts.map +0 -1
- package/dist/modules/tokens/local/CachedToken.js +0 -54
- package/dist/modules/tokens/local/CachedToken.js.map +0 -1
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import { ISerializable } from "@js-soft/ts-serval";
|
|
2
|
-
import { CoreDate, CoreId, ICoreId } from "@nmshd/core-types";
|
|
1
|
+
import { ISerializable, Serializable } from "@js-soft/ts-serval";
|
|
2
|
+
import { CoreDate, CoreId, ICoreDate, ICoreId } from "@nmshd/core-types";
|
|
3
3
|
import { CoreSynchronizable, ICoreSynchronizable } from "../../../core";
|
|
4
4
|
import { Identity, IIdentity } from "../../accounts/data/Identity";
|
|
5
5
|
import { BackboneGetRelationshipResponse } from "../backbone/BackboneGetRelationships";
|
|
6
6
|
import { RelationshipStatus } from "../transmission/RelationshipStatus";
|
|
7
|
-
import { CachedRelationship, ICachedRelationship } from "./CachedRelationship";
|
|
8
7
|
import { IPeerDeletionInfo, PeerDeletionInfo } from "./PeerDeletionInfo";
|
|
8
|
+
import { IRelationshipAuditLogEntry, RelationshipAuditLogEntry } from "./RelationshipAuditLogEntry";
|
|
9
9
|
export interface IRelationship extends ICoreSynchronizable {
|
|
10
10
|
relationshipSecretId: ICoreId;
|
|
11
11
|
peer: IIdentity;
|
|
12
12
|
peerDeletionInfo?: IPeerDeletionInfo;
|
|
13
13
|
status: RelationshipStatus;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
templateId: ICoreId;
|
|
15
|
+
creationContent: ISerializable;
|
|
16
|
+
lastMessageSentAt?: ICoreDate;
|
|
17
|
+
lastMessageReceivedAt?: ICoreDate;
|
|
18
|
+
auditLog: IRelationshipAuditLogEntry[];
|
|
16
19
|
metadata?: any;
|
|
17
20
|
metadataModifiedAt?: CoreDate;
|
|
18
21
|
}
|
|
19
22
|
export declare class Relationship extends CoreSynchronizable implements IRelationship {
|
|
20
23
|
readonly technicalProperties: string[];
|
|
24
|
+
readonly contentProperties: string[];
|
|
21
25
|
readonly metadataProperties: string[];
|
|
22
26
|
relationshipSecretId: CoreId;
|
|
23
27
|
peer: Identity;
|
|
24
28
|
peerDeletionInfo?: PeerDeletionInfo;
|
|
25
29
|
status: RelationshipStatus;
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
templateId: CoreId;
|
|
31
|
+
creationContent: Serializable;
|
|
32
|
+
lastMessageSentAt?: CoreDate;
|
|
33
|
+
lastMessageReceivedAt?: CoreDate;
|
|
34
|
+
auditLog: RelationshipAuditLogEntry[];
|
|
28
35
|
metadata?: any;
|
|
29
36
|
metadataModifiedAt?: CoreDate;
|
|
30
|
-
toJSON(verbose?: boolean | undefined, serializeAsString?: boolean | undefined): Object;
|
|
31
37
|
static fromBackboneAndCreationContent(response: BackboneGetRelationshipResponse, peer: IIdentity, creationContent: ISerializable, relationshipSecretId: CoreId): Relationship;
|
|
32
38
|
static from(value: IRelationship): Relationship;
|
|
33
|
-
setCache(cache: CachedRelationship): this;
|
|
34
39
|
setMetadata(metadata: any): this;
|
|
35
|
-
private newCacheEmptyError;
|
|
36
40
|
}
|
|
37
41
|
//# sourceMappingURL=Relationship.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Relationship.d.ts","sourceRoot":"","sources":["../../../../src/modules/relationships/local/Relationship.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA6B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Relationship.d.ts","sourceRoot":"","sources":["../../../../src/modules/relationships/local/Relationship.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAA6B,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAEpG,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACtD,oBAAoB,EAAE,OAAO,CAAC;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,MAAM,EAAE,kBAAkB,CAAC;IAE3B,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,aAAa,CAAC;IAE/B,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAClC,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IAEvC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,kBAAkB,CAAC,EAAE,QAAQ,CAAC;CACjC;AAED,qBACa,YAAa,SAAQ,kBAAmB,YAAW,aAAa;IACzE,SAAyB,mBAAmB,WAQ1C;IAEF,SAAyB,iBAAiB,WAKxC;IAEF,SAAyB,kBAAkB,WAAgG;IAIpI,oBAAoB,EAAE,MAAM,CAAC;IAI7B,IAAI,EAAE,QAAQ,CAAC;IAIf,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAIpC,MAAM,EAAE,kBAAkB,CAAC;IAI3B,UAAU,EAAE,MAAM,CAAC;IAInB,eAAe,EAAE,YAAY,CAAC;IAI9B,iBAAiB,CAAC,EAAE,QAAQ,CAAC;IAI7B,qBAAqB,CAAC,EAAE,QAAQ,CAAC;IAIjC,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IAItC,QAAQ,CAAC,EAAE,GAAG,CAAC;IAIf,kBAAkB,CAAC,EAAE,QAAQ,CAAC;WAEvB,8BAA8B,CACxC,QAAQ,EAAE,+BAA+B,EACzC,IAAI,EAAE,SAAS,EACf,eAAe,EAAE,aAAa,EAC9B,oBAAoB,EAAE,MAAM,GAC7B,YAAY;WAYD,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY;IAI/C,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;CAK1C"}
|
|
@@ -17,9 +17,9 @@ const ts_simple_nameof_1 = require("ts-simple-nameof");
|
|
|
17
17
|
const core_1 = require("../../../core");
|
|
18
18
|
const Identity_1 = require("../../accounts/data/Identity");
|
|
19
19
|
const RelationshipStatus_1 = require("../transmission/RelationshipStatus");
|
|
20
|
-
const CachedRelationship_1 = require("./CachedRelationship");
|
|
21
20
|
const PeerDeletionInfo_1 = require("./PeerDeletionInfo");
|
|
22
21
|
const RelationshipAuditLog_1 = require("./RelationshipAuditLog");
|
|
22
|
+
const RelationshipAuditLogEntry_1 = require("./RelationshipAuditLogEntry");
|
|
23
23
|
let Relationship = Relationship_1 = class Relationship extends core_1.CoreSynchronizable {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
@@ -29,49 +29,36 @@ let Relationship = Relationship_1 = class Relationship extends core_1.CoreSynchr
|
|
|
29
29
|
(0, ts_simple_nameof_1.nameof)((r) => r.relationshipSecretId),
|
|
30
30
|
(0, ts_simple_nameof_1.nameof)((r) => r.peer),
|
|
31
31
|
(0, ts_simple_nameof_1.nameof)((r) => r.status),
|
|
32
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.peerDeletionInfo)
|
|
32
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.peerDeletionInfo),
|
|
33
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.auditLog)
|
|
34
|
+
];
|
|
35
|
+
this.contentProperties = [
|
|
36
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.templateId),
|
|
37
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.creationContent),
|
|
38
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.lastMessageSentAt),
|
|
39
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.lastMessageReceivedAt)
|
|
33
40
|
];
|
|
34
41
|
this.metadataProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.metadata), (0, ts_simple_nameof_1.nameof)((r) => r.metadataModifiedAt)];
|
|
35
42
|
}
|
|
36
|
-
toJSON(verbose, serializeAsString) {
|
|
37
|
-
const json = super.toJSON(verbose, serializeAsString);
|
|
38
|
-
// Adds flattened peerAddress and templateId to the JSON stored in the database.
|
|
39
|
-
// This helps us to boost the performance of database queries that include these fields.
|
|
40
|
-
json.peerAddress = this.peer.address.toString();
|
|
41
|
-
json.templateId = this.cache?.templateId.toString();
|
|
42
|
-
return json;
|
|
43
|
-
}
|
|
44
43
|
static fromBackboneAndCreationContent(response, peer, creationContent, relationshipSecretId) {
|
|
45
|
-
const cache = CachedRelationship_1.CachedRelationship.from({
|
|
46
|
-
creationContent,
|
|
47
|
-
templateId: core_types_1.CoreId.from(response.relationshipTemplateId),
|
|
48
|
-
auditLog: RelationshipAuditLog_1.RelationshipAuditLog.fromBackboneAuditLog(response.auditLog)
|
|
49
|
-
});
|
|
50
44
|
return Relationship_1.from({
|
|
51
45
|
id: core_types_1.CoreId.from(response.id),
|
|
52
46
|
relationshipSecretId: relationshipSecretId,
|
|
53
47
|
peer: peer,
|
|
54
48
|
status: RelationshipStatus_1.RelationshipStatus.Pending,
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
creationContent,
|
|
50
|
+
templateId: core_types_1.CoreId.from(response.relationshipTemplateId),
|
|
51
|
+
auditLog: RelationshipAuditLog_1.RelationshipAuditLog.fromBackboneAuditLog(response.auditLog)
|
|
57
52
|
});
|
|
58
53
|
}
|
|
59
54
|
static from(value) {
|
|
60
55
|
return this.fromAny(value);
|
|
61
56
|
}
|
|
62
|
-
setCache(cache) {
|
|
63
|
-
this.cache = cache;
|
|
64
|
-
this.cachedAt = core_types_1.CoreDate.utc();
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
57
|
setMetadata(metadata) {
|
|
68
58
|
this.metadata = metadata;
|
|
69
59
|
this.metadataModifiedAt = core_types_1.CoreDate.utc();
|
|
70
60
|
return this;
|
|
71
61
|
}
|
|
72
|
-
newCacheEmptyError() {
|
|
73
|
-
return new core_1.TransportError(`The cache of the Relationship with id "${this.id}" is empty.`);
|
|
74
|
-
}
|
|
75
62
|
};
|
|
76
63
|
exports.Relationship = Relationship;
|
|
77
64
|
__decorate([
|
|
@@ -94,16 +81,31 @@ __decorate([
|
|
|
94
81
|
(0, ts_serval_1.serialize)(),
|
|
95
82
|
__metadata("design:type", String)
|
|
96
83
|
], Relationship.prototype, "status", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, ts_serval_1.validate)(),
|
|
86
|
+
(0, ts_serval_1.serialize)(),
|
|
87
|
+
__metadata("design:type", core_types_1.CoreId)
|
|
88
|
+
], Relationship.prototype, "templateId", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, ts_serval_1.validate)(),
|
|
91
|
+
(0, ts_serval_1.serialize)(),
|
|
92
|
+
__metadata("design:type", ts_serval_1.Serializable)
|
|
93
|
+
], Relationship.prototype, "creationContent", void 0);
|
|
97
94
|
__decorate([
|
|
98
95
|
(0, ts_serval_1.validate)({ nullable: true }),
|
|
99
96
|
(0, ts_serval_1.serialize)(),
|
|
100
|
-
__metadata("design:type",
|
|
101
|
-
], Relationship.prototype, "
|
|
97
|
+
__metadata("design:type", core_types_1.CoreDate)
|
|
98
|
+
], Relationship.prototype, "lastMessageSentAt", void 0);
|
|
102
99
|
__decorate([
|
|
103
100
|
(0, ts_serval_1.validate)({ nullable: true }),
|
|
104
101
|
(0, ts_serval_1.serialize)(),
|
|
105
102
|
__metadata("design:type", core_types_1.CoreDate)
|
|
106
|
-
], Relationship.prototype, "
|
|
103
|
+
], Relationship.prototype, "lastMessageReceivedAt", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, ts_serval_1.validate)(),
|
|
106
|
+
(0, ts_serval_1.serialize)({ type: RelationshipAuditLogEntry_1.RelationshipAuditLogEntry }),
|
|
107
|
+
__metadata("design:type", Array)
|
|
108
|
+
], Relationship.prototype, "auditLog", void 0);
|
|
107
109
|
__decorate([
|
|
108
110
|
(0, ts_serval_1.validate)({ nullable: true }),
|
|
109
111
|
(0, ts_serval_1.serialize)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../../../src/modules/relationships/local/Relationship.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../../../src/modules/relationships/local/Relationship.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kDAA4F;AAC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AY;qDAAC;AAI9B;IAFN,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;8BACe,qBAAQ;uDAAC;AAI7B;IAFN,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;8BACmB,qBAAQ;2DAAC;AAIjC;IAFN,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,EAAC,EAAE,IAAI,EAAE,qDAAyB,EAAE,CAAC;;8CACF;AAItC;IAFN,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;;8CACU;AAIf;IAFN,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;8BACgB,qBAAQ;wDAAC;uBA9D5B,YAAY;IADxB,IAAA,gBAAI,EAAC,cAAc,CAAC;GACR,YAAY,CA0FxB"}
|
|
@@ -17,9 +17,6 @@ class DatawalletModificationMapper {
|
|
|
17
17
|
case "Delete":
|
|
18
18
|
type = DatawalletModification_1.DatawalletModificationType.Delete;
|
|
19
19
|
break;
|
|
20
|
-
case "CacheChanged":
|
|
21
|
-
type = DatawalletModification_1.DatawalletModificationType.CacheChanged;
|
|
22
|
-
break;
|
|
23
20
|
default:
|
|
24
21
|
throw new core_1.TransportError("Unsupported DatawalletModificationType '${backboneDatawalletModification.type}'");
|
|
25
22
|
}
|
|
@@ -28,6 +25,9 @@ class DatawalletModificationMapper {
|
|
|
28
25
|
case "TechnicalData":
|
|
29
26
|
payloadCategory = DatawalletModification_1.DatawalletModificationCategory.TechnicalData;
|
|
30
27
|
break;
|
|
28
|
+
case "Content":
|
|
29
|
+
payloadCategory = DatawalletModification_1.DatawalletModificationCategory.Content;
|
|
30
|
+
break;
|
|
31
31
|
case "Userdata":
|
|
32
32
|
payloadCategory = DatawalletModification_1.DatawalletModificationCategory.Userdata;
|
|
33
33
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatawalletModificationMapper.js","sourceRoot":"","sources":["../../../src/modules/sync/DatawalletModificationMapper.ts"],"names":[],"mappings":";;;AAAA,kDAA2C;AAC3C,qCAA0D;AAG1D,2EAAoI;AAEpI,MAAa,4BAA4B;IAC9B,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAClD,8BAA8D,EAC9D,gBAAoC,EACpC,iBAAyB;QAEzB,IAAI,IAAgC,CAAC;QAErC,QAAQ,8BAA8B,CAAC,IAAI,EAAE,CAAC;YAC1C,KAAK,QAAQ;gBACT,IAAI,GAAG,mDAA0B,CAAC,MAAM,CAAC;gBACzC,MAAM;YACV,KAAK,QAAQ;gBACT,IAAI,GAAG,mDAA0B,CAAC,MAAM,CAAC;gBACzC,MAAM;YACV,KAAK,QAAQ;gBACT,IAAI,GAAG,mDAA0B,CAAC,MAAM,CAAC;gBACzC,MAAM;YACV
|
|
1
|
+
{"version":3,"file":"DatawalletModificationMapper.js","sourceRoot":"","sources":["../../../src/modules/sync/DatawalletModificationMapper.ts"],"names":[],"mappings":";;;AAAA,kDAA2C;AAC3C,qCAA0D;AAG1D,2EAAoI;AAEpI,MAAa,4BAA4B;IAC9B,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAClD,8BAA8D,EAC9D,gBAAoC,EACpC,iBAAyB;QAEzB,IAAI,IAAgC,CAAC;QAErC,QAAQ,8BAA8B,CAAC,IAAI,EAAE,CAAC;YAC1C,KAAK,QAAQ;gBACT,IAAI,GAAG,mDAA0B,CAAC,MAAM,CAAC;gBACzC,MAAM;YACV,KAAK,QAAQ;gBACT,IAAI,GAAG,mDAA0B,CAAC,MAAM,CAAC;gBACzC,MAAM;YACV,KAAK,QAAQ;gBACT,IAAI,GAAG,mDAA0B,CAAC,MAAM,CAAC;gBACzC,MAAM;YACV;gBACI,MAAM,IAAI,qBAAc,CAAC,iFAAiF,C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,CAAC;SACnE,CAAC;IACN,CAAC;CACJ;AApED,oEAoEC"}
|
|
@@ -1,73 +1,15 @@
|
|
|
1
1
|
import { IDatabaseCollectionProvider } from "@js-soft/docdb-access-abstractions";
|
|
2
2
|
import { ILogger } from "@js-soft/logging-abstractions";
|
|
3
|
-
import { CoreId } from "@nmshd/core-types";
|
|
4
|
-
import { CachedIdentityDeletionProcess } from "../accounts/data/CachedIdentityDeletionProcess";
|
|
5
|
-
import { IdentityDeletionProcessController } from "../accounts/IdentityDeletionProcessController";
|
|
6
|
-
import { FileController } from "../files/FileController";
|
|
7
|
-
import { CachedFile } from "../files/local/CachedFile";
|
|
8
|
-
import { CachedMessage } from "../messages/local/CachedMessage";
|
|
9
|
-
import { MessageController } from "../messages/MessageController";
|
|
10
|
-
import { CachedRelationship } from "../relationships/local/CachedRelationship";
|
|
11
|
-
import { RelationshipsController } from "../relationships/RelationshipsController";
|
|
12
|
-
import { CachedRelationshipTemplate } from "../relationshipTemplates/local/CachedRelationshipTemplate";
|
|
13
|
-
import { RelationshipTemplateController } from "../relationshipTemplates/RelationshipTemplateController";
|
|
14
|
-
import { CachedToken } from "../tokens/local/CachedToken";
|
|
15
|
-
import { TokenController } from "../tokens/TokenController";
|
|
16
3
|
import { DatawalletModification } from "./local/DatawalletModification";
|
|
17
4
|
export declare class DatawalletModificationsProcessor {
|
|
18
|
-
private readonly
|
|
5
|
+
private readonly modifications;
|
|
19
6
|
private readonly collectionProvider;
|
|
20
7
|
private readonly logger;
|
|
21
|
-
private readonly modificationsWithoutCacheChanges;
|
|
22
|
-
private readonly cacheChanges;
|
|
23
8
|
private readonly deletedObjectIdentifiers;
|
|
24
9
|
private readonly _changedObjectIdentifiers;
|
|
25
10
|
get changedObjectIdentifiers(): string[];
|
|
26
11
|
get log(): ILogger;
|
|
27
|
-
constructor(modifications: DatawalletModification[],
|
|
28
|
-
private readonly collectionsWithCacheableItems;
|
|
12
|
+
constructor(modifications: DatawalletModification[], collectionProvider: IDatabaseCollectionProvider, logger: ILogger);
|
|
29
13
|
execute(): Promise<void>;
|
|
30
|
-
private applyModifications;
|
|
31
|
-
/**
|
|
32
|
-
* if a collection contains cacheable items, the cache has to be fetched after the item is created on a new device
|
|
33
|
-
* this can only happen after all creates are applied, because the fetching needs properties like the secret key
|
|
34
|
-
*/
|
|
35
|
-
private simulateCacheChangeForCreate;
|
|
36
|
-
private applyCacheChanges;
|
|
37
|
-
private ensureAllItemsAreCacheable;
|
|
38
|
-
private groupCacheChangesByCollection;
|
|
39
|
-
private saveNewCaches;
|
|
40
14
|
}
|
|
41
|
-
export declare class CacheFetcher {
|
|
42
|
-
private readonly fileController;
|
|
43
|
-
private readonly messageController;
|
|
44
|
-
private readonly relationshipTemplateController;
|
|
45
|
-
private readonly relationshipController;
|
|
46
|
-
private readonly tokenController;
|
|
47
|
-
private readonly identityDeletionProcessController;
|
|
48
|
-
constructor(fileController: FileController, messageController: MessageController, relationshipTemplateController: RelationshipTemplateController, relationshipController: RelationshipsController, tokenController: TokenController, identityDeletionProcessController: IdentityDeletionProcessController);
|
|
49
|
-
fetchCacheFor(input: FetchCacheInput): Promise<FetchCacheOutput>;
|
|
50
|
-
private fetchCaches;
|
|
51
|
-
}
|
|
52
|
-
interface FetchCacheInput {
|
|
53
|
-
files?: CoreId[];
|
|
54
|
-
messages?: CoreId[];
|
|
55
|
-
relationships?: CoreId[];
|
|
56
|
-
relationshipTemplates?: CoreId[];
|
|
57
|
-
tokens?: CoreId[];
|
|
58
|
-
identityDeletionProcesses?: CoreId[];
|
|
59
|
-
}
|
|
60
|
-
interface FetchCacheOutput {
|
|
61
|
-
files: FetchCacheOutputItem<CachedFile>[];
|
|
62
|
-
messages: FetchCacheOutputItem<CachedMessage>[];
|
|
63
|
-
relationships: FetchCacheOutputItem<CachedRelationship>[];
|
|
64
|
-
relationshipTemplates: FetchCacheOutputItem<CachedRelationshipTemplate>[];
|
|
65
|
-
tokens: FetchCacheOutputItem<CachedToken>[];
|
|
66
|
-
identityDeletionProcesses: FetchCacheOutputItem<CachedIdentityDeletionProcess>[];
|
|
67
|
-
}
|
|
68
|
-
interface FetchCacheOutputItem<TCache> {
|
|
69
|
-
id: CoreId;
|
|
70
|
-
cache: TCache;
|
|
71
|
-
}
|
|
72
|
-
export {};
|
|
73
15
|
//# sourceMappingURL=DatawalletModificationsProcessor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatawalletModificationsProcessor.d.ts","sourceRoot":"","sources":["../../../src/modules/sync/DatawalletModificationsProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"DatawalletModificationsProcessor.d.ts","sourceRoot":"","sources":["../../../src/modules/sync/DatawalletModificationsProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAIxD,OAAO,EAAE,sBAAsB,EAA8B,MAAM,gCAAgC,CAAC;AAEpG,qBAAa,gCAAgC;IAarC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAd3B,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAgB;IAEzD,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA0B;IACpE,IAAW,wBAAwB,IAAI,MAAM,EAAE,CAE9C;IAED,IAAW,GAAG,IAAI,OAAO,CAExB;gBAGoB,aAAa,EAAE,sBAAsB,EAAE,EACvC,kBAAkB,EAAE,2BAA2B,EAC/C,MAAM,EAAE,OAAO;IAGvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAqDxC"}
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
6
|
+
exports.DatawalletModificationsProcessor = void 0;
|
|
16
7
|
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
17
|
-
const ts_utils_1 = require("@js-soft/ts-utils");
|
|
18
|
-
const core_types_1 = require("@nmshd/core-types");
|
|
19
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
20
9
|
const core_1 = require("../../core");
|
|
21
|
-
const DbCollectionName_1 = require("../../core/DbCollectionName");
|
|
22
|
-
const IdentityDeletionProcess_1 = require("../accounts/data/IdentityDeletionProcess");
|
|
23
|
-
const File_1 = require("../files/local/File");
|
|
24
|
-
const Message_1 = require("../messages/local/Message");
|
|
25
|
-
const Relationship_1 = require("../relationships/local/Relationship");
|
|
26
|
-
const RelationshipTemplate_1 = require("../relationshipTemplates/local/RelationshipTemplate");
|
|
27
|
-
const Token_1 = require("../tokens/local/Token");
|
|
28
10
|
const DatawalletModification_1 = require("./local/DatawalletModification");
|
|
29
11
|
class DatawalletModificationsProcessor {
|
|
30
12
|
get changedObjectIdentifiers() {
|
|
@@ -33,29 +15,15 @@ class DatawalletModificationsProcessor {
|
|
|
33
15
|
get log() {
|
|
34
16
|
return this.logger;
|
|
35
17
|
}
|
|
36
|
-
constructor(modifications,
|
|
37
|
-
this.
|
|
18
|
+
constructor(modifications, collectionProvider, logger) {
|
|
19
|
+
this.modifications = modifications;
|
|
38
20
|
this.collectionProvider = collectionProvider;
|
|
39
21
|
this.logger = logger;
|
|
40
22
|
this.deletedObjectIdentifiers = [];
|
|
41
23
|
this._changedObjectIdentifiers = new Set();
|
|
42
|
-
this.collectionsWithCacheableItems = [
|
|
43
|
-
DbCollectionName_1.DbCollectionName.Files,
|
|
44
|
-
DbCollectionName_1.DbCollectionName.Messages,
|
|
45
|
-
DbCollectionName_1.DbCollectionName.Relationships,
|
|
46
|
-
DbCollectionName_1.DbCollectionName.RelationshipTemplates,
|
|
47
|
-
DbCollectionName_1.DbCollectionName.Tokens,
|
|
48
|
-
DbCollectionName_1.DbCollectionName.IdentityDeletionProcess
|
|
49
|
-
];
|
|
50
|
-
this.modificationsWithoutCacheChanges = modifications.filter((m) => m.type !== DatawalletModification_1.DatawalletModificationType.CacheChanged);
|
|
51
|
-
this.cacheChanges = modifications.filter((m) => m.type === DatawalletModification_1.DatawalletModificationType.CacheChanged);
|
|
52
24
|
}
|
|
53
25
|
async execute() {
|
|
54
|
-
|
|
55
|
-
await this.applyCacheChanges();
|
|
56
|
-
}
|
|
57
|
-
async applyModifications() {
|
|
58
|
-
const modificationsGroupedByObjectIdentifier = lodash_1.default.groupBy(this.modificationsWithoutCacheChanges, (m) => m.objectIdentifier);
|
|
26
|
+
const modificationsGroupedByObjectIdentifier = lodash_1.default.groupBy(this.modifications, (m) => m.objectIdentifier);
|
|
59
27
|
for (const objectIdentifier in modificationsGroupedByObjectIdentifier) {
|
|
60
28
|
this._changedObjectIdentifiers.add(objectIdentifier);
|
|
61
29
|
const currentModifications = modificationsGroupedByObjectIdentifier[objectIdentifier];
|
|
@@ -77,8 +45,8 @@ class DatawalletModificationsProcessor {
|
|
|
77
45
|
case DatawalletModification_1.DatawalletModificationType.Delete:
|
|
78
46
|
resultingObject = {};
|
|
79
47
|
break;
|
|
80
|
-
|
|
81
|
-
throw new core_1.TransportError(
|
|
48
|
+
default:
|
|
49
|
+
throw new core_1.TransportError(`${modification.type} modifications are not allowed in this context.`);
|
|
82
50
|
}
|
|
83
51
|
}
|
|
84
52
|
const oldDoc = await targetCollection.read(objectIdentifier);
|
|
@@ -89,129 +57,14 @@ class DatawalletModificationsProcessor {
|
|
|
89
57
|
...resultingObject
|
|
90
58
|
};
|
|
91
59
|
await targetCollection.update(oldDoc, newObject);
|
|
60
|
+
continue;
|
|
92
61
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
...resultingObject
|
|
98
|
-
});
|
|
99
|
-
}
|
|
62
|
+
await targetCollection.create({
|
|
63
|
+
id: objectIdentifier,
|
|
64
|
+
...resultingObject
|
|
65
|
+
});
|
|
100
66
|
}
|
|
101
67
|
}
|
|
102
|
-
/**
|
|
103
|
-
* if a collection contains cacheable items, the cache has to be fetched after the item is created on a new device
|
|
104
|
-
* this can only happen after all creates are applied, because the fetching needs properties like the secret key
|
|
105
|
-
*/
|
|
106
|
-
async simulateCacheChangeForCreate(targetCollectionName, objectIdentifier) {
|
|
107
|
-
if (!this.collectionsWithCacheableItems.includes(targetCollectionName))
|
|
108
|
-
return;
|
|
109
|
-
const modification = DatawalletModification_1.DatawalletModification.from({
|
|
110
|
-
localId: await core_1.TransportIds.datawalletModification.generate(),
|
|
111
|
-
type: DatawalletModification_1.DatawalletModificationType.CacheChanged,
|
|
112
|
-
collection: targetCollectionName,
|
|
113
|
-
objectIdentifier: core_types_1.CoreId.from(objectIdentifier)
|
|
114
|
-
});
|
|
115
|
-
this.cacheChanges.push(modification);
|
|
116
|
-
}
|
|
117
|
-
async applyCacheChanges() {
|
|
118
|
-
if (this.cacheChanges.length === 0) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
this.ensureAllItemsAreCacheable();
|
|
122
|
-
const cacheChangesWithoutDeletes = this.cacheChanges.filter((c) => !this.deletedObjectIdentifiers.some((d) => c.objectIdentifier.equals(d)));
|
|
123
|
-
for (const objectIdentifier of cacheChangesWithoutDeletes.map((c) => c.objectIdentifier.toString())) {
|
|
124
|
-
this._changedObjectIdentifiers.add(objectIdentifier);
|
|
125
|
-
}
|
|
126
|
-
const cacheChangesGroupedByCollection = this.groupCacheChangesByCollection(cacheChangesWithoutDeletes);
|
|
127
|
-
const caches = await this.cacheFetcher.fetchCacheFor({
|
|
128
|
-
files: cacheChangesGroupedByCollection.fileIds,
|
|
129
|
-
relationshipTemplates: cacheChangesGroupedByCollection.relationshipTemplateIds,
|
|
130
|
-
tokens: cacheChangesGroupedByCollection.tokenIds,
|
|
131
|
-
identityDeletionProcesses: cacheChangesGroupedByCollection.identityDeletionProcessIds
|
|
132
|
-
});
|
|
133
|
-
await this.saveNewCaches(caches.files, DbCollectionName_1.DbCollectionName.Files, File_1.File);
|
|
134
|
-
await this.saveNewCaches(caches.relationshipTemplates, DbCollectionName_1.DbCollectionName.RelationshipTemplates, RelationshipTemplate_1.RelationshipTemplate);
|
|
135
|
-
await this.saveNewCaches(caches.tokens, DbCollectionName_1.DbCollectionName.Tokens, Token_1.Token);
|
|
136
|
-
await this.saveNewCaches(caches.identityDeletionProcesses, DbCollectionName_1.DbCollectionName.IdentityDeletionProcess, IdentityDeletionProcess_1.IdentityDeletionProcess);
|
|
137
|
-
// Need to fetch the cache for relationships after the cache for relationship templates was fetched, because when building the relationship cache, the cache of thecorresponding relationship template is needed
|
|
138
|
-
const relationshipCaches = await this.cacheFetcher.fetchCacheFor({ relationships: cacheChangesGroupedByCollection.relationshipIds });
|
|
139
|
-
await this.saveNewCaches(relationshipCaches.relationships, DbCollectionName_1.DbCollectionName.Relationships, Relationship_1.Relationship);
|
|
140
|
-
// Need to fetch the cache for messages after the cache for relationships was fetched, because when building the message cache, the cache of thecorresponding relationship is needed
|
|
141
|
-
const messageCaches = await this.cacheFetcher.fetchCacheFor({ messages: cacheChangesGroupedByCollection.messageIds });
|
|
142
|
-
await this.saveNewCaches(messageCaches.messages, DbCollectionName_1.DbCollectionName.Messages, Message_1.Message);
|
|
143
|
-
}
|
|
144
|
-
ensureAllItemsAreCacheable() {
|
|
145
|
-
const collections = this.cacheChanges.map((c) => c.collection);
|
|
146
|
-
const uniqueCollections = [...new Set(collections)];
|
|
147
|
-
const collectionsWithUncacheableItems = uniqueCollections.filter((c) => !this.collectionsWithCacheableItems.includes(c));
|
|
148
|
-
if (collectionsWithUncacheableItems.length > 0) {
|
|
149
|
-
throw core_1.TransportCoreErrors.datawallet.unsupportedModification(`The following collections were received in CacheChanged datawallet modifications but are not supported by the current version of this library: '${collectionsWithUncacheableItems.join(", ")}'.`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
groupCacheChangesByCollection(cacheChanges) {
|
|
153
|
-
const groups = lodash_1.default.groupBy(cacheChanges, (c) => c.collection);
|
|
154
|
-
const fileIds = (groups[DbCollectionName_1.DbCollectionName.Files] ?? []).map((m) => m.objectIdentifier);
|
|
155
|
-
const messageIds = (groups[DbCollectionName_1.DbCollectionName.Messages] ?? []).map((m) => m.objectIdentifier);
|
|
156
|
-
const relationshipIds = (groups[DbCollectionName_1.DbCollectionName.Relationships] ?? []).map((m) => m.objectIdentifier);
|
|
157
|
-
const relationshipTemplateIds = (groups[DbCollectionName_1.DbCollectionName.RelationshipTemplates] ?? []).map((m) => m.objectIdentifier);
|
|
158
|
-
const tokenIds = (groups[DbCollectionName_1.DbCollectionName.Tokens] ?? []).map((m) => m.objectIdentifier);
|
|
159
|
-
const identityDeletionProcessIds = (groups[DbCollectionName_1.DbCollectionName.IdentityDeletionProcess] ?? []).map((m) => m.objectIdentifier);
|
|
160
|
-
return { fileIds, messageIds, relationshipTemplateIds, tokenIds, relationshipIds, identityDeletionProcessIds };
|
|
161
|
-
}
|
|
162
|
-
async saveNewCaches(caches, collectionName, constructorOfT) {
|
|
163
|
-
if (caches.length === 0)
|
|
164
|
-
return;
|
|
165
|
-
const collection = await this.collectionProvider.getCollection(collectionName);
|
|
166
|
-
await Promise.all(caches.map(async (c) => {
|
|
167
|
-
const itemDoc = await collection.read(c.id.toString());
|
|
168
|
-
const item = constructorOfT.from(itemDoc);
|
|
169
|
-
item.setCache(c.cache);
|
|
170
|
-
await collection.update(itemDoc, item);
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
68
|
}
|
|
174
69
|
exports.DatawalletModificationsProcessor = DatawalletModificationsProcessor;
|
|
175
|
-
__decorate([
|
|
176
|
-
(0, ts_utils_1.log)(),
|
|
177
|
-
__metadata("design:type", Function),
|
|
178
|
-
__metadata("design:paramtypes", []),
|
|
179
|
-
__metadata("design:returntype", void 0)
|
|
180
|
-
], DatawalletModificationsProcessor.prototype, "ensureAllItemsAreCacheable", null);
|
|
181
|
-
class CacheFetcher {
|
|
182
|
-
constructor(fileController, messageController, relationshipTemplateController, relationshipController, tokenController, identityDeletionProcessController) {
|
|
183
|
-
this.fileController = fileController;
|
|
184
|
-
this.messageController = messageController;
|
|
185
|
-
this.relationshipTemplateController = relationshipTemplateController;
|
|
186
|
-
this.relationshipController = relationshipController;
|
|
187
|
-
this.tokenController = tokenController;
|
|
188
|
-
this.identityDeletionProcessController = identityDeletionProcessController;
|
|
189
|
-
}
|
|
190
|
-
async fetchCacheFor(input) {
|
|
191
|
-
const caches = await Promise.all([
|
|
192
|
-
this.fetchCaches(this.fileController, input.files),
|
|
193
|
-
this.fetchCaches(this.messageController, input.messages),
|
|
194
|
-
this.fetchCaches(this.relationshipController, input.relationships),
|
|
195
|
-
this.fetchCaches(this.relationshipTemplateController, input.relationshipTemplates),
|
|
196
|
-
this.fetchCaches(this.tokenController, input.tokens),
|
|
197
|
-
this.fetchCaches(this.identityDeletionProcessController, input.identityDeletionProcesses)
|
|
198
|
-
]);
|
|
199
|
-
const output = {
|
|
200
|
-
files: caches[0],
|
|
201
|
-
messages: caches[1],
|
|
202
|
-
relationships: caches[2],
|
|
203
|
-
relationshipTemplates: caches[3],
|
|
204
|
-
tokens: caches[4],
|
|
205
|
-
identityDeletionProcesses: caches[5]
|
|
206
|
-
};
|
|
207
|
-
return output;
|
|
208
|
-
}
|
|
209
|
-
async fetchCaches(controller, ids) {
|
|
210
|
-
if (!ids)
|
|
211
|
-
return [];
|
|
212
|
-
const caches = await controller.fetchCaches(ids);
|
|
213
|
-
return caches;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
exports.CacheFetcher = CacheFetcher;
|
|
217
70
|
//# sourceMappingURL=DatawalletModificationsProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatawalletModificationsProcessor.js","sourceRoot":"","sources":["../../../src/modules/sync/DatawalletModificationsProcessor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatawalletModificationsProcessor.js","sourceRoot":"","sources":["../../../src/modules/sync/DatawalletModificationsProcessor.ts"],"names":[],"mappings":";;;;;;AAEA,kDAAkD;AAClD,oDAAuB;AACvB,qCAA4C;AAC5C,2EAAoG;AAEpG,MAAa,gCAAgC;IAIzC,IAAW,wBAAwB;QAC/B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,YACqB,aAAuC,EACvC,kBAA+C,EAC/C,MAAe;QAFf,kBAAa,GAAb,aAAa,CAA0B;QACvC,uBAAkB,GAAlB,kBAAkB,CAA6B;QAC/C,WAAM,GAAN,MAAM,CAAS;QAdnB,6BAAwB,GAAa,EAAE,CAAC;QAExC,8BAAyB,GAAgB,IAAI,GAAG,EAAE,CAAC;IAajE,CAAC;IAEG,KAAK,CAAC,OAAO;QAChB,MAAM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,iDAAiD,CAAC,CAAC;gBACxG,CAAC;YACL,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC7D,IAAI,MAAM,EAAE,CAAC;gBACT,MAAM,SAAS,GAAG,wBAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAEnD,MAAM,SAAS,GAAG;oBACd,GAAG,SAAS,CAAC,MAAM,EAAE;oBACrB,GAAG,eAAe;iBACrB,CAAC;gBAEF,MAAM,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBACjD,SAAS;YACb,CAAC;YAED,MAAM,gBAAgB,CAAC,MAAM,CAAC;gBAC1B,EAAE,EAAE,gBAAgB;gBACpB,GAAG,eAAe;aACrB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ;AAvED,4EAuEC"}
|
|
@@ -13,8 +13,6 @@ export declare class SyncController extends TransportController {
|
|
|
13
13
|
private readonly deviceMigrations;
|
|
14
14
|
private readonly identityMigrations;
|
|
15
15
|
private readonly externalEventRegistry;
|
|
16
|
-
private _cacheFetcher?;
|
|
17
|
-
private get cacheFetcher();
|
|
18
16
|
constructor(parent: AccountController, dependencyOverrides: DependencyOverrides, unpushedDatawalletModifications: IDatabaseCollection, datawalletEnabled: boolean);
|
|
19
17
|
init(): Promise<SyncController>;
|
|
20
18
|
private currentSync?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncController.d.ts","sourceRoot":"","sources":["../../../src/modules/sync/SyncController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAgB,MAAM,oCAAoC,CAAC;AAEvF,OAAO,EAAE,QAAQ,EAAqB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAgC,mBAAmB,EAA+D,MAAM,YAAY,CAAC;AAC5I,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,iBAAiB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OAAO,CAAC,YAAY,CAAC;YAsBjE,wBAAwB;YAmBxB,KAAK;YAYL,kBAAkB;YAmBlB,cAAc;YAiCd,sBAAsB;YAgBtB,gCAAgC;YA4BhC,8BAA8B;YAyB9B,oCAAoC;YAyBpC,8BAA8B;YAK9B,6BAA6B;YAW7B,gCAAgC;YAgBhC,0CAA0C;YAsB1C,qCAAqC;IAMtC,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAK3D,4BAA4B;YAK5B,0BAA0B;YAW1B,oCAAoC;YAOpC,2BAA2B;YAiC3B,6BAA6B;YAwB7B,uCAAuC;YAuBvC,mCAAmC;YAKnC,sCAAsC;YAItC,iBAAiB;YAMjB,iBAAiB;IAKlB,wBAAwB,IAAI,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAIzD,kCAAkC,IAAI,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;YAIlE,wBAAwB;YAIxB,kCAAkC;IAIhD,OAAO,CAAC,4BAA4B;CAGvC"}
|
|
@@ -25,12 +25,6 @@ const DatawalletModification_1 = require("./local/DatawalletModification");
|
|
|
25
25
|
const DeviceMigrations_1 = require("./migrations/DeviceMigrations");
|
|
26
26
|
const IdentityMigrations_1 = require("./migrations/IdentityMigrations");
|
|
27
27
|
class SyncController extends core_1.TransportController {
|
|
28
|
-
get cacheFetcher() {
|
|
29
|
-
if (!this._cacheFetcher) {
|
|
30
|
-
this._cacheFetcher = new DatawalletModificationsProcessor_1.CacheFetcher(this.parent.files, this.parent.messages, this.parent.relationshipTemplates, this.parent.relationships, this.parent.tokens, this.parent.identityDeletionProcess);
|
|
31
|
-
}
|
|
32
|
-
return this._cacheFetcher;
|
|
33
|
-
}
|
|
34
28
|
constructor(parent, dependencyOverrides, unpushedDatawalletModifications, datawalletEnabled) {
|
|
35
29
|
super(core_1.ControllerName.Sync, parent);
|
|
36
30
|
this.unpushedDatawalletModifications = unpushedDatawalletModifications;
|
|
@@ -185,7 +179,7 @@ class SyncController extends core_1.TransportController {
|
|
|
185
179
|
return [];
|
|
186
180
|
const incomingModifications = await this.decryptDatawalletModifications(encryptedIncomingModifications);
|
|
187
181
|
this.log.trace(`${incomingModifications.length} incoming modifications found`);
|
|
188
|
-
const datawalletModificationsProcessor = new DatawalletModificationsProcessor_1.DatawalletModificationsProcessor(incomingModifications, this.
|
|
182
|
+
const datawalletModificationsProcessor = new DatawalletModificationsProcessor_1.DatawalletModificationsProcessor(incomingModifications, this.db, core_1.TransportLoggerFactory.getLogger(DatawalletModificationsProcessor_1.DatawalletModificationsProcessor));
|
|
189
183
|
await datawalletModificationsProcessor.execute();
|
|
190
184
|
this.log.trace(`${incomingModifications.length} incoming modifications executed`, incomingModifications);
|
|
191
185
|
await this.updateLocalDatawalletModificationIndex(encryptedIncomingModifications.sort(descending)[0].index);
|
|
@@ -295,7 +289,7 @@ class SyncController extends core_1.TransportController {
|
|
|
295
289
|
throw response.error;
|
|
296
290
|
await this.deleteUnpushedDatawalletModifications(localModificationIds);
|
|
297
291
|
const oldDatawalletModificationIndex = await this.getLocalDatawalletModificationIndex();
|
|
298
|
-
const newDatawalletModificationIndex = (oldDatawalletModificationIndex
|
|
292
|
+
const newDatawalletModificationIndex = (oldDatawalletModificationIndex ?? -1) + backboneModifications.length;
|
|
299
293
|
await this.updateLocalDatawalletModificationIndex(newDatawalletModificationIndex);
|
|
300
294
|
this.currentSyncRun = undefined;
|
|
301
295
|
return { newUnsyncedExternalEventsExist: response.value.newUnsyncedExternalEventsExist };
|
|
@@ -313,7 +307,7 @@ class SyncController extends core_1.TransportController {
|
|
|
313
307
|
throw response.error;
|
|
314
308
|
await this.deleteUnpushedDatawalletModifications(localModificationIds);
|
|
315
309
|
const oldDatawalletModificationIndex = await this.getLocalDatawalletModificationIndex();
|
|
316
|
-
const newDatawalletModificationIndex = (oldDatawalletModificationIndex
|
|
310
|
+
const newDatawalletModificationIndex = (oldDatawalletModificationIndex ?? -1) + backboneModifications.length;
|
|
317
311
|
await this.updateLocalDatawalletModificationIndex(newDatawalletModificationIndex);
|
|
318
312
|
this.currentSyncRun = undefined;
|
|
319
313
|
}
|