From 9388f5acdda52738426157995c78851b684dd229 Mon Sep 17 00:00:00 2001 From: Mike Richardson Date: Tue, 31 May 2022 08:41:31 +0300 Subject: [PATCH 1/6] Set credentials array to [] by default in CredentialExchangeRecord Signed-off-by: Mike Richardson --- .../credentials/repository/CredentialExchangeRecord.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts b/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts index 945acca05b..98116f018f 100644 --- a/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts +++ b/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts @@ -61,7 +61,7 @@ export class CredentialExchangeRecord extends BaseRecord< public revocationNotification?: RevocationNotification public errorMessage?: string public protocolVersion!: CredentialProtocolVersion - public credentials!: CredentialRecordBinding[] + public credentials: CredentialRecordBinding[] = [] // default in case constructor not used (as in tests) @Type(() => CredentialPreviewAttribute) public credentialAttributes?: CredentialPreviewAttribute[] @@ -75,7 +75,6 @@ export class CredentialExchangeRecord extends BaseRecord< public constructor(props: CredentialExchangeRecordProps) { super() - if (props) { this.id = props.id ?? uuid() this.createdAt = props.createdAt ?? new Date() @@ -96,10 +95,8 @@ export class CredentialExchangeRecord extends BaseRecord< public getTags() { const metadata = this.metadata.get(CredentialMetadataKeys.IndyCredential) - let ids: string[] = [] - if (this.credentials) { - ids = this.credentials.map((c) => c.credentialRecordId) - } + const ids = this.credentials.map((c) => c.credentialRecordId) + return { ...this._tags, threadId: this.threadId, From 6d62c6ab9dbb1d4763794192941fd4ae93a4aa0e Mon Sep 17 00:00:00 2001 From: Mike Richardson Date: Tue, 31 May 2022 08:42:00 +0300 Subject: [PATCH 2/6] Set credentials array to [] by default in CredentialExchangeRecord Signed-off-by: Mike Richardson --- .../modules/credentials/repository/CredentialExchangeRecord.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts b/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts index 98116f018f..ebdff33d52 100644 --- a/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts +++ b/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts @@ -61,7 +61,7 @@ export class CredentialExchangeRecord extends BaseRecord< public revocationNotification?: RevocationNotification public errorMessage?: string public protocolVersion!: CredentialProtocolVersion - public credentials: CredentialRecordBinding[] = [] // default in case constructor not used (as in tests) + public credentials: CredentialRecordBinding[] = [] // default in case constructor not used (as can happen in tests) @Type(() => CredentialPreviewAttribute) public credentialAttributes?: CredentialPreviewAttribute[] From a2f00411ffab557a4c526907bd501580d952d408 Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Tue, 31 May 2022 08:52:35 +0200 Subject: [PATCH 3/6] Update packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts Signed-off-by: Timo Glastra --- .../modules/credentials/repository/CredentialExchangeRecord.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts b/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts index ebdff33d52..eacf1b5404 100644 --- a/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts +++ b/packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts @@ -61,7 +61,7 @@ export class CredentialExchangeRecord extends BaseRecord< public revocationNotification?: RevocationNotification public errorMessage?: string public protocolVersion!: CredentialProtocolVersion - public credentials: CredentialRecordBinding[] = [] // default in case constructor not used (as can happen in tests) + public credentials: CredentialRecordBinding[] = [] @Type(() => CredentialPreviewAttribute) public credentialAttributes?: CredentialPreviewAttribute[] From a0cc5c7207061c75d95c0f2bdd087c0566b90df7 Mon Sep 17 00:00:00 2001 From: Mike Richardson Date: Tue, 31 May 2022 10:53:30 +0300 Subject: [PATCH 4/6] update snapshots Signed-off-by: Mike Richardson --- .../migration/__tests__/__snapshots__/backup.test.ts.snap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/src/storage/migration/__tests__/__snapshots__/backup.test.ts.snap b/packages/core/src/storage/migration/__tests__/__snapshots__/backup.test.ts.snap index d99afc4e98..6d4a5fc81c 100644 --- a/packages/core/src/storage/migration/__tests__/__snapshots__/backup.test.ts.snap +++ b/packages/core/src/storage/migration/__tests__/__snapshots__/backup.test.ts.snap @@ -45,6 +45,7 @@ Array [ "thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae", }, }, + "credentials": Array [], "id": "574b2a37-1db1-4af1-a3bf-35c6cb9e1d7a", "metadata": Object { "_internal/indyCredential": Object { @@ -149,6 +150,7 @@ Array [ "thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae", }, }, + "credentials": Array [], "id": "5f2b7bc7-edfd-47e7-a1d4-aae050df2c4a", "metadata": Object { "_internal/indyCredential": Object { @@ -259,6 +261,7 @@ Array [ "thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb", }, }, + "credentials": Array [], "id": "ad644d8a-48a2-4c55-b46d-7a7f1a9278c7", "metadata": Object { "_internal/indyCredential": Object { @@ -363,6 +366,7 @@ Array [ "thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb", }, }, + "credentials": Array [], "id": "c7e0a752-7f1c-41c0-b0ae-a68c2d97ca8c", "metadata": Object { "_internal/indyCredential": Object { From 6a1d5eb287205e02431c8fd7d01a6b06bc6e73e4 Mon Sep 17 00:00:00 2001 From: Mike Richardson Date: Tue, 31 May 2022 11:17:58 +0300 Subject: [PATCH 5/6] fix snapshot tests Signed-off-by: Mike Richardson --- .../__tests__/__snapshots__/0.1.test.ts.snap | 440 ------------------ 1 file changed, 440 deletions(-) diff --git a/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap b/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap index ae70e251a2..8b42862d7a 100644 --- a/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap +++ b/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap @@ -2488,443 +2488,3 @@ Object { }, } `; - -exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: allMediator 1`] = ` -Object { - "0b47db94-c0fa-4476-87cf-a5f664440412": Object { - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "tags": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "createdAt": "2022-03-21T22:50:17.157Z", - "endpoint": "rxjs:alice", - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "tags": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "createdAt": "2022-03-21T22:50:17.126Z", - "endpoint": "rxjs:alice", - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, - "802ef124-36b7-490f-b152-e9d090ddf073": Object { - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "tags": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "createdAt": "2022-03-21T22:50:17.161Z", - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "STORAGE_VERSION_RECORD_ID": Object { - "id": "STORAGE_VERSION_RECORD_ID", - "tags": Object {}, - "type": "StorageVersionRecord", - "value": Object { - "createdAt": "2022-01-21T22:50:20.522Z", - "id": "STORAGE_VERSION_RECORD_ID", - "metadata": Object {}, - "storageVersion": "0.2", - }, - }, - "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "tags": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "createdAt": "2022-03-21T22:50:17.132Z", - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, -} -`; - -exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: allRecipient 1`] = ` -Object { - "0b47db94-c0fa-4476-87cf-a5f664440412": Object { - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "tags": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "recipientKeys": Array [], - "role": "RECIPIENT", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "createdAt": "2022-03-21T22:50:17.157Z", - "endpoint": "rxjs:alice", - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "RECIPIENT", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "tags": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "recipientKeys": Array [], - "role": "RECIPIENT", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "createdAt": "2022-03-21T22:50:17.126Z", - "endpoint": "rxjs:alice", - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "RECIPIENT", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, - "802ef124-36b7-490f-b152-e9d090ddf073": Object { - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "tags": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "recipientKeys": Array [], - "role": "RECIPIENT", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "createdAt": "2022-03-21T22:50:17.161Z", - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "RECIPIENT", - "routingKeys": Array [], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "STORAGE_VERSION_RECORD_ID": Object { - "id": "STORAGE_VERSION_RECORD_ID", - "tags": Object {}, - "type": "StorageVersionRecord", - "value": Object { - "createdAt": "2022-01-21T22:50:20.522Z", - "id": "STORAGE_VERSION_RECORD_ID", - "metadata": Object {}, - "storageVersion": "0.2", - }, - }, - "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "tags": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "recipientKeys": Array [], - "role": "RECIPIENT", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "createdAt": "2022-03-21T22:50:17.132Z", - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "RECIPIENT", - "routingKeys": Array [], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, -} -`; - -exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: doNotChange 1`] = ` -Object { - "0b47db94-c0fa-4476-87cf-a5f664440412": Object { - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "tags": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "createdAt": "2022-03-21T22:50:17.157Z", - "endpoint": "rxjs:alice", - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "tags": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "createdAt": "2022-03-21T22:50:17.126Z", - "endpoint": "rxjs:alice", - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, - "802ef124-36b7-490f-b152-e9d090ddf073": Object { - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "tags": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "createdAt": "2022-03-21T22:50:17.161Z", - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "STORAGE_VERSION_RECORD_ID": Object { - "id": "STORAGE_VERSION_RECORD_ID", - "tags": Object {}, - "type": "StorageVersionRecord", - "value": Object { - "createdAt": "2022-01-21T22:50:20.522Z", - "id": "STORAGE_VERSION_RECORD_ID", - "metadata": Object {}, - "storageVersion": "0.2", - }, - }, - "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "tags": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "createdAt": "2022-03-21T22:50:17.132Z", - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, -} -`; - -exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: recipientIfEndpoint 1`] = ` -Object { - "0b47db94-c0fa-4476-87cf-a5f664440412": Object { - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "tags": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "recipientKeys": Array [], - "role": "RECIPIENT", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", - "createdAt": "2022-03-21T22:50:17.157Z", - "endpoint": "rxjs:alice", - "id": "0b47db94-c0fa-4476-87cf-a5f664440412", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "RECIPIENT", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "tags": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "recipientKeys": Array [], - "role": "RECIPIENT", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "85a78484-105d-4844-8c01-9f9877362708", - "createdAt": "2022-03-21T22:50:17.126Z", - "endpoint": "rxjs:alice", - "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "RECIPIENT", - "routingKeys": Array [ - "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", - ], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, - "802ef124-36b7-490f-b152-e9d090ddf073": Object { - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "tags": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", - "createdAt": "2022-03-21T22:50:17.161Z", - "id": "802ef124-36b7-490f-b152-e9d090ddf073", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [], - "state": "granted", - "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", - }, - }, - "STORAGE_VERSION_RECORD_ID": Object { - "id": "STORAGE_VERSION_RECORD_ID", - "tags": Object {}, - "type": "StorageVersionRecord", - "value": Object { - "createdAt": "2022-01-21T22:50:20.522Z", - "id": "STORAGE_VERSION_RECORD_ID", - "metadata": Object {}, - "storageVersion": "0.2", - }, - }, - "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "tags": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "recipientKeys": Array [], - "role": "MEDIATOR", - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - "type": "MediationRecord", - "value": Object { - "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", - "createdAt": "2022-03-21T22:50:17.132Z", - "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", - "metadata": Object {}, - "recipientKeys": Array [], - "role": "MEDIATOR", - "routingKeys": Array [], - "state": "granted", - "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", - }, - }, -} -`; From 275c1fc9c07552745dc3a5c27af911a2690ce81c Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Tue, 31 May 2022 12:19:29 +0200 Subject: [PATCH 6/6] test: update snapshots Signed-off-by: Timo Glastra --- .../__tests__/__snapshots__/0.1.test.ts.snap | 448 ++++++++++++++++++ 1 file changed, 448 insertions(+) diff --git a/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap b/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap index 8b42862d7a..3d39272590 100644 --- a/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap +++ b/packages/core/src/storage/migration/__tests__/__snapshots__/0.1.test.ts.snap @@ -1596,6 +1596,7 @@ Object { "thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae", }, }, + "credentials": Array [], "id": "574b2a37-1db1-4af1-a3bf-35c6cb9e1d7a", "metadata": Object { "_internal/indyCredential": Object { @@ -1707,6 +1708,7 @@ Object { "thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae", }, }, + "credentials": Array [], "id": "5f2b7bc7-edfd-47e7-a1d4-aae050df2c4a", "metadata": Object { "_internal/indyCredential": Object { @@ -1835,6 +1837,7 @@ Object { "thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb", }, }, + "credentials": Array [], "id": "ad644d8a-48a2-4c55-b46d-7a7f1a9278c7", "metadata": Object { "_internal/indyCredential": Object { @@ -1946,6 +1949,7 @@ Object { "thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb", }, }, + "credentials": Array [], "id": "c7e0a752-7f1c-41c0-b0ae-a68c2d97ca8c", "metadata": Object { "_internal/indyCredential": Object { @@ -2068,6 +2072,7 @@ Object { "thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae", }, }, + "credentials": Array [], "id": "574b2a37-1db1-4af1-a3bf-35c6cb9e1d7a", "metadata": Object { "_internal/indyCredential": Object { @@ -2179,6 +2184,7 @@ Object { "thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae", }, }, + "credentials": Array [], "id": "5f2b7bc7-edfd-47e7-a1d4-aae050df2c4a", "metadata": Object { "_internal/indyCredential": Object { @@ -2307,6 +2313,7 @@ Object { "thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb", }, }, + "credentials": Array [], "id": "ad644d8a-48a2-4c55-b46d-7a7f1a9278c7", "metadata": Object { "_internal/indyCredential": Object { @@ -2418,6 +2425,7 @@ Object { "thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb", }, }, + "credentials": Array [], "id": "c7e0a752-7f1c-41c0-b0ae-a68c2d97ca8c", "metadata": Object { "_internal/indyCredential": Object { @@ -2488,3 +2496,443 @@ Object { }, } `; + +exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: allMediator 1`] = ` +Object { + "0b47db94-c0fa-4476-87cf-a5f664440412": Object { + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "tags": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "createdAt": "2022-03-21T22:50:17.157Z", + "endpoint": "rxjs:alice", + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "tags": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "createdAt": "2022-03-21T22:50:17.126Z", + "endpoint": "rxjs:alice", + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, + "802ef124-36b7-490f-b152-e9d090ddf073": Object { + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "tags": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "createdAt": "2022-03-21T22:50:17.161Z", + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "STORAGE_VERSION_RECORD_ID": Object { + "id": "STORAGE_VERSION_RECORD_ID", + "tags": Object {}, + "type": "StorageVersionRecord", + "value": Object { + "createdAt": "2022-01-21T22:50:20.522Z", + "id": "STORAGE_VERSION_RECORD_ID", + "metadata": Object {}, + "storageVersion": "0.2", + }, + }, + "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "tags": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "createdAt": "2022-03-21T22:50:17.132Z", + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, +} +`; + +exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: allRecipient 1`] = ` +Object { + "0b47db94-c0fa-4476-87cf-a5f664440412": Object { + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "tags": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "recipientKeys": Array [], + "role": "RECIPIENT", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "createdAt": "2022-03-21T22:50:17.157Z", + "endpoint": "rxjs:alice", + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "RECIPIENT", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "tags": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "recipientKeys": Array [], + "role": "RECIPIENT", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "createdAt": "2022-03-21T22:50:17.126Z", + "endpoint": "rxjs:alice", + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "RECIPIENT", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, + "802ef124-36b7-490f-b152-e9d090ddf073": Object { + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "tags": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "recipientKeys": Array [], + "role": "RECIPIENT", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "createdAt": "2022-03-21T22:50:17.161Z", + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "RECIPIENT", + "routingKeys": Array [], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "STORAGE_VERSION_RECORD_ID": Object { + "id": "STORAGE_VERSION_RECORD_ID", + "tags": Object {}, + "type": "StorageVersionRecord", + "value": Object { + "createdAt": "2022-01-21T22:50:20.522Z", + "id": "STORAGE_VERSION_RECORD_ID", + "metadata": Object {}, + "storageVersion": "0.2", + }, + }, + "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "tags": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "recipientKeys": Array [], + "role": "RECIPIENT", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "createdAt": "2022-03-21T22:50:17.132Z", + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "RECIPIENT", + "routingKeys": Array [], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, +} +`; + +exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: doNotChange 1`] = ` +Object { + "0b47db94-c0fa-4476-87cf-a5f664440412": Object { + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "tags": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "createdAt": "2022-03-21T22:50:17.157Z", + "endpoint": "rxjs:alice", + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "tags": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "createdAt": "2022-03-21T22:50:17.126Z", + "endpoint": "rxjs:alice", + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, + "802ef124-36b7-490f-b152-e9d090ddf073": Object { + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "tags": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "createdAt": "2022-03-21T22:50:17.161Z", + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "STORAGE_VERSION_RECORD_ID": Object { + "id": "STORAGE_VERSION_RECORD_ID", + "tags": Object {}, + "type": "StorageVersionRecord", + "value": Object { + "createdAt": "2022-01-21T22:50:20.522Z", + "id": "STORAGE_VERSION_RECORD_ID", + "metadata": Object {}, + "storageVersion": "0.2", + }, + }, + "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "tags": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "createdAt": "2022-03-21T22:50:17.132Z", + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, +} +`; + +exports[`UpdateAssistant | v0.1 - v0.2 should correctly update the role in the mediation record: recipientIfEndpoint 1`] = ` +Object { + "0b47db94-c0fa-4476-87cf-a5f664440412": Object { + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "tags": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "recipientKeys": Array [], + "role": "RECIPIENT", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "88e2093e-97b9-4665-aff0-ffdcb4afee60", + "createdAt": "2022-03-21T22:50:17.157Z", + "endpoint": "rxjs:alice", + "id": "0b47db94-c0fa-4476-87cf-a5f664440412", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "RECIPIENT", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "7f14c1ec-514c-49b2-a00b-04af7e600060": Object { + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "tags": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "recipientKeys": Array [], + "role": "RECIPIENT", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "85a78484-105d-4844-8c01-9f9877362708", + "createdAt": "2022-03-21T22:50:17.126Z", + "endpoint": "rxjs:alice", + "id": "7f14c1ec-514c-49b2-a00b-04af7e600060", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "RECIPIENT", + "routingKeys": Array [ + "D86mPByntjjYMuoaVwxotLY8RMwyRSkRkUL3XPrpwcDu", + ], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, + "802ef124-36b7-490f-b152-e9d090ddf073": Object { + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "tags": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "ca5b148a-250f-46b0-8537-ae88014d8bd7", + "createdAt": "2022-03-21T22:50:17.161Z", + "id": "802ef124-36b7-490f-b152-e9d090ddf073", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [], + "state": "granted", + "threadId": "e9aeea8f-2c7a-4fd0-9353-f8b5b76094e7", + }, + }, + "STORAGE_VERSION_RECORD_ID": Object { + "id": "STORAGE_VERSION_RECORD_ID", + "tags": Object {}, + "type": "StorageVersionRecord", + "value": Object { + "createdAt": "2022-01-21T22:50:20.522Z", + "id": "STORAGE_VERSION_RECORD_ID", + "metadata": Object {}, + "storageVersion": "0.2", + }, + }, + "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd": Object { + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "tags": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "recipientKeys": Array [], + "role": "MEDIATOR", + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + "type": "MediationRecord", + "value": Object { + "connectionId": "dbb3367e-55aa-4c03-b10a-d1fc34392bea", + "createdAt": "2022-03-21T22:50:17.132Z", + "id": "a29b39fb-f030-41ac-b6e1-ed7f3f6a05cd", + "metadata": Object {}, + "recipientKeys": Array [], + "role": "MEDIATOR", + "routingKeys": Array [], + "state": "granted", + "threadId": "a401880b-8129-4ed9-bcaa-57d0e38026cd", + }, + }, +} +`;