@sphereon/ssi-sdk.data-store 0.11.1-unstable.73 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/contact/AbstractContactStore.d.ts +1 -2
- package/dist/contact/AbstractContactStore.d.ts.map +1 -1
- package/dist/contact/AbstractContactStore.js.map +1 -1
- package/dist/contact/ContactStore.d.ts +1 -2
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/contact/ContactStore.js +11 -11
- package/dist/contact/ContactStore.js.map +1 -1
- package/dist/entities/contact/ConnectionEntity.d.ts +1 -1
- package/dist/entities/contact/ConnectionEntity.d.ts.map +1 -1
- package/dist/entities/contact/ConnectionEntity.js +4 -4
- package/dist/entities/contact/ConnectionEntity.js.map +1 -1
- package/dist/entities/contact/ContactEntity.d.ts +1 -1
- package/dist/entities/contact/ContactEntity.d.ts.map +1 -1
- package/dist/entities/contact/ContactEntity.js +2 -5
- package/dist/entities/contact/ContactEntity.js.map +1 -1
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +1 -1
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts.map +1 -1
- package/dist/entities/contact/CorrelationIdentifierEntity.js +3 -4
- package/dist/entities/contact/CorrelationIdentifierEntity.js.map +1 -1
- package/dist/entities/contact/DidAuthConfigEntity.d.ts +1 -1
- package/dist/entities/contact/DidAuthConfigEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityEntity.d.ts +2 -2
- package/dist/entities/contact/IdentityEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityEntity.js +4 -7
- package/dist/entities/contact/IdentityEntity.js.map +1 -1
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +1 -1
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityMetadataItemEntity.js +1 -2
- package/dist/entities/contact/IdentityMetadataItemEntity.js.map +1 -1
- package/dist/entities/contact/OpenIdConfigEntity.d.ts +1 -1
- package/dist/entities/contact/OpenIdConfigEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +11 -0
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +74 -0
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts +18 -0
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js +120 -0
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +15 -0
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +102 -0
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +9 -0
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +49 -0
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +14 -0
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js +92 -0
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +9 -0
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +39 -0
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +14 -0
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +95 -0
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +9 -0
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +49 -0
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +9 -0
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/TextAttributesEntity.js +62 -0
- package/dist/entities/issuanceBranding/TextAttributesEntity.js.map +1 -0
- package/dist/entities/validators/index.d.ts +7 -0
- package/dist/entities/validators/index.d.ts.map +1 -0
- package/dist/entities/validators/index.js +27 -0
- package/dist/entities/validators/index.js.map +1 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -5
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts +20 -0
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts.map +1 -0
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js +7 -0
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js.map +1 -0
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +31 -0
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -0
- package/dist/issuanceBranding/IssuanceBrandingStore.js +375 -0
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -0
- package/dist/migrations/generic/1-CreateContacts.js +1 -1
- package/dist/migrations/generic/1-CreateContacts.js.map +1 -1
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts +7 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +1 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.js +72 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +1 -0
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +2 -1
- package/dist/migrations/generic/index.js.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts +7 -0
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts.map +1 -0
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +67 -0
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -0
- package/dist/migrations/sqlite/1659463069549-CreateContacts.d.ts.map +1 -1
- package/dist/migrations/sqlite/1659463069549-CreateContacts.js.map +1 -1
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts +7 -0
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts.map +1 -0
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +89 -0
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js.map +1 -0
- package/dist/types/{IAbstractContactStore.d.ts → contact/IAbstractContactStore.d.ts} +2 -2
- package/dist/types/contact/IAbstractContactStore.d.ts.map +1 -0
- package/dist/types/contact/IAbstractContactStore.js.map +1 -0
- package/dist/types/contact/contact.d.ts.map +1 -0
- package/dist/types/contact/contact.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts +59 -0
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts.map +1 -0
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js +3 -0
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js.map +1 -0
- package/dist/types/issuanceBranding/issuanceBranding.d.ts +115 -0
- package/dist/types/issuanceBranding/issuanceBranding.d.ts.map +1 -0
- package/dist/types/issuanceBranding/issuanceBranding.js +3 -0
- package/dist/types/issuanceBranding/issuanceBranding.js.map +1 -0
- package/package.json +3 -3
- package/src/__tests__/contact.entities.test.ts +31 -31
- package/src/__tests__/contact.store.test.ts +32 -32
- package/src/__tests__/issuanceBranding.entities.test.ts +844 -0
- package/src/__tests__/issuanceBranding.store.test.ts +1884 -0
- package/src/contact/AbstractContactStore.ts +3 -2
- package/src/contact/ContactStore.ts +2 -4
- package/src/entities/contact/ConnectionEntity.ts +1 -1
- package/src/entities/contact/ContactEntity.ts +5 -7
- package/src/entities/contact/CorrelationIdentifierEntity.ts +4 -4
- package/src/entities/contact/DidAuthConfigEntity.ts +1 -1
- package/src/entities/contact/IdentityEntity.ts +6 -8
- package/src/entities/contact/IdentityMetadataItemEntity.ts +4 -4
- package/src/entities/contact/OpenIdConfigEntity.ts +1 -1
- package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +42 -0
- package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +86 -0
- package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +78 -0
- package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +33 -0
- package/src/entities/issuanceBranding/ImageAttributesEntity.ts +57 -0
- package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +22 -0
- package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +72 -0
- package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +33 -0
- package/src/entities/issuanceBranding/TextAttributesEntity.ts +31 -0
- package/src/entities/validators/index.ts +16 -0
- package/src/index.ts +42 -5
- package/src/issuanceBranding/AbstractIssuanceBrandingStore.ts +41 -0
- package/src/issuanceBranding/IssuanceBrandingStore.ts +544 -0
- package/src/migrations/generic/1-CreateContacts.ts +1 -1
- package/src/migrations/generic/1-CreateIssuanceBranding.ts +54 -0
- package/src/migrations/generic/index.ts +2 -1
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +83 -0
- package/src/migrations/sqlite/1659463069549-CreateContacts.ts +0 -1
- package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +119 -0
- package/src/types/{IAbstractContactStore.ts → contact/IAbstractContactStore.ts} +3 -2
- package/src/types/index.ts +4 -0
- package/src/types/issuanceBranding/IAbstractIssuanceBrandingStore.ts +85 -0
- package/src/types/issuanceBranding/issuanceBranding.ts +120 -0
- package/dist/types/IAbstractContactStore.d.ts.map +0 -1
- package/dist/types/IAbstractContactStore.js.map +0 -1
- package/dist/types/contact.d.ts.map +0 -1
- package/dist/types/contact.js.map +0 -1
- /package/dist/types/{IAbstractContactStore.js → contact/IAbstractContactStore.js} +0 -0
- /package/dist/types/{contact.d.ts → contact/contact.d.ts} +0 -0
- /package/dist/types/{contact.js → contact/contact.js} +0 -0
- /package/src/types/{contact.ts → contact/contact.ts} +0 -0
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
IdentityRoleEnum,
|
|
21
21
|
} from '../index'
|
|
22
22
|
|
|
23
|
-
describe('Database entities
|
|
23
|
+
describe('Database entities tests', (): void => {
|
|
24
24
|
let dbConnection: DataSource
|
|
25
25
|
|
|
26
|
-
beforeEach(async () => {
|
|
26
|
+
beforeEach(async (): Promise<void> => {
|
|
27
27
|
dbConnection = await new DataSource({
|
|
28
28
|
type: 'sqlite',
|
|
29
29
|
database: ':memory:',
|
|
@@ -37,11 +37,11 @@ describe('Database entities test', () => {
|
|
|
37
37
|
expect(await dbConnection.showMigrations()).toBeFalsy()
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
afterEach(async () => {
|
|
40
|
+
afterEach(async (): Promise<void> => {
|
|
41
41
|
await (await dbConnection).destroy()
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
it('Should save contact to database', async () => {
|
|
44
|
+
it('Should save contact to database', async (): Promise<void> => {
|
|
45
45
|
const contact = {
|
|
46
46
|
name: 'test_name',
|
|
47
47
|
alias: 'test_alias',
|
|
@@ -62,7 +62,7 @@ describe('Database entities test', () => {
|
|
|
62
62
|
expect(fromDb?.uri).toEqual(contact.uri)
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
it('should throw error when saving contact with blank name', async () => {
|
|
65
|
+
it('should throw error when saving contact with blank name', async (): Promise<void> => {
|
|
66
66
|
const contact = {
|
|
67
67
|
name: '',
|
|
68
68
|
alias: 'test_alias',
|
|
@@ -74,7 +74,7 @@ describe('Database entities test', () => {
|
|
|
74
74
|
await expect(dbConnection.getRepository(ContactEntity).save(contactEntity)).rejects.toThrow('Blank names are not allowed')
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
-
it('should throw error when saving contact with blank alias', async () => {
|
|
77
|
+
it('should throw error when saving contact with blank alias', async (): Promise<void> => {
|
|
78
78
|
const contact = {
|
|
79
79
|
name: 'test_name',
|
|
80
80
|
alias: '',
|
|
@@ -86,7 +86,7 @@ describe('Database entities test', () => {
|
|
|
86
86
|
await expect(dbConnection.getRepository(ContactEntity).save(contactEntity)).rejects.toThrow('Blank aliases are not allowed')
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
-
it('Should enforce unique name for a contact', async () => {
|
|
89
|
+
it('Should enforce unique name for a contact', async (): Promise<void> => {
|
|
90
90
|
const contactName = 'non_unique_name'
|
|
91
91
|
const contact1 = {
|
|
92
92
|
name: contactName,
|
|
@@ -108,7 +108,7 @@ describe('Database entities test', () => {
|
|
|
108
108
|
)
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
-
it('Should enforce unique alias for a contact', async () => {
|
|
111
|
+
it('Should enforce unique alias for a contact', async (): Promise<void> => {
|
|
112
112
|
const alias = 'non_unique_alias'
|
|
113
113
|
const contact1 = {
|
|
114
114
|
name: 'unique_name1',
|
|
@@ -130,7 +130,7 @@ describe('Database entities test', () => {
|
|
|
130
130
|
)
|
|
131
131
|
})
|
|
132
132
|
|
|
133
|
-
it('Should enforce unique alias for an identity', async () => {
|
|
133
|
+
it('Should enforce unique alias for an identity', async (): Promise<void> => {
|
|
134
134
|
const alias = 'non_unique_alias'
|
|
135
135
|
const identity1 = {
|
|
136
136
|
alias,
|
|
@@ -157,7 +157,7 @@ describe('Database entities test', () => {
|
|
|
157
157
|
)
|
|
158
158
|
})
|
|
159
159
|
|
|
160
|
-
it('Should enforce unique correlationId for a identity', async () => {
|
|
160
|
+
it('Should enforce unique correlationId for a identity', async (): Promise<void> => {
|
|
161
161
|
const correlationId = 'non_unique_correlationId'
|
|
162
162
|
const identity1 = {
|
|
163
163
|
alias: 'unique_alias1',
|
|
@@ -184,7 +184,7 @@ describe('Database entities test', () => {
|
|
|
184
184
|
)
|
|
185
185
|
})
|
|
186
186
|
|
|
187
|
-
it('Should save identity to database', async () => {
|
|
187
|
+
it('Should save identity to database', async (): Promise<void> => {
|
|
188
188
|
const correlationId = 'example_did'
|
|
189
189
|
const identity = {
|
|
190
190
|
alias: correlationId,
|
|
@@ -214,7 +214,7 @@ describe('Database entities test', () => {
|
|
|
214
214
|
expect(fromDb?.identifier.type).toEqual(identity.identifier.type)
|
|
215
215
|
})
|
|
216
216
|
|
|
217
|
-
it('should throw error when saving identity with blank alias', async () => {
|
|
217
|
+
it('should throw error when saving identity with blank alias', async (): Promise<void> => {
|
|
218
218
|
const identity = {
|
|
219
219
|
alias: '',
|
|
220
220
|
roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER],
|
|
@@ -229,7 +229,7 @@ describe('Database entities test', () => {
|
|
|
229
229
|
await expect(dbConnection.getRepository(IdentityEntity).save(identityEntity)).rejects.toThrow('Blank aliases are not allowed')
|
|
230
230
|
})
|
|
231
231
|
|
|
232
|
-
it('should throw error when saving identity with blank correlation id', async () => {
|
|
232
|
+
it('should throw error when saving identity with blank correlation id', async (): Promise<void> => {
|
|
233
233
|
const identity = {
|
|
234
234
|
alias: 'example_did',
|
|
235
235
|
roles: [IdentityRoleEnum.ISSUER, IdentityRoleEnum.VERIFIER],
|
|
@@ -244,7 +244,7 @@ describe('Database entities test', () => {
|
|
|
244
244
|
await expect(dbConnection.getRepository(IdentityEntity).save(identityEntity)).rejects.toThrow('Blank correlation ids are not allowed')
|
|
245
245
|
})
|
|
246
246
|
|
|
247
|
-
it('should throw error when saving identity with blank metadata label', async () => {
|
|
247
|
+
it('should throw error when saving identity with blank metadata label', async (): Promise<void> => {
|
|
248
248
|
const correlationId = 'example_did'
|
|
249
249
|
const identity = {
|
|
250
250
|
alias: correlationId,
|
|
@@ -266,7 +266,7 @@ describe('Database entities test', () => {
|
|
|
266
266
|
await expect(dbConnection.getRepository(IdentityEntity).save(identityEntity)).rejects.toThrow('Blank metadata labels are not allowed')
|
|
267
267
|
})
|
|
268
268
|
|
|
269
|
-
it('should throw error when saving identity with blank metadata value', async () => {
|
|
269
|
+
it('should throw error when saving identity with blank metadata value', async (): Promise<void> => {
|
|
270
270
|
const correlationId = 'example_did'
|
|
271
271
|
const identity = {
|
|
272
272
|
alias: correlationId,
|
|
@@ -288,7 +288,7 @@ describe('Database entities test', () => {
|
|
|
288
288
|
await expect(dbConnection.getRepository(IdentityEntity).save(identityEntity)).rejects.toThrow('Blank metadata values are not allowed')
|
|
289
289
|
})
|
|
290
290
|
|
|
291
|
-
it('Should save identity with openid connection to database', async () => {
|
|
291
|
+
it('Should save identity with openid connection to database', async (): Promise<void> => {
|
|
292
292
|
const correlationId = 'example.com'
|
|
293
293
|
const identity = {
|
|
294
294
|
alias: correlationId,
|
|
@@ -333,7 +333,7 @@ describe('Database entities test', () => {
|
|
|
333
333
|
expect((fromDb?.connection?.config as OpenIdConfigEntity).clientId).toEqual(identity.connection.config.clientId)
|
|
334
334
|
})
|
|
335
335
|
|
|
336
|
-
it('Should save identity with didauth connection to database', async () => {
|
|
336
|
+
it('Should save identity with didauth connection to database', async (): Promise<void> => {
|
|
337
337
|
const correlationId = 'example.com'
|
|
338
338
|
const identity = {
|
|
339
339
|
alias: correlationId,
|
|
@@ -380,7 +380,7 @@ describe('Database entities test', () => {
|
|
|
380
380
|
expect((fromDb?.connection?.config as DidAuthConfigEntity).identifier).toEqual(identity.connection.config.identifier.did)
|
|
381
381
|
})
|
|
382
382
|
|
|
383
|
-
it('Should save connection with openid config to database', async () => {
|
|
383
|
+
it('Should save connection with openid config to database', async (): Promise<void> => {
|
|
384
384
|
const connection = {
|
|
385
385
|
type: ConnectionTypeEnum.OPENID_CONNECT,
|
|
386
386
|
config: {
|
|
@@ -414,7 +414,7 @@ describe('Database entities test', () => {
|
|
|
414
414
|
expect((fromDb?.config as OpenIdConfigEntity).clientId).toEqual(connection.config.clientId)
|
|
415
415
|
})
|
|
416
416
|
|
|
417
|
-
it('Should save connection with didauth config to database', async () => {
|
|
417
|
+
it('Should save connection with didauth config to database', async (): Promise<void> => {
|
|
418
418
|
const connection = {
|
|
419
419
|
type: ConnectionTypeEnum.SIOPv2,
|
|
420
420
|
config: {
|
|
@@ -450,7 +450,7 @@ describe('Database entities test', () => {
|
|
|
450
450
|
expect((fromDb?.config as DidAuthConfigEntity).identifier).toEqual(connection.config.identifier.did)
|
|
451
451
|
})
|
|
452
452
|
|
|
453
|
-
it('Should save openid config to database', async () => {
|
|
453
|
+
it('Should save openid config to database', async (): Promise<void> => {
|
|
454
454
|
const clientId = '138d7bf8-c930-4c6e-b928-97d3a4928b01'
|
|
455
455
|
const config = {
|
|
456
456
|
clientId,
|
|
@@ -475,7 +475,7 @@ describe('Database entities test', () => {
|
|
|
475
475
|
expect((fromDb as OpenIdConfigEntity).clientId).toEqual(config.clientId)
|
|
476
476
|
})
|
|
477
477
|
|
|
478
|
-
it('Should save didauth config to database', async () => {
|
|
478
|
+
it('Should save didauth config to database', async (): Promise<void> => {
|
|
479
479
|
const sessionId = 'https://example.com/did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01'
|
|
480
480
|
const config = {
|
|
481
481
|
identifier: {
|
|
@@ -502,7 +502,7 @@ describe('Database entities test', () => {
|
|
|
502
502
|
expect((fromDb as DidAuthConfigEntity).identifier).toEqual(config.identifier.did)
|
|
503
503
|
})
|
|
504
504
|
|
|
505
|
-
it('Should delete contact and all child relations', async () => {
|
|
505
|
+
it('Should delete contact and all child relations', async (): Promise<void> => {
|
|
506
506
|
const contact = {
|
|
507
507
|
name: 'relation_test_name',
|
|
508
508
|
alias: 'relation_test_alias',
|
|
@@ -596,7 +596,7 @@ describe('Database entities test', () => {
|
|
|
596
596
|
).toBeNull()
|
|
597
597
|
})
|
|
598
598
|
|
|
599
|
-
it('Should delete identity and all child relations', async () => {
|
|
599
|
+
it('Should delete identity and all child relations', async (): Promise<void> => {
|
|
600
600
|
const contact = {
|
|
601
601
|
name: 'relation_test_name',
|
|
602
602
|
alias: 'relation_test_alias',
|
|
@@ -685,7 +685,7 @@ describe('Database entities test', () => {
|
|
|
685
685
|
).toBeNull()
|
|
686
686
|
})
|
|
687
687
|
|
|
688
|
-
it('Should not delete contact when deleting identity', async () => {
|
|
688
|
+
it('Should not delete contact when deleting identity', async (): Promise<void> => {
|
|
689
689
|
const contact = {
|
|
690
690
|
name: 'relation_test_name',
|
|
691
691
|
alias: 'relation_test_alias',
|
|
@@ -747,7 +747,7 @@ describe('Database entities test', () => {
|
|
|
747
747
|
).toBeDefined()
|
|
748
748
|
})
|
|
749
749
|
|
|
750
|
-
it('Should set creation date when saving contact', async () => {
|
|
750
|
+
it('Should set creation date when saving contact', async (): Promise<void> => {
|
|
751
751
|
const contact = {
|
|
752
752
|
name: 'test_name',
|
|
753
753
|
alias: 'test_alias',
|
|
@@ -765,7 +765,7 @@ describe('Database entities test', () => {
|
|
|
765
765
|
expect(fromDb?.createdAt).toBeDefined()
|
|
766
766
|
})
|
|
767
767
|
|
|
768
|
-
it('Should not update creation date when updating contact', async () => {
|
|
768
|
+
it('Should not update creation date when updating contact', async (): Promise<void> => {
|
|
769
769
|
const contact = {
|
|
770
770
|
name: 'test_name',
|
|
771
771
|
alias: 'test_alias',
|
|
@@ -785,7 +785,7 @@ describe('Database entities test', () => {
|
|
|
785
785
|
expect(fromDb?.createdAt).toEqual(savedContact?.createdAt)
|
|
786
786
|
})
|
|
787
787
|
|
|
788
|
-
it('Should set creation date when saving identity', async () => {
|
|
788
|
+
it('Should set creation date when saving identity', async (): Promise<void> => {
|
|
789
789
|
const correlationId = 'example_did'
|
|
790
790
|
const identity = {
|
|
791
791
|
alias: correlationId,
|
|
@@ -811,7 +811,7 @@ describe('Database entities test', () => {
|
|
|
811
811
|
expect(fromDb?.createdAt).toBeDefined()
|
|
812
812
|
})
|
|
813
813
|
|
|
814
|
-
it('Should not update creation date when saving identity', async () => {
|
|
814
|
+
it('Should not update creation date when saving identity', async (): Promise<void> => {
|
|
815
815
|
const correlationId = 'example_did'
|
|
816
816
|
const identity = {
|
|
817
817
|
alias: correlationId,
|
|
@@ -841,7 +841,7 @@ describe('Database entities test', () => {
|
|
|
841
841
|
expect(fromDb?.createdAt).toEqual(savedIdentity?.createdAt)
|
|
842
842
|
})
|
|
843
843
|
|
|
844
|
-
it('Should set last updated date when saving contact', async () => {
|
|
844
|
+
it('Should set last updated date when saving contact', async (): Promise<void> => {
|
|
845
845
|
const contact = {
|
|
846
846
|
name: 'test_name',
|
|
847
847
|
alias: 'test_alias',
|
|
@@ -859,7 +859,7 @@ describe('Database entities test', () => {
|
|
|
859
859
|
expect(fromDb?.lastUpdatedAt).toBeDefined()
|
|
860
860
|
})
|
|
861
861
|
|
|
862
|
-
it('Should update last updated date when updating contact', async () => {
|
|
862
|
+
it('Should update last updated date when updating contact', async (): Promise<void> => {
|
|
863
863
|
const contact = {
|
|
864
864
|
name: 'test_name',
|
|
865
865
|
alias: 'test_alias',
|
|
@@ -883,7 +883,7 @@ describe('Database entities test', () => {
|
|
|
883
883
|
expect(fromDb?.lastUpdatedAt).not.toEqual(savedContact?.lastUpdatedAt)
|
|
884
884
|
})
|
|
885
885
|
|
|
886
|
-
it('Should set last updated date when saving identity', async () => {
|
|
886
|
+
it('Should set last updated date when saving identity', async (): Promise<void> => {
|
|
887
887
|
const correlationId = 'example_did'
|
|
888
888
|
const identity = {
|
|
889
889
|
alias: correlationId,
|
|
@@ -3,11 +3,11 @@ import { DataSource } from 'typeorm'
|
|
|
3
3
|
import { ContactStore } from '../contact/ContactStore'
|
|
4
4
|
import { CorrelationIdentifierEnum, DataStoreContactEntities, DataStoreMigrations, IdentityRoleEnum } from '../index'
|
|
5
5
|
|
|
6
|
-
describe('
|
|
6
|
+
describe('Contact store tests', (): void => {
|
|
7
7
|
let dbConnection: DataSource
|
|
8
8
|
let contactStore: ContactStore
|
|
9
9
|
|
|
10
|
-
beforeEach(async () => {
|
|
10
|
+
beforeEach(async (): Promise<void> => {
|
|
11
11
|
dbConnection = await new DataSource({
|
|
12
12
|
type: 'sqlite',
|
|
13
13
|
database: ':memory:',
|
|
@@ -22,11 +22,11 @@ describe('Database entities test', () => {
|
|
|
22
22
|
contactStore = new ContactStore(dbConnection)
|
|
23
23
|
})
|
|
24
24
|
|
|
25
|
-
afterEach(async () => {
|
|
25
|
+
afterEach(async (): Promise<void> => {
|
|
26
26
|
await (await dbConnection).destroy()
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
it('should get contact by id', async () => {
|
|
29
|
+
it('should get contact by id', async (): Promise<void> => {
|
|
30
30
|
const contact = {
|
|
31
31
|
name: 'test_name',
|
|
32
32
|
alias: 'test_alias',
|
|
@@ -40,13 +40,13 @@ describe('Database entities test', () => {
|
|
|
40
40
|
expect(result).toBeDefined()
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
it('should throw error when getting contact with unknown id', async () => {
|
|
43
|
+
it('should throw error when getting contact with unknown id', async (): Promise<void> => {
|
|
44
44
|
const contactId = 'unknownContactId'
|
|
45
45
|
|
|
46
46
|
await expect(contactStore.getContact({ contactId })).rejects.toThrow(`No contact found for id: ${contactId}`)
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
-
it('should get all contacts', async () => {
|
|
49
|
+
it('should get all contacts', async (): Promise<void> => {
|
|
50
50
|
const contact1 = {
|
|
51
51
|
name: 'test_name1',
|
|
52
52
|
alias: 'test_alias1',
|
|
@@ -68,7 +68,7 @@ describe('Database entities test', () => {
|
|
|
68
68
|
expect(result.length).toEqual(2)
|
|
69
69
|
})
|
|
70
70
|
|
|
71
|
-
it('should get contacts by filter', async () => {
|
|
71
|
+
it('should get contacts by filter', async (): Promise<void> => {
|
|
72
72
|
const contact = {
|
|
73
73
|
name: 'test_name',
|
|
74
74
|
alias: 'test_alias',
|
|
@@ -85,7 +85,7 @@ describe('Database entities test', () => {
|
|
|
85
85
|
expect(result.length).toEqual(1)
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
it('should get whole contacts by filter', async () => {
|
|
88
|
+
it('should get whole contacts by filter', async (): Promise<void> => {
|
|
89
89
|
const contact = {
|
|
90
90
|
name: 'test_name',
|
|
91
91
|
alias: 'test_alias',
|
|
@@ -136,7 +136,7 @@ describe('Database entities test', () => {
|
|
|
136
136
|
expect(result[0].identities.length).toEqual(3)
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
-
it('should get contacts by name', async () => {
|
|
139
|
+
it('should get contacts by name', async (): Promise<void> => {
|
|
140
140
|
const contact = {
|
|
141
141
|
name: 'test_name',
|
|
142
142
|
alias: 'test_alias',
|
|
@@ -153,7 +153,7 @@ describe('Database entities test', () => {
|
|
|
153
153
|
expect(result.length).toEqual(1)
|
|
154
154
|
})
|
|
155
155
|
|
|
156
|
-
it('should get contacts by alias', async () => {
|
|
156
|
+
it('should get contacts by alias', async (): Promise<void> => {
|
|
157
157
|
const contact = {
|
|
158
158
|
name: 'test_name',
|
|
159
159
|
alias: 'test_alias',
|
|
@@ -170,7 +170,7 @@ describe('Database entities test', () => {
|
|
|
170
170
|
expect(result.length).toEqual(1)
|
|
171
171
|
})
|
|
172
172
|
|
|
173
|
-
it('should get contacts by uri', async () => {
|
|
173
|
+
it('should get contacts by uri', async (): Promise<void> => {
|
|
174
174
|
const contact = {
|
|
175
175
|
name: 'test_name',
|
|
176
176
|
alias: 'test_alias',
|
|
@@ -187,7 +187,7 @@ describe('Database entities test', () => {
|
|
|
187
187
|
expect(result.length).toEqual(1)
|
|
188
188
|
})
|
|
189
189
|
|
|
190
|
-
it('should return no contacts if filter does not match', async () => {
|
|
190
|
+
it('should return no contacts if filter does not match', async (): Promise<void> => {
|
|
191
191
|
const args = {
|
|
192
192
|
filter: [{ name: 'no_match_contact' }, { alias: 'no_match_contact_alias' }, { uri: 'no_match_example.com' }],
|
|
193
193
|
}
|
|
@@ -196,7 +196,7 @@ describe('Database entities test', () => {
|
|
|
196
196
|
expect(result.length).toEqual(0)
|
|
197
197
|
})
|
|
198
198
|
|
|
199
|
-
it('should add contact without identities', async () => {
|
|
199
|
+
it('should add contact without identities', async (): Promise<void> => {
|
|
200
200
|
const contact = {
|
|
201
201
|
name: 'test_name',
|
|
202
202
|
alias: 'test_alias',
|
|
@@ -210,7 +210,7 @@ describe('Database entities test', () => {
|
|
|
210
210
|
expect(result.uri).toEqual(contact.uri)
|
|
211
211
|
})
|
|
212
212
|
|
|
213
|
-
it('should add contact with identities', async () => {
|
|
213
|
+
it('should add contact with identities', async (): Promise<void> => {
|
|
214
214
|
const contact = {
|
|
215
215
|
name: 'test_name',
|
|
216
216
|
alias: 'test_alias',
|
|
@@ -243,7 +243,7 @@ describe('Database entities test', () => {
|
|
|
243
243
|
expect(result.identities.length).toEqual(2)
|
|
244
244
|
})
|
|
245
245
|
|
|
246
|
-
it('should throw error when adding contact with invalid identity', async () => {
|
|
246
|
+
it('should throw error when adding contact with invalid identity', async (): Promise<void> => {
|
|
247
247
|
const contact = {
|
|
248
248
|
name: 'test_name',
|
|
249
249
|
alias: 'test_alias',
|
|
@@ -276,7 +276,7 @@ describe('Database entities test', () => {
|
|
|
276
276
|
expect(result.identities.length).toEqual(2)
|
|
277
277
|
})
|
|
278
278
|
|
|
279
|
-
it('should throw error when adding contact with duplicate name', async () => {
|
|
279
|
+
it('should throw error when adding contact with duplicate name', async (): Promise<void> => {
|
|
280
280
|
const name = 'test_name'
|
|
281
281
|
const contact1 = {
|
|
282
282
|
name,
|
|
@@ -296,7 +296,7 @@ describe('Database entities test', () => {
|
|
|
296
296
|
await expect(contactStore.addContact(contact2)).rejects.toThrow(`Duplicate names or aliases are not allowed. Name: ${name}, Alias: ${alias}`)
|
|
297
297
|
})
|
|
298
298
|
|
|
299
|
-
it('should throw error when adding contact with duplicate alias', async () => {
|
|
299
|
+
it('should throw error when adding contact with duplicate alias', async (): Promise<void> => {
|
|
300
300
|
const alias = 'test_alias'
|
|
301
301
|
const contact1 = {
|
|
302
302
|
name: 'test_name',
|
|
@@ -316,7 +316,7 @@ describe('Database entities test', () => {
|
|
|
316
316
|
await expect(contactStore.addContact(contact2)).rejects.toThrow(`Duplicate names or aliases are not allowed. Name: ${name}, Alias: ${alias}`)
|
|
317
317
|
})
|
|
318
318
|
|
|
319
|
-
it('should update contact by id', async () => {
|
|
319
|
+
it('should update contact by id', async (): Promise<void> => {
|
|
320
320
|
const contact = {
|
|
321
321
|
name: 'test_name',
|
|
322
322
|
alias: 'test_alias',
|
|
@@ -360,7 +360,7 @@ describe('Database entities test', () => {
|
|
|
360
360
|
expect(result.identities.length).toEqual(2)
|
|
361
361
|
})
|
|
362
362
|
|
|
363
|
-
it('should throw error when updating contact with unknown id', async () => {
|
|
363
|
+
it('should throw error when updating contact with unknown id', async (): Promise<void> => {
|
|
364
364
|
const contact = {
|
|
365
365
|
name: 'test_name',
|
|
366
366
|
alias: 'test_alias',
|
|
@@ -378,7 +378,7 @@ describe('Database entities test', () => {
|
|
|
378
378
|
await expect(contactStore.updateContact({ contact: updatedContact })).rejects.toThrow(`No contact found for id: ${contactId}`)
|
|
379
379
|
})
|
|
380
380
|
|
|
381
|
-
it('should get identity by id', async () => {
|
|
381
|
+
it('should get identity by id', async (): Promise<void> => {
|
|
382
382
|
const contact = {
|
|
383
383
|
name: 'test_name',
|
|
384
384
|
alias: 'test_alias',
|
|
@@ -403,7 +403,7 @@ describe('Database entities test', () => {
|
|
|
403
403
|
expect(result).toBeDefined()
|
|
404
404
|
})
|
|
405
405
|
|
|
406
|
-
it('should get holderDID identity by id', async () => {
|
|
406
|
+
it('should get holderDID identity by id', async (): Promise<void> => {
|
|
407
407
|
const contact = {
|
|
408
408
|
name: 'test_name',
|
|
409
409
|
alias: 'test_alias',
|
|
@@ -428,13 +428,13 @@ describe('Database entities test', () => {
|
|
|
428
428
|
expect(result).toBeDefined()
|
|
429
429
|
})
|
|
430
430
|
|
|
431
|
-
it('should throw error when getting identity with unknown id', async () => {
|
|
431
|
+
it('should throw error when getting identity with unknown id', async (): Promise<void> => {
|
|
432
432
|
const identityId = 'unknownIdentityId'
|
|
433
433
|
|
|
434
434
|
await expect(contactStore.getIdentity({ identityId })).rejects.toThrow(`No identity found for id: ${identityId}`)
|
|
435
435
|
})
|
|
436
436
|
|
|
437
|
-
it('should get all identities for contact', async () => {
|
|
437
|
+
it('should get all identities for contact', async (): Promise<void> => {
|
|
438
438
|
const contact = {
|
|
439
439
|
name: 'test_name',
|
|
440
440
|
alias: 'test_alias',
|
|
@@ -474,7 +474,7 @@ describe('Database entities test', () => {
|
|
|
474
474
|
expect(result.length).toEqual(2)
|
|
475
475
|
})
|
|
476
476
|
|
|
477
|
-
it('should get all identities', async () => {
|
|
477
|
+
it('should get all identities', async (): Promise<void> => {
|
|
478
478
|
const contact = {
|
|
479
479
|
name: 'test_name',
|
|
480
480
|
alias: 'test_alias',
|
|
@@ -510,7 +510,7 @@ describe('Database entities test', () => {
|
|
|
510
510
|
expect(result.length).toEqual(2)
|
|
511
511
|
})
|
|
512
512
|
|
|
513
|
-
it('should get identities by filter', async () => {
|
|
513
|
+
it('should get identities by filter', async (): Promise<void> => {
|
|
514
514
|
const contact = {
|
|
515
515
|
name: 'test_name',
|
|
516
516
|
alias: 'test_alias',
|
|
@@ -551,7 +551,7 @@ describe('Database entities test', () => {
|
|
|
551
551
|
expect(result.length).toEqual(1)
|
|
552
552
|
})
|
|
553
553
|
|
|
554
|
-
it('should get whole identities by filter', async () => {
|
|
554
|
+
it('should get whole identities by filter', async (): Promise<void> => {
|
|
555
555
|
const contact = {
|
|
556
556
|
name: 'test_name',
|
|
557
557
|
alias: 'test_alias',
|
|
@@ -592,7 +592,7 @@ describe('Database entities test', () => {
|
|
|
592
592
|
expect(result[0].metadata!.length).toEqual(2)
|
|
593
593
|
})
|
|
594
594
|
|
|
595
|
-
it('should add identity to contact', async () => {
|
|
595
|
+
it('should add identity to contact', async (): Promise<void> => {
|
|
596
596
|
const contact = {
|
|
597
597
|
name: 'test_name',
|
|
598
598
|
alias: 'test_alias',
|
|
@@ -616,13 +616,13 @@ describe('Database entities test', () => {
|
|
|
616
616
|
expect(result.identities.length).toEqual(1)
|
|
617
617
|
})
|
|
618
618
|
|
|
619
|
-
it('should throw error when removing identity with unknown id', async () => {
|
|
619
|
+
it('should throw error when removing identity with unknown id', async (): Promise<void> => {
|
|
620
620
|
const identityId = 'unknownIdentityId'
|
|
621
621
|
|
|
622
622
|
await expect(contactStore.removeIdentity({ identityId })).rejects.toThrow(`No identity found for id: ${identityId}`)
|
|
623
623
|
})
|
|
624
624
|
|
|
625
|
-
it('should throw error when adding identity with invalid identifier', async () => {
|
|
625
|
+
it('should throw error when adding identity with invalid identifier', async (): Promise<void> => {
|
|
626
626
|
const contact = {
|
|
627
627
|
name: 'test_name',
|
|
628
628
|
alias: 'test_alias',
|
|
@@ -646,7 +646,7 @@ describe('Database entities test', () => {
|
|
|
646
646
|
)
|
|
647
647
|
})
|
|
648
648
|
|
|
649
|
-
it('should throw error when updating identity with invalid identifier', async () => {
|
|
649
|
+
it('should throw error when updating identity with invalid identifier', async (): Promise<void> => {
|
|
650
650
|
const contact = {
|
|
651
651
|
name: 'test_name',
|
|
652
652
|
alias: 'test_alias',
|
|
@@ -672,7 +672,7 @@ describe('Database entities test', () => {
|
|
|
672
672
|
)
|
|
673
673
|
})
|
|
674
674
|
|
|
675
|
-
it('should update identity by id', async () => {
|
|
675
|
+
it('should update identity by id', async (): Promise<void> => {
|
|
676
676
|
const contact = {
|
|
677
677
|
name: 'test_name',
|
|
678
678
|
alias: 'test_alias',
|
|
@@ -700,7 +700,7 @@ describe('Database entities test', () => {
|
|
|
700
700
|
expect(result.identifier.correlationId).toEqual(correlationId)
|
|
701
701
|
})
|
|
702
702
|
|
|
703
|
-
it('should get aggregate of identity roles on contact', async () => {
|
|
703
|
+
it('should get aggregate of identity roles on contact', async (): Promise<void> => {
|
|
704
704
|
const contact = {
|
|
705
705
|
name: 'test_name',
|
|
706
706
|
alias: 'test_alias',
|