@sphereon/ssi-sdk.data-store 0.17.6-unstable.8 → 0.18.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/entities/eventLogger/AuditEventEntity.d.ts +27 -0
- package/dist/entities/eventLogger/AuditEventEntity.d.ts.map +1 -0
- package/dist/entities/eventLogger/AuditEventEntity.js +124 -0
- package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -0
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts +2 -2
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts.map +1 -1
- package/dist/entities/statusList2021/StatusList2021Entity.js.map +1 -1
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts +7 -0
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts.map +1 -0
- package/dist/eventLogger/AbstractEventLoggerStore.js +7 -0
- package/dist/eventLogger/AbstractEventLoggerStore.js.map +1 -0
- package/dist/eventLogger/EventLoggerStore.d.ts +13 -0
- package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -0
- package/dist/eventLogger/EventLoggerStore.js +44 -0
- package/dist/eventLogger/EventLoggerStore.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/migrations/generic/1-CreateContacts.js +2 -2
- package/dist/migrations/generic/1-CreateContacts.js.map +1 -1
- package/dist/migrations/generic/2-CreateIssuanceBranding.js +2 -2
- package/dist/migrations/generic/2-CreateIssuanceBranding.js.map +1 -1
- package/dist/migrations/generic/{2-CreateContacts.d.ts → 3-CreateContacts.d.ts} +1 -1
- package/dist/migrations/generic/{2-CreateContacts.d.ts.map → 3-CreateContacts.d.ts.map} +1 -1
- package/dist/migrations/generic/{2-CreateContacts.js → 3-CreateContacts.js} +3 -3
- package/dist/migrations/generic/{2-CreateContacts.js.map → 3-CreateContacts.js.map} +1 -1
- package/dist/migrations/generic/{3-CreateStatusList.d.ts → 4-CreateStatusList.d.ts} +1 -1
- package/dist/migrations/generic/{3-CreateStatusList.d.ts.map → 4-CreateStatusList.d.ts.map} +1 -1
- package/dist/migrations/generic/{3-CreateStatusList.js → 4-CreateStatusList.js} +5 -5
- package/dist/migrations/generic/{3-CreateStatusList.js.map → 4-CreateStatusList.js.map} +1 -1
- package/dist/migrations/generic/5-CreateAuditEvents.d.ts +7 -0
- package/dist/migrations/generic/5-CreateAuditEvents.d.ts.map +1 -0
- package/dist/migrations/generic/5-CreateAuditEvents.js +78 -0
- package/dist/migrations/generic/5-CreateAuditEvents.js.map +1 -0
- package/dist/migrations/generic/index.d.ts +3 -1
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +13 -6
- package/dist/migrations/generic/index.js.map +1 -1
- package/dist/migrations/index.d.ts +0 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +1 -3
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/postgres/1659463079428-CreateContacts.js +2 -2
- package/dist/migrations/postgres/1659463079428-CreateContacts.js.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +2 -2
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -1
- package/dist/migrations/postgres/1690925872592-CreateContacts.js +2 -2
- package/dist/migrations/postgres/1690925872592-CreateContacts.js.map +1 -1
- package/dist/migrations/postgres/{CreateStatusList1693866470001-CreateStatusList.d.ts → 1693866470001-CreateStatusList.d.ts} +1 -1
- package/dist/migrations/postgres/1693866470001-CreateStatusList.d.ts.map +1 -0
- package/dist/migrations/postgres/{CreateStatusList1693866470001-CreateStatusList.js → 1693866470001-CreateStatusList.js} +1 -1
- package/dist/migrations/postgres/1693866470001-CreateStatusList.js.map +1 -0
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts +7 -0
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts.map +1 -0
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +43 -0
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -0
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts +7 -0
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts.map +1 -0
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +29 -0
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -0
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +10 -0
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts.map +1 -0
- package/dist/types/eventLogger/IAbstractEventLoggerStore.js +3 -0
- package/dist/types/eventLogger/IAbstractEventLoggerStore.js.map +1 -0
- package/dist/types/eventLogger/eventLogger.d.ts +3 -0
- package/dist/types/eventLogger/eventLogger.d.ts.map +1 -0
- package/dist/types/eventLogger/eventLogger.js +3 -0
- package/dist/types/eventLogger/eventLogger.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/eventLogger.entities.test.ts +73 -0
- package/src/__tests__/eventLogger.store.test.ts +136 -0
- package/src/entities/eventLogger/AuditEventEntity.ts +99 -0
- package/src/entities/statusList2021/StatusList2021Entity.ts +5 -4
- package/src/eventLogger/AbstractEventLoggerStore.ts +7 -0
- package/src/eventLogger/EventLoggerStore.ts +62 -0
- package/src/index.ts +14 -2
- package/src/migrations/generic/1-CreateContacts.ts +2 -2
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +2 -2
- package/src/migrations/generic/{2-CreateContacts.ts → 3-CreateContacts.ts} +2 -2
- package/src/migrations/generic/{3-CreateStatusList.ts → 4-CreateStatusList.ts} +3 -3
- package/src/migrations/generic/5-CreateAuditEvents.ts +66 -0
- package/src/migrations/generic/index.ts +10 -3
- package/src/migrations/index.ts +0 -1
- package/src/migrations/postgres/1659463079428-CreateContacts.ts +2 -2
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +2 -2
- package/src/migrations/postgres/1690925872592-CreateContacts.ts +2 -2
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -0
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -0
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -0
- package/src/types/eventLogger/eventLogger.ts +3 -0
- package/src/types/index.ts +2 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts.map +0 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js.map +0 -1
- package/dist/migrations/postgres/uuid.d.ts +0 -3
- package/dist/migrations/postgres/uuid.d.ts.map +0 -1
- package/dist/migrations/postgres/uuid.js +0 -25
- package/dist/migrations/postgres/uuid.js.map +0 -1
- package/src/migrations/postgres/uuid.ts +0 -12
- /package/src/migrations/postgres/{CreateStatusList1693866470001-CreateStatusList.ts → 1693866470001-CreateStatusList.ts} +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm'
|
|
2
|
+
import { DataStoreEventLoggerEntities } from '../index'
|
|
3
|
+
import { DataStoreEventLoggerMigrations } from '../migrations/generic'
|
|
4
|
+
import { ActionType, InitiatorType, LogLevel, PartyCorrelationType, SubSystem, System, SystemCorrelationIdType } from '@sphereon/ssi-sdk.core'
|
|
5
|
+
import { auditEventEntityFrom, AuditEventEntity } from '../entities/eventLogger/AuditEventEntity'
|
|
6
|
+
import { NonPersistedAuditLoggingEvent } from '../types'
|
|
7
|
+
|
|
8
|
+
describe('Database entities tests', (): void => {
|
|
9
|
+
let dbConnection: DataSource
|
|
10
|
+
|
|
11
|
+
beforeEach(async (): Promise<void> => {
|
|
12
|
+
dbConnection = await new DataSource({
|
|
13
|
+
type: 'sqlite',
|
|
14
|
+
database: ':memory:',
|
|
15
|
+
//logging: 'all',
|
|
16
|
+
migrationsRun: false,
|
|
17
|
+
migrations: DataStoreEventLoggerMigrations,
|
|
18
|
+
synchronize: false,
|
|
19
|
+
entities: [...DataStoreEventLoggerEntities],
|
|
20
|
+
}).initialize()
|
|
21
|
+
await dbConnection.runMigrations()
|
|
22
|
+
expect(await dbConnection.showMigrations()).toBeFalsy()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
afterEach(async (): Promise<void> => {
|
|
26
|
+
await (await dbConnection).destroy()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('should save audit event to database', async (): Promise<void> => {
|
|
30
|
+
const auditEvent: NonPersistedAuditLoggingEvent = {
|
|
31
|
+
timestamp: new Date(),
|
|
32
|
+
level: LogLevel.DEBUG,
|
|
33
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
34
|
+
system: System.GENERAL,
|
|
35
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
36
|
+
actionType: ActionType.CREATE,
|
|
37
|
+
actionSubType: 'Key generation',
|
|
38
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
39
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
40
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
41
|
+
systemAlias: 'test_alias',
|
|
42
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
43
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
44
|
+
partyAlias: 'test_alias',
|
|
45
|
+
description: 'test_description',
|
|
46
|
+
data: 'test_data_string',
|
|
47
|
+
diagnosticData: { data: 'test_data_string' },
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const auditEventEntity: AuditEventEntity = auditEventEntityFrom(auditEvent)
|
|
51
|
+
const fromDb: AuditEventEntity = await dbConnection.getRepository(AuditEventEntity).save(auditEventEntity)
|
|
52
|
+
|
|
53
|
+
expect(fromDb).toBeDefined()
|
|
54
|
+
expect(fromDb?.id).not.toBeNull()
|
|
55
|
+
expect(fromDb?.timestamp).toEqual(auditEvent.timestamp)
|
|
56
|
+
expect(fromDb?.level).toEqual(auditEvent.level)
|
|
57
|
+
expect(fromDb?.correlationId).toEqual(auditEvent.correlationId)
|
|
58
|
+
expect(fromDb?.system).toEqual(auditEvent.system)
|
|
59
|
+
expect(fromDb?.subSystemType).toEqual(auditEvent.subSystemType)
|
|
60
|
+
expect(fromDb?.actionType).toEqual(auditEvent.actionType)
|
|
61
|
+
expect(fromDb?.actionSubType).toEqual(auditEvent.actionSubType)
|
|
62
|
+
expect(fromDb?.initiatorType).toEqual(auditEvent.initiatorType)
|
|
63
|
+
expect(fromDb?.systemCorrelationIdType).toEqual(auditEvent.systemCorrelationIdType)
|
|
64
|
+
expect(fromDb?.systemCorrelationId).toEqual(auditEvent.systemCorrelationId)
|
|
65
|
+
expect(fromDb?.systemAlias).toEqual(auditEvent.systemAlias)
|
|
66
|
+
expect(fromDb?.partyCorrelationType).toEqual(auditEvent.partyCorrelationType)
|
|
67
|
+
expect(fromDb?.partyCorrelationId).toEqual(auditEvent.partyCorrelationId)
|
|
68
|
+
expect(fromDb?.partyAlias).toEqual(auditEvent.partyAlias)
|
|
69
|
+
expect(fromDb?.description).toEqual(auditEvent.description)
|
|
70
|
+
expect(fromDb?.data).toEqual(JSON.stringify(auditEvent.data))
|
|
71
|
+
expect(fromDb?.diagnosticData).toEqual(JSON.stringify(auditEvent.diagnosticData))
|
|
72
|
+
})
|
|
73
|
+
})
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm'
|
|
2
|
+
import { DataStoreEventLoggerMigrations } from '../migrations/generic'
|
|
3
|
+
import { DataStoreEventLoggerEntities } from '../index'
|
|
4
|
+
import {
|
|
5
|
+
ActionType,
|
|
6
|
+
AuditLoggingEvent,
|
|
7
|
+
InitiatorType,
|
|
8
|
+
LogLevel,
|
|
9
|
+
PartyCorrelationType,
|
|
10
|
+
SubSystem,
|
|
11
|
+
System,
|
|
12
|
+
SystemCorrelationIdType,
|
|
13
|
+
} from '@sphereon/ssi-sdk.core'
|
|
14
|
+
import { EventLoggerStore } from '../eventLogger/EventLoggerStore'
|
|
15
|
+
import { GetAuditEventsArgs, NonPersistedAuditLoggingEvent } from '../types'
|
|
16
|
+
|
|
17
|
+
describe('Database entities tests', (): void => {
|
|
18
|
+
let dbConnection: DataSource
|
|
19
|
+
let eventLoggerStore: EventLoggerStore
|
|
20
|
+
|
|
21
|
+
beforeEach(async (): Promise<void> => {
|
|
22
|
+
dbConnection = await new DataSource({
|
|
23
|
+
type: 'sqlite',
|
|
24
|
+
database: ':memory:',
|
|
25
|
+
//logging: 'all',
|
|
26
|
+
migrationsRun: false,
|
|
27
|
+
migrations: DataStoreEventLoggerMigrations,
|
|
28
|
+
synchronize: false,
|
|
29
|
+
entities: DataStoreEventLoggerEntities,
|
|
30
|
+
}).initialize()
|
|
31
|
+
await dbConnection.runMigrations()
|
|
32
|
+
expect(await dbConnection.showMigrations()).toBeFalsy()
|
|
33
|
+
eventLoggerStore = new EventLoggerStore(dbConnection)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
afterEach(async (): Promise<void> => {
|
|
37
|
+
await (await dbConnection).destroy()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('should store audit event', async (): Promise<void> => {
|
|
41
|
+
const auditEvent: NonPersistedAuditLoggingEvent = {
|
|
42
|
+
timestamp: new Date(),
|
|
43
|
+
level: LogLevel.DEBUG,
|
|
44
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
45
|
+
system: System.GENERAL,
|
|
46
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
47
|
+
actionType: ActionType.CREATE,
|
|
48
|
+
actionSubType: 'Key generation',
|
|
49
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
50
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
51
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
52
|
+
systemAlias: 'test_alias',
|
|
53
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
54
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
55
|
+
partyAlias: 'test_alias',
|
|
56
|
+
description: 'test_description',
|
|
57
|
+
data: 'test_data_string',
|
|
58
|
+
diagnosticData: { data: 'test_data_string' },
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const savedAuditEvent: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
62
|
+
expect(savedAuditEvent).toBeDefined()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('should get all audit events', async (): Promise<void> => {
|
|
66
|
+
const auditEvent: NonPersistedAuditLoggingEvent = {
|
|
67
|
+
timestamp: new Date(),
|
|
68
|
+
level: LogLevel.DEBUG,
|
|
69
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
70
|
+
system: System.GENERAL,
|
|
71
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
72
|
+
actionType: ActionType.CREATE,
|
|
73
|
+
actionSubType: 'Key generation',
|
|
74
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
75
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
76
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
77
|
+
systemAlias: 'test_alias',
|
|
78
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
79
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
80
|
+
partyAlias: 'test_alias',
|
|
81
|
+
description: 'test_description',
|
|
82
|
+
data: 'test_data_string',
|
|
83
|
+
diagnosticData: { data: 'test_data_string' },
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const auditEvent1: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
87
|
+
expect(auditEvent1).toBeDefined()
|
|
88
|
+
|
|
89
|
+
const auditEvent2: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
90
|
+
expect(auditEvent2).toBeDefined()
|
|
91
|
+
|
|
92
|
+
const result: Array<AuditLoggingEvent> = await eventLoggerStore.getAuditEvents()
|
|
93
|
+
expect(result.length).toEqual(2)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('should get audit events by filter', async (): Promise<void> => {
|
|
97
|
+
const auditEvent: NonPersistedAuditLoggingEvent = {
|
|
98
|
+
timestamp: new Date(),
|
|
99
|
+
level: LogLevel.DEBUG,
|
|
100
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
101
|
+
system: System.GENERAL,
|
|
102
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
103
|
+
actionType: ActionType.CREATE,
|
|
104
|
+
actionSubType: 'Key generation',
|
|
105
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
106
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
107
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
108
|
+
systemAlias: 'test_alias',
|
|
109
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
110
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
111
|
+
partyAlias: 'test_alias',
|
|
112
|
+
description: 'test_description',
|
|
113
|
+
data: 'test_data_string',
|
|
114
|
+
diagnosticData: { data: 'test_data_string' },
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const savedAuditEvent: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
118
|
+
expect(savedAuditEvent).toBeDefined()
|
|
119
|
+
|
|
120
|
+
const args: GetAuditEventsArgs = {
|
|
121
|
+
filter: [{ correlationId: auditEvent.correlationId }],
|
|
122
|
+
}
|
|
123
|
+
const result: Array<AuditLoggingEvent> = await eventLoggerStore.getAuditEvents(args)
|
|
124
|
+
|
|
125
|
+
expect(result.length).toEqual(1)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('should return no audit events if filter does not match', async (): Promise<void> => {
|
|
129
|
+
const args: GetAuditEventsArgs = {
|
|
130
|
+
filter: [{ correlationId: 'unknown_id' }],
|
|
131
|
+
}
|
|
132
|
+
const result: Array<AuditLoggingEvent> = await eventLoggerStore.getAuditEvents(args)
|
|
133
|
+
|
|
134
|
+
expect(result.length).toEqual(0)
|
|
135
|
+
})
|
|
136
|
+
})
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
|
2
|
+
import {
|
|
3
|
+
ActionType,
|
|
4
|
+
InitiatorType,
|
|
5
|
+
LogLevel,
|
|
6
|
+
PartyCorrelationType,
|
|
7
|
+
SubSystem,
|
|
8
|
+
System,
|
|
9
|
+
SystemCorrelationIdType,
|
|
10
|
+
ActionSubType,
|
|
11
|
+
} from '@sphereon/ssi-sdk.core'
|
|
12
|
+
import { NonPersistedAuditLoggingEvent } from '../../types'
|
|
13
|
+
|
|
14
|
+
@Entity('AuditEvents')
|
|
15
|
+
export class AuditEventEntity extends BaseEntity {
|
|
16
|
+
@PrimaryGeneratedColumn('uuid')
|
|
17
|
+
id!: string
|
|
18
|
+
|
|
19
|
+
@Column({ name: 'timestamp', nullable: false, unique: false })
|
|
20
|
+
timestamp!: Date
|
|
21
|
+
|
|
22
|
+
@Column('simple-enum', { name: 'level', enum: LogLevel, nullable: false, unique: false })
|
|
23
|
+
level!: LogLevel
|
|
24
|
+
|
|
25
|
+
@Column({ name: 'correlationId', nullable: false, unique: false })
|
|
26
|
+
correlationId!: string
|
|
27
|
+
|
|
28
|
+
@Column('simple-enum', { name: 'system', enum: System, nullable: false, unique: false })
|
|
29
|
+
system!: System
|
|
30
|
+
|
|
31
|
+
@Column('simple-enum', { name: 'subSystemType', enum: SubSystem, nullable: false, unique: false })
|
|
32
|
+
subSystemType!: SubSystem
|
|
33
|
+
|
|
34
|
+
@Column('simple-enum', { name: 'actionType', enum: ActionType, nullable: false, unique: false })
|
|
35
|
+
actionType!: ActionType
|
|
36
|
+
|
|
37
|
+
@Column({ name: 'actionSubType', nullable: false, unique: false })
|
|
38
|
+
actionSubType!: ActionSubType
|
|
39
|
+
|
|
40
|
+
@Column('simple-enum', { name: 'initiatorType', enum: InitiatorType, nullable: false, unique: false })
|
|
41
|
+
initiatorType!: InitiatorType
|
|
42
|
+
|
|
43
|
+
@Column('simple-enum', { name: 'systemCorrelationIdType', enum: SystemCorrelationIdType, nullable: true, unique: false })
|
|
44
|
+
systemCorrelationIdType?: SystemCorrelationIdType
|
|
45
|
+
|
|
46
|
+
@Column({ name: 'systemCorrelationId', nullable: true, unique: false })
|
|
47
|
+
systemCorrelationId?: string
|
|
48
|
+
|
|
49
|
+
@Column({ name: 'systemAlias', nullable: false, unique: false })
|
|
50
|
+
systemAlias?: string
|
|
51
|
+
|
|
52
|
+
@Column('simple-enum', { name: 'partyCorrelationType', enum: PartyCorrelationType, nullable: true, unique: false })
|
|
53
|
+
partyCorrelationType?: PartyCorrelationType
|
|
54
|
+
|
|
55
|
+
@Column({ name: 'partyCorrelationId', nullable: true, unique: false })
|
|
56
|
+
partyCorrelationId?: string
|
|
57
|
+
|
|
58
|
+
@Column({ name: 'partyAlias', nullable: true, unique: false })
|
|
59
|
+
partyAlias?: string
|
|
60
|
+
|
|
61
|
+
@Column({ name: 'description', nullable: false, unique: false })
|
|
62
|
+
description!: string
|
|
63
|
+
|
|
64
|
+
@Column({ name: 'data', nullable: true, unique: false })
|
|
65
|
+
data?: string
|
|
66
|
+
|
|
67
|
+
@Column({ name: 'diagnosticData', nullable: true, unique: false })
|
|
68
|
+
diagnosticData?: string
|
|
69
|
+
|
|
70
|
+
@CreateDateColumn({ name: 'created_at', nullable: false })
|
|
71
|
+
createdAt!: Date
|
|
72
|
+
|
|
73
|
+
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
|
|
74
|
+
lastUpdatedAt!: Date
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const auditEventEntityFrom = (args: NonPersistedAuditLoggingEvent): AuditEventEntity => {
|
|
78
|
+
const auditEventEntity: AuditEventEntity = new AuditEventEntity()
|
|
79
|
+
auditEventEntity.timestamp = args.timestamp
|
|
80
|
+
auditEventEntity.level = args.level
|
|
81
|
+
auditEventEntity.correlationId = args.correlationId
|
|
82
|
+
auditEventEntity.system = args.system
|
|
83
|
+
auditEventEntity.subSystemType = args.subSystemType
|
|
84
|
+
auditEventEntity.actionType = args.actionType
|
|
85
|
+
auditEventEntity.actionSubType = args.actionSubType
|
|
86
|
+
auditEventEntity.initiatorType = args.initiatorType
|
|
87
|
+
auditEventEntity.systemCorrelationIdType = args.systemCorrelationIdType
|
|
88
|
+
auditEventEntity.systemCorrelationId = args.systemCorrelationId
|
|
89
|
+
auditEventEntity.systemAlias = args.systemAlias
|
|
90
|
+
auditEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
91
|
+
auditEventEntity.partyCorrelationId = args.partyCorrelationId
|
|
92
|
+
auditEventEntity.partyAlias = args.partyAlias
|
|
93
|
+
auditEventEntity.description = args.description
|
|
94
|
+
auditEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
95
|
+
auditEventEntity.data = JSON.stringify(args.data)
|
|
96
|
+
auditEventEntity.diagnosticData = JSON.stringify(args.diagnosticData)
|
|
97
|
+
|
|
98
|
+
return auditEventEntity
|
|
99
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IIssuer,
|
|
3
|
-
|
|
3
|
+
JwtDecodedVerifiableCredential,
|
|
4
4
|
StatusListCredentialIdMode,
|
|
5
5
|
StatusListDriverType,
|
|
6
6
|
StatusListIndexingDirection,
|
|
7
7
|
StatusListType,
|
|
8
8
|
StatusPurpose2021,
|
|
9
|
+
W3CVerifiableCredential,
|
|
9
10
|
} from '@sphereon/ssi-types'
|
|
10
11
|
import { ProofFormat } from '@veramo/core'
|
|
11
12
|
import { BaseEntity, Column, Entity, OneToMany, PrimaryColumn, Unique } from 'typeorm'
|
|
@@ -74,13 +75,13 @@ export class StatusListEntity extends BaseEntity {
|
|
|
74
75
|
nullable: true,
|
|
75
76
|
unique: false,
|
|
76
77
|
transformer: {
|
|
77
|
-
from(value: string):
|
|
78
|
+
from(value: string): W3CVerifiableCredential | JwtDecodedVerifiableCredential {
|
|
78
79
|
if (value?.startsWith('ey')) {
|
|
79
80
|
return value
|
|
80
81
|
}
|
|
81
82
|
return JSON.parse(value)
|
|
82
83
|
},
|
|
83
|
-
to(value:
|
|
84
|
+
to(value: W3CVerifiableCredential | JwtDecodedVerifiableCredential): string {
|
|
84
85
|
if (typeof value === 'string') {
|
|
85
86
|
return value
|
|
86
87
|
}
|
|
@@ -88,7 +89,7 @@ export class StatusListEntity extends BaseEntity {
|
|
|
88
89
|
},
|
|
89
90
|
},
|
|
90
91
|
})
|
|
91
|
-
statusListCredential?:
|
|
92
|
+
statusListCredential?: W3CVerifiableCredential | JwtDecodedVerifiableCredential
|
|
92
93
|
|
|
93
94
|
@OneToMany((type) => StatusListEntryEntity, (entry) => entry.statusList)
|
|
94
95
|
statusListEntries!: StatusListEntryEntity[]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GetAuditEventsArgs, StoreAuditEventArgs } from '../types'
|
|
2
|
+
import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
3
|
+
|
|
4
|
+
export abstract class AbstractEventLoggerStore {
|
|
5
|
+
abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>
|
|
6
|
+
abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Debug, { Debugger } from 'debug'
|
|
2
|
+
import { DataSource } from 'typeorm'
|
|
3
|
+
import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
4
|
+
import { OrPromise } from '@sphereon/ssi-types'
|
|
5
|
+
import { AbstractEventLoggerStore } from './AbstractEventLoggerStore'
|
|
6
|
+
import { AuditEventEntity, auditEventEntityFrom } from '../entities/eventLogger/AuditEventEntity'
|
|
7
|
+
import { GetAuditEventsArgs, StoreAuditEventArgs } from '../types'
|
|
8
|
+
|
|
9
|
+
const debug: Debugger = Debug('sphereon:ssi-sdk:event-store')
|
|
10
|
+
|
|
11
|
+
export class EventLoggerStore extends AbstractEventLoggerStore {
|
|
12
|
+
private readonly dbConnection: OrPromise<DataSource>
|
|
13
|
+
|
|
14
|
+
constructor(dbConnection: OrPromise<DataSource>) {
|
|
15
|
+
super()
|
|
16
|
+
this.dbConnection = dbConnection
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getAuditEvents = async (args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>> => {
|
|
20
|
+
const connection: DataSource = await this.dbConnection // TODO apply everywhere
|
|
21
|
+
debug('Getting audit events', args)
|
|
22
|
+
const result: Array<AuditEventEntity> = await connection.getRepository(AuditEventEntity).find({
|
|
23
|
+
...(args?.filter && { where: args?.filter }),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return result.map((event: AuditEventEntity) => this.auditEventFrom(event))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
storeAuditEvent = async (args: StoreAuditEventArgs): Promise<AuditLoggingEvent> => {
|
|
30
|
+
const { event } = args
|
|
31
|
+
|
|
32
|
+
const auditEventEntity: AuditEventEntity = auditEventEntityFrom(event)
|
|
33
|
+
const connection: DataSource = await this.dbConnection
|
|
34
|
+
debug('Storing audit event', auditEventEntity)
|
|
35
|
+
const createdResult: AuditEventEntity = await connection.getRepository(AuditEventEntity).save(auditEventEntity)
|
|
36
|
+
|
|
37
|
+
return this.auditEventFrom(createdResult)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
|
|
41
|
+
return {
|
|
42
|
+
id: event.id,
|
|
43
|
+
description: event.description,
|
|
44
|
+
timestamp: event.timestamp,
|
|
45
|
+
level: event.level,
|
|
46
|
+
correlationId: event.correlationId,
|
|
47
|
+
actionType: event.actionType,
|
|
48
|
+
actionSubType: event.actionSubType,
|
|
49
|
+
initiatorType: event.initiatorType,
|
|
50
|
+
partyAlias: event.partyAlias,
|
|
51
|
+
partyCorrelationId: event.partyCorrelationId,
|
|
52
|
+
partyCorrelationType: event.partyCorrelationType,
|
|
53
|
+
subSystemType: event.subSystemType,
|
|
54
|
+
system: event.system,
|
|
55
|
+
systemAlias: event.systemAlias,
|
|
56
|
+
systemCorrelationId: event.systemCorrelationId,
|
|
57
|
+
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
58
|
+
...(event.data && { data: JSON.parse(event.data) }),
|
|
59
|
+
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,10 @@ export { AbstractContactStore } from './contact/AbstractContactStore'
|
|
|
29
29
|
export { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'
|
|
30
30
|
export { IssuanceBrandingStore } from './issuanceBranding/IssuanceBrandingStore'
|
|
31
31
|
export { StatusListStore } from './statusList/StatusListStore'
|
|
32
|
-
|
|
32
|
+
import { AuditEventEntity, auditEventEntityFrom } from './entities/eventLogger/AuditEventEntity'
|
|
33
|
+
export { AbstractEventLoggerStore } from './eventLogger/AbstractEventLoggerStore'
|
|
34
|
+
export { EventLoggerStore } from './eventLogger/EventLoggerStore'
|
|
35
|
+
export { DataStoreMigrations } from './migrations'
|
|
33
36
|
export * from './types'
|
|
34
37
|
export * from './utils/contact/MappingUtils'
|
|
35
38
|
|
|
@@ -64,8 +67,15 @@ export const DataStoreIssuanceBrandingEntities = [
|
|
|
64
67
|
|
|
65
68
|
export const DataStoreStatusListEntities = [StatusListEntity, StatusListEntryEntity]
|
|
66
69
|
|
|
70
|
+
export const DataStoreEventLoggerEntities = [AuditEventEntity]
|
|
71
|
+
|
|
67
72
|
// All entities combined if a party wants to enable them all at once
|
|
68
|
-
export const DataStoreEntities = [
|
|
73
|
+
export const DataStoreEntities = [
|
|
74
|
+
...DataStoreContactEntities,
|
|
75
|
+
...DataStoreIssuanceBrandingEntities,
|
|
76
|
+
...DataStoreStatusListEntities,
|
|
77
|
+
...DataStoreEventLoggerEntities,
|
|
78
|
+
]
|
|
69
79
|
|
|
70
80
|
export {
|
|
71
81
|
BaseConfigEntity,
|
|
@@ -98,4 +108,6 @@ export {
|
|
|
98
108
|
IStatusListEntryEntity,
|
|
99
109
|
StatusListEntity,
|
|
100
110
|
StatusListEntryEntity,
|
|
111
|
+
AuditEventEntity,
|
|
112
|
+
auditEventEntityFrom,
|
|
101
113
|
}
|
|
@@ -31,7 +31,7 @@ export class CreateContacts1659463079429 implements MigrationInterface {
|
|
|
31
31
|
}
|
|
32
32
|
default:
|
|
33
33
|
return Promise.reject(
|
|
34
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
34
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
35
35
|
)
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -59,7 +59,7 @@ export class CreateContacts1659463079429 implements MigrationInterface {
|
|
|
59
59
|
}
|
|
60
60
|
default:
|
|
61
61
|
return Promise.reject(
|
|
62
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
62
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
63
63
|
)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -30,7 +30,7 @@ export class CreateIssuanceBranding1659463079429 implements MigrationInterface {
|
|
|
30
30
|
}
|
|
31
31
|
default:
|
|
32
32
|
return Promise.reject(
|
|
33
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
33
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -57,7 +57,7 @@ export class CreateIssuanceBranding1659463079429 implements MigrationInterface {
|
|
|
57
57
|
}
|
|
58
58
|
default:
|
|
59
59
|
return Promise.reject(
|
|
60
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
60
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
61
61
|
)
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -31,7 +31,7 @@ export class CreateContacts1690925872318 implements MigrationInterface {
|
|
|
31
31
|
}
|
|
32
32
|
default:
|
|
33
33
|
return Promise.reject(
|
|
34
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
34
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
35
35
|
)
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -59,7 +59,7 @@ export class CreateContacts1690925872318 implements MigrationInterface {
|
|
|
59
59
|
}
|
|
60
60
|
default:
|
|
61
61
|
return Promise.reject(
|
|
62
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
62
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
63
63
|
)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Debug from 'debug'
|
|
2
2
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
-
import { CreateStatusList1693866470001 } from '../postgres/
|
|
3
|
+
import { CreateStatusList1693866470001 } from '../postgres/1693866470001-CreateStatusList'
|
|
4
4
|
import { CreateStatusList1693866470002 } from '../sqlite/1693866470000-CreateStatusList'
|
|
5
5
|
|
|
6
6
|
const debug = Debug('sphereon:ssi-sdk:migrations')
|
|
@@ -25,7 +25,7 @@ export class CreateStatusList1693866470000 implements MigrationInterface {
|
|
|
25
25
|
return up
|
|
26
26
|
} else {
|
|
27
27
|
return Promise.reject(
|
|
28
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
28
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -47,7 +47,7 @@ export class CreateStatusList1693866470000 implements MigrationInterface {
|
|
|
47
47
|
return down
|
|
48
48
|
} else {
|
|
49
49
|
return Promise.reject(
|
|
50
|
-
`Migrations are currently only supported for sqlite, react-native,
|
|
50
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
51
51
|
)
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
import Debug, { Debugger } from 'debug'
|
|
3
|
+
import { CreateAuditEvents1701634819487 } from '../sqlite/1701634819487-CreateAuditEvents'
|
|
4
|
+
import { CreateAuditEvents1701634812183 } from '../postgres/1701634812183-CreateAuditEvents'
|
|
5
|
+
|
|
6
|
+
const debug: Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
+
|
|
8
|
+
export class CreateAuditEvents1701635835330 implements MigrationInterface {
|
|
9
|
+
name: string = 'CreateAuditEvents1701635835330'
|
|
10
|
+
|
|
11
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
debug('migration: creating audit events tables')
|
|
13
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
14
|
+
|
|
15
|
+
switch (dbType) {
|
|
16
|
+
case 'postgres': {
|
|
17
|
+
debug('using postgres migration file')
|
|
18
|
+
const mig: CreateAuditEvents1701634812183 = new CreateAuditEvents1701634812183()
|
|
19
|
+
await mig.up(queryRunner)
|
|
20
|
+
debug('Migration statements executed')
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
case 'sqlite':
|
|
24
|
+
case 'expo':
|
|
25
|
+
case 'react-native': {
|
|
26
|
+
debug('using sqlite/react-native migration file')
|
|
27
|
+
const mig: CreateAuditEvents1701634819487 = new CreateAuditEvents1701634819487()
|
|
28
|
+
await mig.up(queryRunner)
|
|
29
|
+
debug('Migration statements executed')
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
return Promise.reject(
|
|
34
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
40
|
+
debug('migration: reverting audit events tables')
|
|
41
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
42
|
+
|
|
43
|
+
switch (dbType) {
|
|
44
|
+
case 'postgres': {
|
|
45
|
+
debug('using postgres migration file')
|
|
46
|
+
const mig: CreateAuditEvents1701634812183 = new CreateAuditEvents1701634812183()
|
|
47
|
+
await mig.down(queryRunner)
|
|
48
|
+
debug('Migration statements executed')
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
case 'sqlite':
|
|
52
|
+
case 'expo':
|
|
53
|
+
case 'react-native': {
|
|
54
|
+
debug('using sqlite/react-native migration file')
|
|
55
|
+
const mig: CreateAuditEvents1701634819487 = new CreateAuditEvents1701634819487()
|
|
56
|
+
await mig.down(queryRunner)
|
|
57
|
+
debug('Migration statements executed')
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
return Promise.reject(
|
|
62
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CreateContacts1659463079429 } from './1-CreateContacts'
|
|
2
|
-
import { CreateContacts1690925872318 } from './2-CreateContacts'
|
|
3
2
|
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
4
|
-
import {
|
|
3
|
+
import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
4
|
+
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
5
|
+
import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
@@ -15,6 +16,12 @@ import { CreateStatusList1693866470000 } from './3-CreateStatusList'
|
|
|
15
16
|
export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318]
|
|
16
17
|
export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429]
|
|
17
18
|
export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
|
|
19
|
+
export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
|
|
18
20
|
|
|
19
21
|
// All migrations together
|
|
20
|
-
export const DataStoreMigrations = [
|
|
22
|
+
export const DataStoreMigrations = [
|
|
23
|
+
...DataStoreContactMigrations,
|
|
24
|
+
...DataStoreIssuanceBrandingMigrations,
|
|
25
|
+
...DataStoreStatusListMigrations,
|
|
26
|
+
...DataStoreEventLoggerMigrations,
|
|
27
|
+
]
|
package/src/migrations/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
import {
|
|
2
|
+
import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
|
|
3
3
|
|
|
4
4
|
export class CreateContacts1659463079428 implements MigrationInterface {
|
|
5
5
|
name = 'CreateContacts1659463079428'
|
|
6
6
|
|
|
7
7
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
8
|
-
await
|
|
8
|
+
await enablePostgresUuidExtension(queryRunner)
|
|
9
9
|
await queryRunner.query(
|
|
10
10
|
`CREATE TABLE "BaseConfigEntity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" character varying(255), "session_id" character varying(255), "type" character varying NOT NULL, "connectionId" uuid, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"), CONSTRAINT "PK_BaseConfigEntity_id" PRIMARY KEY ("id"))`
|
|
11
11
|
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
import {
|
|
2
|
+
import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
|
|
3
3
|
|
|
4
4
|
export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
|
|
5
5
|
name = 'CreateIssuanceBranding1685628974232'
|
|
6
6
|
|
|
7
7
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
8
|
-
await
|
|
8
|
+
await enablePostgresUuidExtension(queryRunner)
|
|
9
9
|
await queryRunner.query(
|
|
10
10
|
`CREATE TABLE "ImageDimensions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "width" integer NOT NULL, "height" integer NOT NULL, CONSTRAINT "PK_ImageDimensions_id" PRIMARY KEY ("id"))`
|
|
11
11
|
)
|