Skip to content

Commit

Permalink
feat: Added PartyOriginEnum to PartyType, wrote migrations and update…
Browse files Browse the repository at this point in the history
…d tests and updated the contact manager plugin
  • Loading branch information
zoemaas committed Mar 20, 2024
1 parent 717edc9 commit 07d8c1f
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TAgent } from '@veramo/core'
import {TAgent} from '@veramo/core'
import {
CorrelationIdentifierEnum,
ElectronicAddress,
Expand All @@ -10,11 +10,12 @@ import {
NonPersistedIdentity,
NonPersistedPhysicalAddress,
Party,
PartyOriginEnum,
PartyRelationship,
PartyTypeEnum,
PhysicalAddress,
} from '../../../data-store/src'
import { AddContactArgs, IContactManager } from '../../src'
import {AddContactArgs, IContactManager} from '../../src'

type ConfiguredAgent = TAgent<IContactManager>

Expand All @@ -35,6 +36,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'default_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.EXTERNAL,
tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
name: 'example_name',
},
Expand Down Expand Up @@ -142,6 +144,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'new_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
name: 'new_name',
description: 'new_description',
Expand Down Expand Up @@ -170,6 +173,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
const result: Party = await agent.cmAddContact(contact)

expect(result.partyType.type).toEqual(contact.contactType.type)
expect(result.partyType.origin).toEqual(contact.contactType.origin)
expect(result.partyType.name).toEqual(contact.contactType.name)
expect(result.partyType.description).toEqual(contact.contactType.description)
expect((<NaturalPerson>result.contact).firstName).toEqual(contact.firstName)
Expand Down Expand Up @@ -317,6 +321,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'relation_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d285',
name: 'relation_contact_type_name',
description: 'new_description',
Expand Down Expand Up @@ -361,6 +366,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'remove_relation_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.EXTERNAL,
tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d286',
name: 'remove_relation_contact_type_name',
description: 'new_description',
Expand Down Expand Up @@ -410,6 +416,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'add_electronic_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: 'a85a8aa0-fdeb-4c00-b22e-60423f52a873',
name: 'add_electronic_address_name',
description: 'add_electronic_address_description',
Expand Down Expand Up @@ -438,6 +445,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'get_electronic_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.EXTERNAL,
tenantId: 'f2947075-53eb-4176-b155-ab4b18715288',
name: 'get_electronic_address_name',
description: 'get_electronic_address_description',
Expand Down Expand Up @@ -465,6 +473,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'get_all_electronic_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: '5c0157ec-4678-4273-8f53-413bc6435134',
name: 'get_all_electronic_address_name',
description: 'get_all_electronic_address_description',
Expand Down Expand Up @@ -493,6 +502,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'update_electronic_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.EXTERNAL,
tenantId: '6b64c3dd-cf40-4919-b8b8-2ec3c510c5b7',
name: 'update_electronic_address_name',
description: 'update_electronic_address_description',
Expand Down Expand Up @@ -528,6 +538,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'remove_electronic_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.EXTERNAL,
tenantId: '41b45c65-971e-4c26-8115-cb8bc7c67cf3',
name: 'remove_electronic_address_name',
description: 'remove_electronic_address_description',
Expand Down Expand Up @@ -561,6 +572,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'add_physical_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: '5aeb828e-16d6-4244-95a7-e12424474eb7',
name: 'add_physical_address_name',
description: 'add_physical_address_description',
Expand Down Expand Up @@ -595,6 +607,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'get_physical_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.EXTERNAL,
tenantId: '7c5dbbd9-1721-4246-b261-44e237560a15',
name: 'get_physical_address_name',
description: 'get_physical_address_description',
Expand Down Expand Up @@ -628,6 +641,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'get_all_physical_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: '0c0eafd8-1e8c-44bf-8e0d-768fb11a40c3',
name: 'get_all_physical_address_name',
description: 'get_all_physical_address_description',
Expand Down Expand Up @@ -662,6 +676,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'update_physical_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: 'f2b4eb1c-e36f-4863-90b3-90720471c397',
name: 'update_physical_address_name',
description: 'update_physical_address_description',
Expand Down Expand Up @@ -715,6 +730,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
displayName: 'remove_physical_address_display_name',
contactType: {
type: PartyTypeEnum.NATURAL_PERSON,
origin: PartyOriginEnum.INTERNAL,
tenantId: '20b11d1e-6489-4258-af33-32a2cfa4dc85',
name: 'remove_physical_address_name',
description: 'remove_physical_address_description',
Expand Down
2 changes: 2 additions & 0 deletions packages/contact-manager/src/types/IContactManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
NonPersistedPartyType as NonPersistedContactType,
NonPersistedPhysicalAddress,
Party as Contact,
PartyOriginEnum,
PartyRelationship as ContactRelationship,
PartyType as ContactType,
PartyTypeEnum as ContactTypeEnum,
Expand Down Expand Up @@ -119,6 +120,7 @@ export type UpdateRelationshipArgs = {

export type AddContactTypeArgs = {
type: ContactTypeEnum
origin: PartyOriginEnum
name: string
tenantId: string
description?: string
Expand Down
Loading

0 comments on commit 07d8c1f

Please sign in to comment.