@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.17.bitstring.sl.24 → 0.34.1-feature.SSISDK.17.bitstring.sl.25
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/dist/index.cjs +52 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +52 -50
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/statusList/StatusListStore.ts +4 -5
- package/src/types/statusList/IAbstractStatusListStore.ts +22 -12
- package/src/types/statusList/statusList.ts +4 -4
- package/src/utils/statusList/MappingUtils.ts +48 -45
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
3
|
+
"version": "0.34.1-feature.SSISDK.17.bitstring.sl.25+6025073e",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
31
31
|
"@sphereon/ssi-sdk-ext.did-utils": "0.29.1-next.3",
|
|
32
32
|
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.29.1-next.3",
|
|
33
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
34
|
-
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
35
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.17.bitstring.sl.25+6025073e",
|
|
34
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.17.bitstring.sl.25+6025073e",
|
|
35
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.25+6025073e",
|
|
36
36
|
"@veramo/core": "4.2.0",
|
|
37
37
|
"@veramo/utils": "4.2.0",
|
|
38
38
|
"blakejs": "^1.2.1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"PostgreSQL",
|
|
66
66
|
"Contact Store"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "6025073ed82e7060f6ebfc13ed89f76451c63eb9"
|
|
69
69
|
}
|
|
@@ -62,8 +62,7 @@ export class StatusListStore implements IStatusListStore {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
const statusList = await this.getStatusList({ id: args.statusListId })
|
|
65
|
-
|
|
66
|
-
return result as IStatusListEntryEntity | IBitstringStatusListEntryEntity
|
|
65
|
+
return await (await this.getStatusListEntryRepo(statusList.type)).save(args)
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
async updateStatusListEntry(args: IAddStatusListEntryArgs): Promise<IStatusListEntryEntity | IBitstringStatusListEntryEntity> {
|
|
@@ -87,7 +86,7 @@ export class StatusListStore implements IStatusListStore {
|
|
|
87
86
|
{ ...(result ?? { statusListId: updStatusListId, statusListIndex: args.statusListIndex }), ...updatedEntry },
|
|
88
87
|
{ conflictPaths: ['statusList', 'statusListIndex'] },
|
|
89
88
|
)
|
|
90
|
-
|
|
89
|
+
debug(updateResult)
|
|
91
90
|
return (await this.getStatusListEntryByIndex({
|
|
92
91
|
...args,
|
|
93
92
|
statusListId: updStatusListId,
|
|
@@ -151,7 +150,7 @@ export class StatusListStore implements IStatusListStore {
|
|
|
151
150
|
...(args.entryCorrelationId && { correlationId: args.entryCorrelationId }),
|
|
152
151
|
credentialId,
|
|
153
152
|
}
|
|
154
|
-
|
|
153
|
+
debug(`Entries: ${JSON.stringify(await (await this.getStatusListEntryRepo(statusList.type)).find(), null, 2)}`)
|
|
155
154
|
const result = await (await this.getStatusListEntryRepo(statusList.type)).findOne({ where })
|
|
156
155
|
|
|
157
156
|
if (!result && args.errorOnNotFound) {
|
|
@@ -192,7 +191,7 @@ export class StatusListStore implements IStatusListStore {
|
|
|
192
191
|
error = true
|
|
193
192
|
}
|
|
194
193
|
if (error) {
|
|
195
|
-
console.
|
|
194
|
+
console.error(`Could not delete statusList ${args.statusListId} entry by index ${args.statusListIndex}`)
|
|
196
195
|
} else {
|
|
197
196
|
const statusList = await this.getStatusList({ id: args.statusListId })
|
|
198
197
|
const result = await (
|
|
@@ -72,17 +72,27 @@ interface IBaseStatusListArgs {
|
|
|
72
72
|
bitsPerStatus?: number
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
export type IStatusList2021Args = IBaseStatusListArgs & {
|
|
76
|
+
type: StatusListType.StatusList2021
|
|
77
|
+
indexingDirection: StatusListIndexingDirection
|
|
78
|
+
statusPurpose: StatusPurpose2021
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type IOAuthStatusListArgs = IBaseStatusListArgs & {
|
|
82
|
+
type: StatusListType.OAuthStatusList
|
|
83
|
+
bitsPerStatus: number
|
|
84
|
+
expiresAt?: Date
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type IBitstringStatusListArgs = IBaseStatusListArgs & {
|
|
88
|
+
type: StatusListType.BitstringStatusList
|
|
89
|
+
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[]
|
|
90
|
+
bitsPerStatus?: number
|
|
91
|
+
validFrom?: Date
|
|
92
|
+
validUntil?: Date
|
|
93
|
+
ttl?: number
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type IAddStatusListArgs = IStatusList2021Args | IOAuthStatusListArgs | IBitstringStatusListArgs
|
|
87
97
|
|
|
88
98
|
export type IUpdateStatusListIndexArgs = IAddStatusListArgs
|
|
@@ -36,7 +36,7 @@ export interface IOAuthStatusListEntity extends IStatusListEntity {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface IBitstringStatusListEntity extends IStatusListEntity {
|
|
39
|
-
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose
|
|
39
|
+
statusPurpose: BitstringStatusPurpose | Array<BitstringStatusPurpose>
|
|
40
40
|
bitsPerStatus?: number
|
|
41
41
|
validFrom?: Date
|
|
42
42
|
validUntil?: Date
|
|
@@ -66,12 +66,12 @@ export type BitstringStatusMessage = {
|
|
|
66
66
|
|
|
67
67
|
export interface BitstringStatusListEntryCredentialStatus extends ICredentialStatus {
|
|
68
68
|
type: 'BitstringStatusListEntry'
|
|
69
|
-
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose
|
|
69
|
+
statusPurpose: BitstringStatusPurpose | Array<BitstringStatusPurpose>
|
|
70
70
|
statusListIndex: string
|
|
71
71
|
statusListCredential: string
|
|
72
72
|
bitsPerStatus?: number
|
|
73
73
|
statusMessage?: Array<BitstringStatusMessage>
|
|
74
|
-
statusReference?: string | string
|
|
74
|
+
statusReference?: string | Array<string>
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export type BitstringStatusListArgs = {
|
|
@@ -91,5 +91,5 @@ export interface IBitstringStatusListEntryEntity {
|
|
|
91
91
|
statusPurpose: string
|
|
92
92
|
bitsPerStatus?: number
|
|
93
93
|
statusMessage?: Array<BitstringStatusMessage>
|
|
94
|
-
statusReference?: string | string
|
|
94
|
+
statusReference?: string | Array<string>
|
|
95
95
|
}
|
|
@@ -9,56 +9,59 @@ import { StatusListType } from '@sphereon/ssi-types'
|
|
|
9
9
|
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
10
10
|
|
|
11
11
|
export const statusListEntityFrom = (args: IStatusListEntity): StatusListEntity => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
switch (args.type) {
|
|
13
|
+
case StatusListType.StatusList2021: {
|
|
14
|
+
const entity = new StatusList2021Entity()
|
|
15
|
+
const sl2021 = args as IStatusList2021Entity
|
|
16
|
+
entity.indexingDirection = sl2021.indexingDirection
|
|
17
|
+
entity.statusPurpose = sl2021.statusPurpose
|
|
18
|
+
setBaseFields(entity, args)
|
|
19
|
+
Object.defineProperty(entity, 'type', {
|
|
20
|
+
value: StatusListType.StatusList2021,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
})
|
|
24
|
+
return entity
|
|
25
|
+
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
case StatusListType.OAuthStatusList: {
|
|
28
|
+
const entity = new OAuthStatusListEntity()
|
|
29
|
+
const oauthSl = args as IOAuthStatusListEntity
|
|
30
|
+
entity.bitsPerStatus = oauthSl.bitsPerStatus
|
|
31
|
+
entity.expiresAt = oauthSl.expiresAt
|
|
32
|
+
setBaseFields(entity, args)
|
|
33
|
+
Object.defineProperty(entity, 'type', {
|
|
34
|
+
value: StatusListType.OAuthStatusList,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
})
|
|
38
|
+
return entity
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
case StatusListType.BitstringStatusList: {
|
|
42
|
+
const entity = new BitstringStatusListEntity()
|
|
43
|
+
const bitstringsl = args as IBitstringStatusListEntity
|
|
44
|
+
if (!bitstringsl.bitsPerStatus) {
|
|
45
|
+
throw Error('bitsPerStatus must be set for BitstringStatusList')
|
|
46
|
+
}
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
entity.statusPurpose = bitstringsl.statusPurpose
|
|
49
|
+
entity.bitsPerStatus = bitstringsl.bitsPerStatus
|
|
50
|
+
entity.validFrom = bitstringsl.validFrom
|
|
51
|
+
entity.validUntil = bitstringsl.validUntil
|
|
52
|
+
entity.ttl = bitstringsl.ttl
|
|
53
|
+
setBaseFields(entity, args)
|
|
54
|
+
Object.defineProperty(entity, 'type', {
|
|
55
|
+
value: StatusListType.BitstringStatusList,
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
})
|
|
59
|
+
return entity
|
|
45
60
|
}
|
|
46
61
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
entity.validFrom = bitstringsl.validFrom
|
|
50
|
-
entity.validUntil = bitstringsl.validUntil
|
|
51
|
-
entity.ttl = bitstringsl.ttl
|
|
52
|
-
setBaseFields(entity, args)
|
|
53
|
-
Object.defineProperty(entity, 'type', {
|
|
54
|
-
value: StatusListType.BitstringStatusList,
|
|
55
|
-
enumerable: true,
|
|
56
|
-
configurable: true,
|
|
57
|
-
})
|
|
58
|
-
return entity
|
|
62
|
+
default:
|
|
63
|
+
throw new Error(`Invalid status list type ${args.type}`)
|
|
59
64
|
}
|
|
60
|
-
|
|
61
|
-
throw new Error(`Invalid status list type ${args.type}`)
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
export const statusListFrom = (entity: StatusListEntity): IStatusListEntity | IBitstringStatusListEntity => {
|