@sphereon/ssi-sdk.data-store 0.17.6-unstable.8 → 0.18.1-next.2
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/ContactStore.d.ts.map +1 -1
- package/dist/contact/ContactStore.js +5 -0
- package/dist/contact/ContactStore.js.map +1 -1
- 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/1690925872693-CreateContacts.js +1 -1
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js.map +1 -1
- 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/contact/ContactStore.ts +6 -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/1690925872693-CreateContacts.ts +1 -1
- 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,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
|
)
|
|
@@ -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 CreateContacts1690925872592 implements MigrationInterface {
|
|
5
5
|
name = 'CreateContacts1690925872592'
|
|
6
6
|
|
|
7
7
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
8
|
-
await
|
|
8
|
+
await enablePostgresUuidExtension(queryRunner)
|
|
9
9
|
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`)
|
|
10
10
|
await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`)
|
|
11
11
|
await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateAuditEvents1701634812183 implements MigrationInterface {
|
|
4
|
+
name = 'CreateAuditEvents1701634812183'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3')`)
|
|
8
|
+
await queryRunner.query(
|
|
9
|
+
`CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'credentials', 'web3', 'profile', 'contact')`
|
|
10
|
+
)
|
|
11
|
+
await queryRunner.query(
|
|
12
|
+
`CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile')`
|
|
13
|
+
)
|
|
14
|
+
await queryRunner.query(`CREATE TYPE "public"."Action_type_enum" AS ENUM('create', 'read', 'update', 'delete', 'execute')`)
|
|
15
|
+
await queryRunner.query(`CREATE TYPE "public"."Initiator_type_enum" AS ENUM('user', 'system', 'external')`)
|
|
16
|
+
await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'email', 'hostname', 'phone', 'user')`)
|
|
17
|
+
await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'email', 'hostname', 'phone')`)
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`CREATE TABLE "AuditEvents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "timestamp" TIMESTAMP NOT NULL, "level" "public"."Level_enum" NOT NULL, "correlationId" TEXT NOT NULL, "system" "public"."System_enum" NOT NULL, "subSystemType" "public"."Subsystem_type_enum" NOT NULL, "actionType" "public"."Action_type_enum" NOT NULL, "actionSubType" TEXT NOT NULL, "initiatorType" "public"."Initiator_type_enum" NOT NULL, "systemCorrelationIdType" "public"."System_correlation_id_type_enum", "systemCorrelationId" TEXT, "systemAlias" TEXT NOT NULL, "partyCorrelationType" "public"."Party_correlation_type_enum", "partyCorrelationId" TEXT, "partyAlias" TEXT, "description" TEXT NOT NULL, "data" TEXT, "diagnosticData" TEXT, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
24
|
+
await queryRunner.query(`DROP TABLE "AuditEvents"`)
|
|
25
|
+
await queryRunner.query(`DROP TYPE "public"."Party_correlation_type_enum`)
|
|
26
|
+
await queryRunner.query(`DROP TYPE "public"."System_correlation_id_type_enum`)
|
|
27
|
+
await queryRunner.query(`DROP TYPE "public"."Initiator_type_enum`)
|
|
28
|
+
await queryRunner.query(`DROP TYPE "public"."Action_type_enum`)
|
|
29
|
+
await queryRunner.query(`DROP TYPE "public"."Subsystem_type_enum`)
|
|
30
|
+
await queryRunner.query(`DROP TYPE "public"."System_enum`)
|
|
31
|
+
await queryRunner.query(`DROP TYPE "public"."Level_enum`)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -141,7 +141,7 @@ export class CreateContacts1690925872693 implements MigrationInterface {
|
|
|
141
141
|
|
|
142
142
|
// migrate existing data
|
|
143
143
|
await queryRunner.query(
|
|
144
|
-
`INSERT INTO "BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "
|
|
144
|
+
`INSERT INTO "BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId" FROM "BaseConfigEntity"`
|
|
145
145
|
)
|
|
146
146
|
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
|
|
147
147
|
await queryRunner.query(
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateAuditEvents1701634819487 implements MigrationInterface {
|
|
4
|
+
name = 'CreateAuditEvents1701634819487'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "AuditEvents" ("id" varchar PRIMARY KEY NOT NULL, "timestamp" datetime NOT NULL, "level" varchar CHECK( "level" IN ('0','1','2','3') ) NOT NULL, "correlationId" varchar NOT NULL, "system" varchar CHECK( "system" IN ('general','kms','identity','oid4vci','credentials','web3','profile','contact') ) NOT NULL, "subSystemType" varchar CHECK( "subSystemType" IN ('key','did_provider','did_resolver','oid4vp_op','oid4vci_client','siopv2_op','contact_manager','vc_issuer','vc_verifier','vc_persistence','transport','profile') ) NOT NULL, "actionType" varchar CHECK( "actionType" IN ('create','read','update','delete','execute') ) NOT NULL, "actionSubType" varchar NOT NULL, "initiatorType" varchar CHECK( "initiatorType" IN ('user','system','external') ) NOT NULL, "systemCorrelationIdType" varchar CHECK( "systemCorrelationIdType" IN ('did','email','hostname','phone','user') ), "systemCorrelationId" varchar, "systemAlias" varchar NOT NULL, "partyCorrelationType" varchar CHECK( "partyCorrelationType" IN ('did','email','hostname','phone') ), "partyCorrelationId" varchar, "partyAlias" varchar, "description" varchar NOT NULL, "data" varchar, "diagnosticData" varchar, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(`DROP TABLE "AuditEvents"`)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { NonPersistedAuditLoggingEvent } from './eventLogger'
|
|
3
|
+
|
|
4
|
+
export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
|
|
5
|
+
|
|
6
|
+
export type StoreAuditEventArgs = {
|
|
7
|
+
event: NonPersistedAuditLoggingEvent
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type GetAuditEventsArgs = {
|
|
11
|
+
filter?: FindAuditLoggingEventArgs
|
|
12
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -2,7 +2,8 @@ export * from './issuanceBranding/issuanceBranding'
|
|
|
2
2
|
export * from './issuanceBranding/IAbstractIssuanceBrandingStore'
|
|
3
3
|
export * from './contact/contact'
|
|
4
4
|
export * from './contact/IAbstractContactStore'
|
|
5
|
-
|
|
6
5
|
export * from './validation/validation'
|
|
7
6
|
export * from './statusList/statusList'
|
|
8
7
|
export * from './statusList/IAbstractStatusListStore'
|
|
8
|
+
export * from './eventLogger/IAbstractEventLoggerStore'
|
|
9
|
+
export * from './eventLogger/eventLogger'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateStatusList1693866470001-CreateStatusList.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,6BAA8B,YAAW,kBAAkB;IACtE,IAAI,SAAkC;IAEzB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAC3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateStatusList1693866470001-CreateStatusList.js","sourceRoot":"","sources":["../../../src/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,6BAA6B;IAA1C;QACE,SAAI,GAAG,+BAA+B,CAAA;IAoBxC,CAAC;IAlBc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CACrB,+VAA+V,CAChW,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAA;YAChG,MAAM,WAAW,CAAC,KAAK,CACrB,4HAA4H,CAC7H,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,qGAAqG,CAAC,CAAA;YAC9H,MAAM,WAAW,CAAC,KAAK,CACrB,6tBAA6tB,CAC9tB,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,mLAAmL,CACpL,CAAA;QACH,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;8DAAkB,CAAC;KAAA;CAC9D;AArBD,sEAqBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/uuid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,wBAAsB,YAAY,CAAC,WAAW,EAAE,WAAW,iBAS1D"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.enableUuidv4 = void 0;
|
|
13
|
-
function enableUuidv4(queryRunner) {
|
|
14
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
try {
|
|
16
|
-
yield queryRunner.query(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`);
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
console.log(`Please enable the uuid-ossp.control extension in your postgresql installation. It enables generating V4 UUID and can be found in the postgresql-contrib package`);
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
exports.enableUuidv4 = enableUuidv4;
|
|
25
|
-
//# sourceMappingURL=uuid.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../src/migrations/postgres/uuid.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,SAAsB,YAAY,CAAC,WAAwB;;QACzD,IAAI;YACF,MAAM,WAAW,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAA;SACvE;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CACT,iKAAiK,CAClK,CAAA;YACD,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CAAA;AATD,oCASC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export async function enableUuidv4(queryRunner: QueryRunner) {
|
|
4
|
-
try {
|
|
5
|
-
await queryRunner.query(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`)
|
|
6
|
-
} catch (error) {
|
|
7
|
-
console.log(
|
|
8
|
-
`Please enable the uuid-ossp.control extension in your postgresql installation. It enables generating V4 UUID and can be found in the postgresql-contrib package`
|
|
9
|
-
)
|
|
10
|
-
throw error
|
|
11
|
-
}
|
|
12
|
-
}
|