diff --git a/packages/contact-manager/__tests__/shared/contactManagerAgentLogic.ts b/packages/contact-manager/__tests__/shared/contactManagerAgentLogic.ts index 9a34799ff..ea4779561 100644 --- a/packages/contact-manager/__tests__/shared/contactManagerAgentLogic.ts +++ b/packages/contact-manager/__tests__/shared/contactManagerAgentLogic.ts @@ -1,10 +1,10 @@ import { TAgent } from '@veramo/core' import { - CorrelationIdentifierEnum, + CorrelationIdentifierType, ElectronicAddress, GetPartiesArgs, Identity, - IdentityRoleEnum, + IdentityRoleType, NaturalPerson, NonPersistedElectronicAddress, NonPersistedIdentity, @@ -12,7 +12,7 @@ import { Party, PartyOrigin, PartyRelationship, - PartyTypeEnum, + PartyTypeType, PhysicalAddress, } from '../../../data-store/src' import { AddContactArgs, IContactManager } from '../../src' @@ -35,8 +35,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'default_last_name', displayName: 'default_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -45,9 +45,9 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro const correlationId = 'default_example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -80,7 +80,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro filter: [ { partyType: { - type: PartyTypeEnum.NATURAL_PERSON, + type: PartyTypeType.NATURAL_PERSON, }, }, { @@ -143,8 +143,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'new_last_name', displayName: 'new_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'new_name', description: 'new_description', @@ -241,9 +241,9 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro const correlationId = 'new_example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -265,9 +265,9 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro const correlationId = 'missing_connection_add_example' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId, }, } @@ -281,14 +281,14 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro const correlationId = 'missing_connection_update_example' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } const result: Identity = await agent.cmAddIdentity({ contactId: defaultContact.id, identity }) - result.identifier = { ...result.identifier, type: CorrelationIdentifierEnum.URL } + result.identifier = { ...result.identifier, type: CorrelationIdentifierType.URL } await expect(agent.cmUpdateIdentity({ identity: result })).rejects.toThrow(`Identity with correlation type url should contain a connection`) }) @@ -297,9 +297,9 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro const correlationId = 'new_update_example_did' const identity: NonPersistedIdentity = { alias: 'update_example_did', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'update_example_did', }, } @@ -320,8 +320,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'relation_last_name', displayName: 'relation_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d285', name: 'relation_contact_type_name', description: 'new_description', @@ -365,8 +365,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'remove_relation_last_name', displayName: 'remove_relation_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d286', name: 'remove_relation_contact_type_name', description: 'new_description', @@ -415,8 +415,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'add_electronic_address_last_name', displayName: 'add_electronic_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: 'a85a8aa0-fdeb-4c00-b22e-60423f52a873', name: 'add_electronic_address_name', description: 'add_electronic_address_description', @@ -444,8 +444,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'get_electronic_address_last_name', displayName: 'get_electronic_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: 'f2947075-53eb-4176-b155-ab4b18715288', name: 'get_electronic_address_name', description: 'get_electronic_address_description', @@ -472,8 +472,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'get_all_electronic_address_last_name', displayName: 'get_all_electronic_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '5c0157ec-4678-4273-8f53-413bc6435134', name: 'get_all_electronic_address_name', description: 'get_all_electronic_address_description', @@ -501,8 +501,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'update_electronic_address_last_name', displayName: 'update_electronic_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '6b64c3dd-cf40-4919-b8b8-2ec3c510c5b7', name: 'update_electronic_address_name', description: 'update_electronic_address_description', @@ -537,8 +537,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'remove_electronic_address_last_name', displayName: 'remove_electronic_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '41b45c65-971e-4c26-8115-cb8bc7c67cf3', name: 'remove_electronic_address_name', description: 'remove_electronic_address_description', @@ -571,8 +571,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'add_physical_address_last_name', displayName: 'add_physical_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '5aeb828e-16d6-4244-95a7-e12424474eb7', name: 'add_physical_address_name', description: 'add_physical_address_description', @@ -606,8 +606,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'get_physical_address_last_name', displayName: 'get_physical_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '7c5dbbd9-1721-4246-b261-44e237560a15', name: 'get_physical_address_name', description: 'get_physical_address_description', @@ -640,8 +640,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'get_all_physical_address_last_name', displayName: 'get_all_physical_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0c0eafd8-1e8c-44bf-8e0d-768fb11a40c3', name: 'get_all_physical_address_name', description: 'get_all_physical_address_description', @@ -675,8 +675,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'update_physical_address_last_name', displayName: 'update_physical_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: 'f2b4eb1c-e36f-4863-90b3-90720471c397', name: 'update_physical_address_name', description: 'update_physical_address_description', @@ -729,8 +729,8 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro lastName: 'remove_physical_address_last_name', displayName: 'remove_physical_address_display_name', contactType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '20b11d1e-6489-4258-af33-32a2cfa4dc85', name: 'remove_physical_address_name', description: 'remove_physical_address_description', diff --git a/packages/contact-manager/src/types/IContactManager.ts b/packages/contact-manager/src/types/IContactManager.ts index c1f9dfe73..dd0c274bb 100644 --- a/packages/contact-manager/src/types/IContactManager.ts +++ b/packages/contact-manager/src/types/IContactManager.ts @@ -18,7 +18,7 @@ import { PartyOrigin, PartyRelationship as ContactRelationship, PartyType as ContactType, - PartyTypeEnum as ContactTypeEnum, + PartyTypeType as ContactTypeType, PhysicalAddress, } from '@sphereon/ssi-sdk.data-store' @@ -119,7 +119,7 @@ export type UpdateRelationshipArgs = { } export type AddContactTypeArgs = { - type: ContactTypeEnum + type: ContactTypeType origin: PartyOrigin name: string tenantId: string diff --git a/packages/data-store/src/__tests__/contact.entities.test.ts b/packages/data-store/src/__tests__/contact.entities.test.ts index 542f5e8d9..ea23bafd9 100644 --- a/packages/data-store/src/__tests__/contact.entities.test.ts +++ b/packages/data-store/src/__tests__/contact.entities.test.ts @@ -15,9 +15,9 @@ import { PartyRelationshipEntity } from '../entities/contact/PartyRelationshipEn import { PartyTypeEntity } from '../entities/contact/PartyTypeEntity' import { PhysicalAddressEntity } from '../entities/contact/PhysicalAddressEntity' import { - ConnectionTypeEnum, - CorrelationIdentifierEnum, - IdentityRoleEnum, + ConnectionType, + CorrelationIdentifierType, + IdentityRoleType, NaturalPerson, NonPersistedConnection, NonPersistedDidAuthConfig, @@ -30,7 +30,7 @@ import { NonPersistedPartyType, NonPersistedPhysicalAddress, Organization, - PartyTypeEnum, + PartyTypeType, } from '../types' import { connectionEntityFrom, @@ -73,8 +73,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -114,8 +114,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.ORGANIZATION, - origin: PartyOrigin.internal, + type: PartyTypeType.ORGANIZATION, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -151,8 +151,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -172,8 +172,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -217,8 +217,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -239,8 +239,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -261,8 +261,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -283,8 +283,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -305,8 +305,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.ORGANIZATION, - origin: PartyOrigin.internal, + type: PartyTypeType.ORGANIZATION, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -325,8 +325,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.ORGANIZATION, - origin: PartyOrigin.internal, + type: PartyTypeType.ORGANIZATION, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -345,8 +345,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: '', }, @@ -367,8 +367,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', description: '', @@ -390,8 +390,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '', name: 'example_name', }, @@ -412,9 +412,9 @@ describe('Database entities tests', (): void => { const alias = 'non_unique_alias' const identity1: NonPersistedIdentity = { alias, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'unique_correlationId1', }, } @@ -423,9 +423,9 @@ describe('Database entities tests', (): void => { const identity2: NonPersistedIdentity = { alias: alias, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'unique_correlationId2', }, } @@ -439,9 +439,9 @@ describe('Database entities tests', (): void => { const correlationId = 'non_unique_correlationId' const identity1: NonPersistedIdentity = { alias: 'unique_alias1', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -450,9 +450,9 @@ describe('Database entities tests', (): void => { const identity2: NonPersistedIdentity = { alias: 'unique_alias2', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -466,9 +466,9 @@ describe('Database entities tests', (): void => { const correlationId = 'example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -495,9 +495,9 @@ describe('Database entities tests', (): void => { it('should throw error when saving identity with blank alias', async (): Promise => { const identity: NonPersistedIdentity = { alias: '', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did', }, } @@ -510,9 +510,9 @@ describe('Database entities tests', (): void => { it('should throw error when saving identity with blank correlation id', async (): Promise => { const identity: NonPersistedIdentity = { alias: 'example_did', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: '', }, } @@ -526,9 +526,9 @@ describe('Database entities tests', (): void => { const correlationId = 'example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, metadata: [ @@ -548,9 +548,9 @@ describe('Database entities tests', (): void => { const correlationId = 'example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, metadata: [ @@ -570,13 +570,13 @@ describe('Database entities tests', (): void => { const correlationId = 'example.com' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId, }, connection: { - type: ConnectionTypeEnum.OPENID_CONNECT, + type: ConnectionType.OPENID_CONNECT, config: { clientId: '138d7bf8-c930-4c6e-b928-97d3a4928b01', clientSecret: '03b3955f-d020-4f2a-8a27-4e452d4e27a0', @@ -615,13 +615,13 @@ describe('Database entities tests', (): void => { const correlationId = 'example.com' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId, }, connection: { - type: ConnectionTypeEnum.SIOPv2, + type: ConnectionType.SIOPv2, config: { identifier: { did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01', @@ -662,7 +662,7 @@ describe('Database entities tests', (): void => { it('Should save connection with openid config to database', async (): Promise => { const connection: NonPersistedConnection = { - type: ConnectionTypeEnum.OPENID_CONNECT, + type: ConnectionType.OPENID_CONNECT, config: { clientId: '138d7bf8-c930-4c6e-b928-97d3a4928b01', clientSecret: '03b3955f-d020-4f2a-8a27-4e452d4e27a0', @@ -696,7 +696,7 @@ describe('Database entities tests', (): void => { it('Should save connection with didauth config to database', async (): Promise => { const connection: NonPersistedConnection = { - type: ConnectionTypeEnum.SIOPv2, + type: ConnectionType.SIOPv2, config: { identifier: { did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01', @@ -786,8 +786,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -807,8 +807,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -828,13 +828,13 @@ describe('Database entities tests', (): void => { const correlationId = 'relation_example.com' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId, }, connection: { - type: ConnectionTypeEnum.OPENID_CONNECT, + type: ConnectionType.OPENID_CONNECT, config: { clientId: '138d7bf8-c930-4c6e-b928-97d3a4928b01', clientSecret: '03b3955f-d020-4f2a-8a27-4e452d4e27a0', @@ -967,8 +967,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -988,13 +988,13 @@ describe('Database entities tests', (): void => { const correlationId = 'relation_example.com' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId, }, connection: { - type: ConnectionTypeEnum.SIOPv2, + type: ConnectionType.SIOPv2, config: { identifier: { did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01', @@ -1068,8 +1068,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1089,13 +1089,13 @@ describe('Database entities tests', (): void => { const correlationId = 'relation_example.com' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId, }, connection: { - type: ConnectionTypeEnum.SIOPv2, + type: ConnectionType.SIOPv2, config: { identifier: { did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01', @@ -1144,8 +1144,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1172,8 +1172,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1212,9 +1212,9 @@ describe('Database entities tests', (): void => { const correlationId = 'example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -1238,9 +1238,9 @@ describe('Database entities tests', (): void => { const correlationId = 'example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -1268,8 +1268,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1296,8 +1296,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1339,8 +1339,8 @@ describe('Database entities tests', (): void => { it('Should set last updated date when saving party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', } @@ -1358,8 +1358,8 @@ describe('Database entities tests', (): void => { it('Should set last creation date when saving party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', } @@ -1379,9 +1379,9 @@ describe('Database entities tests', (): void => { const correlationId = 'example_did' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } @@ -1405,8 +1405,8 @@ describe('Database entities tests', (): void => { const tenantId = 'non_unique_value' const name = 'non_unique_value' const partyType1: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId, name, } @@ -1417,8 +1417,8 @@ describe('Database entities tests', (): void => { expect(savedPartyType1).toBeDefined() const partyType2: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId, name, } @@ -1432,8 +1432,8 @@ describe('Database entities tests', (): void => { it('Should enforce unique name when saving party type', async (): Promise => { const name = 'non_unique_value' const partyType1: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name, } @@ -1444,8 +1444,8 @@ describe('Database entities tests', (): void => { expect(savedPartyType1).toBeDefined() const partyType2: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name, } @@ -1510,8 +1510,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1533,8 +1533,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1574,8 +1574,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1595,8 +1595,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1634,8 +1634,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1655,8 +1655,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1694,8 +1694,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1717,8 +1717,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1770,8 +1770,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1793,8 +1793,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1836,8 +1836,8 @@ describe('Database entities tests', (): void => { it('Should save party type to database', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', } @@ -1972,8 +1972,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2006,8 +2006,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.ORGANIZATION, - origin: PartyOrigin.internal, + type: PartyTypeType.ORGANIZATION, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2037,8 +2037,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2071,8 +2071,8 @@ describe('Database entities tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -2094,8 +2094,8 @@ describe('Database entities tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -2136,8 +2136,8 @@ describe('Database entities tests', (): void => { it('Should delete party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', } @@ -2160,8 +2160,8 @@ describe('Database entities tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2187,8 +2187,8 @@ describe('Database entities tests', (): void => { it('Should save party with existing party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', } @@ -2228,19 +2228,19 @@ describe('Database entities tests', (): void => { it('Should not update creation date when saving party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', } const partyTypeEntity: PartyTypeEntity = partyTypeEntityFrom(partyType) const savedPartyType: PartyTypeEntity | null = await dbConnection.getRepository(PartyTypeEntity).save(partyTypeEntity) - await dbConnection.getRepository(PartyTypeEntity).save({ ...savedPartyType, type: PartyTypeEnum.ORGANIZATION }) + await dbConnection.getRepository(PartyTypeEntity).save({ ...savedPartyType, type: PartyTypeType.ORGANIZATION }) const fromDb: PartyTypeEntity | null = await dbConnection.getRepository(PartyTypeEntity).findOne({ where: { - type: PartyTypeEnum.ORGANIZATION, + type: PartyTypeType.ORGANIZATION, }, }) diff --git a/packages/data-store/src/__tests__/contact.store.test.ts b/packages/data-store/src/__tests__/contact.store.test.ts index b167d6744..3b01d302d 100644 --- a/packages/data-store/src/__tests__/contact.store.test.ts +++ b/packages/data-store/src/__tests__/contact.store.test.ts @@ -2,7 +2,7 @@ import { DataSource } from 'typeorm' import { DataStoreContactEntities, DataStoreMigrations, PartyOrigin } from '../index' import { ContactStore } from '../contact/ContactStore' import { - CorrelationIdentifierEnum, + CorrelationIdentifierType, ElectronicAddress, GetElectronicAddressesArgs, GetIdentitiesArgs, @@ -10,7 +10,7 @@ import { GetPhysicalAddressesArgs, GetRelationshipsArgs, Identity, - IdentityRoleEnum, + IdentityRoleType, NaturalPerson, NonPersistedElectronicAddress, NonPersistedIdentity, @@ -22,7 +22,7 @@ import { Party, PartyRelationship, PartyType, - PartyTypeEnum, + PartyTypeType, PhysicalAddress, } from '../types' @@ -53,8 +53,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -84,8 +84,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -102,8 +102,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -127,8 +127,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -175,8 +175,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -189,25 +189,25 @@ describe('Contact store tests', (): void => { identities: [ { alias: 'test_alias1', - roles: [IdentityRoleEnum.ISSUER], + roles: [IdentityRoleType.ISSUER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, }, { alias: 'test_alias2', - roles: [IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, }, { alias: 'test_alias3', - roles: [IdentityRoleEnum.HOLDER], + roles: [IdentityRoleType.HOLDER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did3', }, }, @@ -243,8 +243,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'something', }, @@ -287,8 +287,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -321,8 +321,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -373,8 +373,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -399,8 +399,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -413,17 +413,17 @@ describe('Contact store tests', (): void => { identities: [ { alias: 'test_alias1', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, }, { alias: 'test_alias2', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, }, @@ -443,8 +443,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'something', }, @@ -457,17 +457,17 @@ describe('Contact store tests', (): void => { identities: [ { alias: 'test_alias1', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId: 'example_did1', }, }, { alias: 'test_alias2', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, }, @@ -481,8 +481,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -498,9 +498,9 @@ describe('Contact store tests', (): void => { const identity1: NonPersistedIdentity = { alias: 'test_alias1', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, } @@ -509,9 +509,9 @@ describe('Contact store tests', (): void => { const identity2: NonPersistedIdentity = { alias: 'test_alias2', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, } @@ -539,8 +539,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -572,8 +572,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -589,9 +589,9 @@ describe('Contact store tests', (): void => { const identity: NonPersistedIdentity = { alias: 'test_alias', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did', }, } @@ -607,8 +607,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -624,9 +624,9 @@ describe('Contact store tests', (): void => { const identity: NonPersistedIdentity = { alias: 'test_alias', - roles: [IdentityRoleEnum.HOLDER], + roles: [IdentityRoleType.HOLDER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did', }, } @@ -648,8 +648,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -665,9 +665,9 @@ describe('Contact store tests', (): void => { const identity1: NonPersistedIdentity = { alias: 'test_alias1', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, } @@ -676,9 +676,9 @@ describe('Contact store tests', (): void => { const identity2: NonPersistedIdentity = { alias: 'test_alias2', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, } @@ -698,8 +698,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -715,9 +715,9 @@ describe('Contact store tests', (): void => { const identity1: NonPersistedIdentity = { alias: 'test_alias1', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, } @@ -726,9 +726,9 @@ describe('Contact store tests', (): void => { const identity2: NonPersistedIdentity = { alias: 'test_alias2', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, } @@ -744,8 +744,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -762,9 +762,9 @@ describe('Contact store tests', (): void => { const alias = 'test_alias1' const identity1: NonPersistedIdentity = { alias, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, } @@ -773,9 +773,9 @@ describe('Contact store tests', (): void => { const identity2: NonPersistedIdentity = { alias: 'test_alias2', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, } @@ -795,8 +795,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -813,9 +813,9 @@ describe('Contact store tests', (): void => { const alias = 'test_alias1' const identity1: NonPersistedIdentity = { alias, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, metadata: [ @@ -846,8 +846,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -863,9 +863,9 @@ describe('Contact store tests', (): void => { const identity: NonPersistedIdentity = { alias: 'test_alias', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did', }, } @@ -886,8 +886,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -904,9 +904,9 @@ describe('Contact store tests', (): void => { const correlationId = 'missing_connection_example' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.URL, + type: CorrelationIdentifierType.URL, correlationId, }, } @@ -920,8 +920,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -938,14 +938,14 @@ describe('Contact store tests', (): void => { const correlationId = 'missing_connection_example' const identity: NonPersistedIdentity = { alias: correlationId, - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER, IdentityRoleEnum.HOLDER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER, IdentityRoleType.HOLDER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId, }, } const storedIdentity: Identity = await contactStore.addIdentity({ partyId: savedParty.id, identity }) - storedIdentity.identifier = { ...storedIdentity.identifier, type: CorrelationIdentifierEnum.URL } + storedIdentity.identifier = { ...storedIdentity.identifier, type: CorrelationIdentifierType.URL } await expect(contactStore.updateIdentity({ identity: storedIdentity })).rejects.toThrow( `Identity with correlation type url should contain a connection`, @@ -956,8 +956,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -973,9 +973,9 @@ describe('Contact store tests', (): void => { const identity: NonPersistedIdentity = { alias: 'example_did', - roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.ISSUER, IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did', }, } @@ -994,8 +994,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1008,25 +1008,25 @@ describe('Contact store tests', (): void => { identities: [ { alias: 'test_alias1', - roles: [IdentityRoleEnum.VERIFIER], + roles: [IdentityRoleType.VERIFIER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did1', }, }, { alias: 'test_alias2', - roles: [IdentityRoleEnum.ISSUER], + roles: [IdentityRoleType.ISSUER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did2', }, }, { alias: 'test_alias3', - roles: [IdentityRoleEnum.HOLDER], + roles: [IdentityRoleType.HOLDER], identifier: { - type: CorrelationIdentifierEnum.DID, + type: CorrelationIdentifierType.DID, correlationId: 'example_did3', }, }, @@ -1038,15 +1038,15 @@ describe('Contact store tests', (): void => { expect(result.roles).toBeDefined() expect(result.roles.length).toEqual(3) - expect(result.roles).toEqual([IdentityRoleEnum.VERIFIER, IdentityRoleEnum.ISSUER, IdentityRoleEnum.HOLDER]) + expect(result.roles).toEqual([IdentityRoleType.VERIFIER, IdentityRoleType.ISSUER, IdentityRoleType.HOLDER]) }) it('should add relationship', async (): Promise => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1063,8 +1063,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1096,8 +1096,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1114,8 +1114,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1152,8 +1152,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1170,8 +1170,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1207,8 +1207,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1225,8 +1225,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1271,8 +1271,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1289,8 +1289,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1342,8 +1342,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1360,8 +1360,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1378,8 +1378,8 @@ describe('Contact store tests', (): void => { const party3: NonPersistedParty = { uri: 'example3.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d287', name: 'example_name3', }, @@ -1418,8 +1418,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1436,8 +1436,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1473,8 +1473,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1491,8 +1491,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1527,8 +1527,8 @@ describe('Contact store tests', (): void => { const party1: NonPersistedParty = { uri: 'example1.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name1', }, @@ -1545,8 +1545,8 @@ describe('Contact store tests', (): void => { const party2: NonPersistedParty = { uri: 'example2.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name2', }, @@ -1579,8 +1579,8 @@ describe('Contact store tests', (): void => { it('should add party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name', description: 'example_description', @@ -1601,8 +1601,8 @@ describe('Contact store tests', (): void => { it('should get party types by filter', async (): Promise => { const partyType1: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name1', description: 'example_description1', @@ -1611,8 +1611,8 @@ describe('Contact store tests', (): void => { expect(savedPartyType1).toBeDefined() const partyType2: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d287', name: 'example_name2', description: 'example_description2', @@ -1623,7 +1623,7 @@ describe('Contact store tests', (): void => { const result: Array = await contactStore.getPartyTypes({ filter: [ { - type: PartyTypeEnum.NATURAL_PERSON, + type: PartyTypeType.NATURAL_PERSON, name: 'example_name1', description: 'example_description1', }, @@ -1636,8 +1636,8 @@ describe('Contact store tests', (): void => { it('should return no party types if filter does not match', async (): Promise => { const partyType1: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name1', description: 'example_description1', @@ -1646,8 +1646,8 @@ describe('Contact store tests', (): void => { expect(savedPartyType1).toBeDefined() const partyType2: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d287', name: 'example_name2', description: 'example_description2', @@ -1658,7 +1658,7 @@ describe('Contact store tests', (): void => { const result: Array = await contactStore.getPartyTypes({ filter: [ { - type: PartyTypeEnum.NATURAL_PERSON, + type: PartyTypeType.NATURAL_PERSON, name: 'unknown_name', description: 'unknown_description', }, @@ -1671,8 +1671,8 @@ describe('Contact store tests', (): void => { it('should throw error when updating party type with unknown id', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name', description: 'example_description', @@ -1692,8 +1692,8 @@ describe('Contact store tests', (): void => { it('should update party type by id', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name', description: 'example_description', @@ -1721,8 +1721,8 @@ describe('Contact store tests', (): void => { it('should remove party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288', name: 'example_name', description: 'example_description', @@ -1749,8 +1749,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1771,8 +1771,8 @@ describe('Contact store tests', (): void => { it('Should save party with existing party type', async (): Promise => { const partyType: NonPersistedPartyType = { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', } @@ -1802,8 +1802,8 @@ describe('Contact store tests', (): void => { }) it('should throw error when adding person party with wrong contact type', async (): Promise => { - const partyType = PartyTypeEnum.ORGANIZATION - const partyTypeOrigin = PartyOrigin.internal + const partyType = PartyTypeType.ORGANIZATION + const partyTypeOrigin = PartyOrigin.INTERNAL const party: NonPersistedParty = { uri: 'example.com', partyType: { @@ -1824,8 +1824,8 @@ describe('Contact store tests', (): void => { }) it('should throw error when adding organization party with wrong contact type', async (): Promise => { - const partyType = PartyTypeEnum.NATURAL_PERSON - const partyTypeOrigin = PartyOrigin.external + const partyType = PartyTypeType.NATURAL_PERSON + const partyTypeOrigin = PartyOrigin.EXTERNAL const party: NonPersistedParty = { uri: 'example.com', partyType: { @@ -1847,8 +1847,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1886,8 +1886,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1934,8 +1934,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -1978,8 +1978,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2027,8 +2027,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2057,8 +2057,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2091,8 +2091,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2132,8 +2132,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2175,8 +2175,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2235,8 +2235,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2291,8 +2291,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2352,8 +2352,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2388,8 +2388,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.internal, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.INTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, @@ -2428,8 +2428,8 @@ describe('Contact store tests', (): void => { const party: NonPersistedParty = { uri: 'example.com', partyType: { - type: PartyTypeEnum.NATURAL_PERSON, - origin: PartyOrigin.external, + type: PartyTypeType.NATURAL_PERSON, + origin: PartyOrigin.EXTERNAL, tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289', name: 'example_name', }, diff --git a/packages/data-store/src/contact/ContactStore.ts b/packages/data-store/src/contact/ContactStore.ts index 1a50ed9c1..9cd0345a6 100644 --- a/packages/data-store/src/contact/ContactStore.ts +++ b/packages/data-store/src/contact/ContactStore.ts @@ -38,8 +38,8 @@ import { AddPartyTypeArgs, AddPhysicalAddressArgs, AddRelationshipArgs, - ConnectionTypeEnum, - CorrelationIdentifierEnum, + ConnectionType, + CorrelationIdentifierType, ElectronicAddress, GetElectronicAddressArgs, GetElectronicAddressesArgs, @@ -59,7 +59,7 @@ import { Party, PartyRelationship, PartyType, - PartyTypeEnum, + PartyTypeType, PhysicalAddress, RemoveElectronicAddressArgs, RemoveIdentityArgs, @@ -126,9 +126,9 @@ export class ContactStore extends AbstractContactStore { } for (const identity of identities ?? []) { - if (identity.identifier.type === CorrelationIdentifierEnum.URL) { + if (identity.identifier.type === CorrelationIdentifierType.URL) { if (!identity.connection) { - return Promise.reject(Error(`Identity with correlation type ${CorrelationIdentifierEnum.URL} should contain a connection`)) + return Promise.reject(Error(`Identity with correlation type ${CorrelationIdentifierType.URL} should contain a connection`)) } if (!this.hasCorrectConnectionConfig(identity.connection.type, identity.connection.config)) { @@ -235,9 +235,9 @@ export class ContactStore extends AbstractContactStore { return Promise.reject(Error(`No party found for id: ${partyId}`)) } - if (identity.identifier.type === CorrelationIdentifierEnum.URL) { + if (identity.identifier.type === CorrelationIdentifierType.URL) { if (!identity.connection) { - return Promise.reject(Error(`Identity with correlation type ${CorrelationIdentifierEnum.URL} should contain a connection`)) + return Promise.reject(Error(`Identity with correlation type ${CorrelationIdentifierType.URL} should contain a connection`)) } if (!this.hasCorrectConnectionConfig(identity.connection.type, identity.connection.config)) { @@ -266,9 +266,9 @@ export class ContactStore extends AbstractContactStore { return Promise.reject(Error(`No identity found for id: ${identity.id}`)) } - if (identity.identifier.type === CorrelationIdentifierEnum.URL) { + if (identity.identifier.type === CorrelationIdentifierType.URL) { if (!identity.connection) { - return Promise.reject(Error(`Identity with correlation type ${CorrelationIdentifierEnum.URL} should contain a connection`)) + return Promise.reject(Error(`Identity with correlation type ${CorrelationIdentifierType.URL} should contain a connection`)) } if (!this.hasCorrectConnectionConfig(identity.connection.type, identity.connection.config)) { @@ -622,22 +622,22 @@ export class ContactStore extends AbstractContactStore { await physicalAddressRepository.delete(physicalAddressId) } - private hasCorrectConnectionConfig(type: ConnectionTypeEnum, config: NonPersistedConnectionConfig): boolean { + private hasCorrectConnectionConfig(type: ConnectionType, config: NonPersistedConnectionConfig): boolean { switch (type) { - case ConnectionTypeEnum.OPENID_CONNECT: + case ConnectionType.OPENID_CONNECT: return isOpenIdConfig(config) - case ConnectionTypeEnum.SIOPv2: + case ConnectionType.SIOPv2: return isDidAuthConfig(config) default: throw new Error('Connection type not supported') } } - private hasCorrectPartyType(type: PartyTypeEnum, contact: NonPersistedContact): boolean { + private hasCorrectPartyType(type: PartyTypeType, contact: NonPersistedContact): boolean { switch (type) { - case PartyTypeEnum.NATURAL_PERSON: + case PartyTypeType.NATURAL_PERSON: return isNaturalPerson(contact) - case PartyTypeEnum.ORGANIZATION: + case PartyTypeType.ORGANIZATION: return isOrganization(contact) default: throw new Error('Party type not supported') diff --git a/packages/data-store/src/entities/contact/ConnectionEntity.ts b/packages/data-store/src/entities/contact/ConnectionEntity.ts index 1c4daecf0..f5dff0c62 100644 --- a/packages/data-store/src/entities/contact/ConnectionEntity.ts +++ b/packages/data-store/src/entities/contact/ConnectionEntity.ts @@ -1,6 +1,6 @@ import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn, BaseEntity } from 'typeorm' import { BaseConfigEntity } from './BaseConfigEntity' -import { ConnectionTypeEnum } from '../../types' +import { ConnectionType } from '../../types' import { IdentityEntity } from './IdentityEntity' import { OpenIdConfigEntity } from './OpenIdConfigEntity' import { DidAuthConfigEntity } from './DidAuthConfigEntity' @@ -10,8 +10,8 @@ export class ConnectionEntity extends BaseEntity { @PrimaryGeneratedColumn('uuid') id!: string - @Column('simple-enum', { name: 'type', enum: ConnectionTypeEnum, nullable: false }) - type!: ConnectionTypeEnum + @Column('simple-enum', { name: 'type', enum: ConnectionType, nullable: false }) + type!: ConnectionType @OneToOne(() => BaseConfigEntity, (config: OpenIdConfigEntity | DidAuthConfigEntity) => config.connection, { cascade: true, diff --git a/packages/data-store/src/entities/contact/CorrelationIdentifierEntity.ts b/packages/data-store/src/entities/contact/CorrelationIdentifierEntity.ts index 5bcd4abd6..d2482cf31 100644 --- a/packages/data-store/src/entities/contact/CorrelationIdentifierEntity.ts +++ b/packages/data-store/src/entities/contact/CorrelationIdentifierEntity.ts @@ -1,5 +1,5 @@ import { Entity, Column, PrimaryGeneratedColumn, BaseEntity, OneToOne, JoinColumn, BeforeInsert, BeforeUpdate } from 'typeorm' -import { CorrelationIdentifierEnum, ValidationConstraint } from '../../types' +import { CorrelationIdentifierType, ValidationConstraint } from '../../types' import { IdentityEntity } from './IdentityEntity' import { IsNotEmpty, validate, ValidationError } from 'class-validator' import { getConstraint } from '../../utils/ValidatorUtils' @@ -9,8 +9,8 @@ export class CorrelationIdentifierEntity extends BaseEntity { @PrimaryGeneratedColumn('uuid') id!: string - @Column('simple-enum', { name: 'type', enum: CorrelationIdentifierEnum, nullable: false }) - type!: CorrelationIdentifierEnum + @Column('simple-enum', { name: 'type', enum: CorrelationIdentifierType, nullable: false }) + type!: CorrelationIdentifierType @Column('text', { name: 'correlation_id', nullable: false, unique: true }) @IsNotEmpty({ message: 'Blank correlation ids are not allowed' }) diff --git a/packages/data-store/src/entities/contact/IdentityEntity.ts b/packages/data-store/src/entities/contact/IdentityEntity.ts index 393db54e4..4e9c96f3f 100644 --- a/packages/data-store/src/entities/contact/IdentityEntity.ts +++ b/packages/data-store/src/entities/contact/IdentityEntity.ts @@ -16,7 +16,7 @@ import { IsNotEmpty, validate, ValidationError } from 'class-validator' import { CorrelationIdentifierEntity } from './CorrelationIdentifierEntity' import { ConnectionEntity } from './ConnectionEntity' import { IdentityMetadataItemEntity } from './IdentityMetadataItemEntity' -import { IdentityRoleEnum, ValidationConstraint } from '../../types' +import { IdentityRoleType, ValidationConstraint } from '../../types' import { PartyEntity } from './PartyEntity' import { getConstraint } from '../../utils/ValidatorUtils' @@ -35,7 +35,7 @@ export class IdentityEntity extends BaseEntity { alias!: string @Column('simple-array', { name: 'roles', nullable: false }) - roles!: Array + roles!: Array @OneToOne(() => CorrelationIdentifierEntity, (identifier: CorrelationIdentifierEntity) => identifier.identity, { cascade: true, diff --git a/packages/data-store/src/entities/contact/PartyTypeEntity.ts b/packages/data-store/src/entities/contact/PartyTypeEntity.ts index 43782312d..72cb0eed1 100644 --- a/packages/data-store/src/entities/contact/PartyTypeEntity.ts +++ b/packages/data-store/src/entities/contact/PartyTypeEntity.ts @@ -1,6 +1,6 @@ import { BeforeInsert, BeforeUpdate, Column, CreateDateColumn, Entity, Index, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm' import { PartyEntity } from './PartyEntity' -import { PartyOrigin, PartyTypeEnum, ValidationConstraint } from '../../types' +import { PartyOrigin, PartyTypeType, ValidationConstraint } from '../../types' import { IsNotEmpty, Validate, validate, ValidationError } from 'class-validator' import { IsNonEmptyStringConstraint } from '../validators' import { getConstraint } from '../../utils/ValidatorUtils' @@ -11,8 +11,8 @@ export class PartyTypeEntity { @PrimaryGeneratedColumn('uuid') id!: string - @Column('simple-enum', { name: 'type', enum: PartyTypeEnum, nullable: false, unique: false }) - type!: PartyTypeEnum + @Column('simple-enum', { name: 'type', enum: PartyTypeType, nullable: false, unique: false }) + type!: PartyTypeType @Column('simple-enum', { name: 'origin', enum: PartyOrigin, default: 'external', nullable: false, unique: false }) origin!: PartyOrigin diff --git a/packages/data-store/src/types/contact/IAbstractContactStore.ts b/packages/data-store/src/types/contact/IAbstractContactStore.ts index b54ad487b..dee92598d 100644 --- a/packages/data-store/src/types/contact/IAbstractContactStore.ts +++ b/packages/data-store/src/types/contact/IAbstractContactStore.ts @@ -16,7 +16,7 @@ import { PartyOrigin, PartyRelationship, PartyType, - PartyTypeEnum, + PartyTypeType, PhysicalAddress, } from './contact' @@ -95,7 +95,7 @@ export type UpdateRelationshipArgs = { } export type AddPartyTypeArgs = { - type: PartyTypeEnum + type: PartyTypeType origin: PartyOrigin name: string tenantId: string diff --git a/packages/data-store/src/types/contact/contact.ts b/packages/data-store/src/types/contact/contact.ts index bfa2095e1..d78488604 100644 --- a/packages/data-store/src/types/contact/contact.ts +++ b/packages/data-store/src/types/contact/contact.ts @@ -3,7 +3,7 @@ import { IIdentifier } from '@veramo/core' export type Party = { id: string uri?: string - roles: Array + roles: Array identities: Array electronicAddresses: Array physicalAddresses: Array @@ -47,7 +47,7 @@ export type PartialParty = Partial< export type Identity = { id: string alias: string - roles: Array + roles: Array identifier: CorrelationIdentifier connection?: Connection metadata?: Array @@ -63,7 +63,7 @@ export type PartialIdentity = Partial export type CorrelationIdentifier = { id: string - type: CorrelationIdentifierEnum + type: CorrelationIdentifierType correlationId: string } export type NonPersistedCorrelationIdentifier = Omit @@ -85,7 +85,7 @@ export type PartialCorrelationIdentifier = Partial export type Connection = { id: string - type: ConnectionTypeEnum + type: ConnectionType config: ConnectionConfig } export type NonPersistedConnection = Omit & { @@ -150,14 +150,9 @@ export type Contact = NaturalPerson | Organization export type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization export type PartialContact = PartialNaturalPerson | PartialOrganization -export enum PartyOrigin { - internal = 'internal', - external = 'external', -} - export type PartyType = { id: string - type: PartyTypeEnum + type: PartyTypeType origin: PartyOrigin name: string tenantId: string @@ -214,24 +209,29 @@ export type ElectronicAddressType = 'email' | 'phone' export type PhysicalAddressType = 'home' | 'visit' | 'postal' -export enum IdentityRoleEnum { +export enum IdentityRoleType { ISSUER = 'issuer', VERIFIER = 'verifier', HOLDER = 'holder', } -export enum ConnectionTypeEnum { +export enum ConnectionType { OPENID_CONNECT = 'OIDC', SIOPv2 = 'SIOPv2', SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP', } -export enum CorrelationIdentifierEnum { +export enum CorrelationIdentifierType { DID = 'did', URL = 'url', } -export enum PartyTypeEnum { +export enum PartyTypeType { NATURAL_PERSON = 'naturalPerson', ORGANIZATION = 'organization', } + +export enum PartyOrigin { + INTERNAL = 'internal', + EXTERNAL = 'external', +}