@sphereon/ssi-sdk.data-store 0.32.1-next.20 → 0.32.1-next.291
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/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +1 -1
- package/dist/entities/oid4vcState/Oid4vcStateEntity.d.ts +13 -0
- package/dist/entities/oid4vcState/Oid4vcStateEntity.d.ts.map +1 -0
- package/dist/entities/oid4vcState/Oid4vcStateEntity.js +57 -0
- package/dist/entities/oid4vcState/Oid4vcStateEntity.js.map +1 -0
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.d.ts +1 -0
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.d.ts.map +1 -1
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.js +8 -2
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.js.map +1 -1
- package/dist/entities/{statusList2021 → statusList}/StatusList2021EntryEntity.d.ts +4 -3
- package/dist/entities/statusList/StatusList2021EntryEntity.d.ts.map +1 -0
- package/dist/entities/{statusList2021 → statusList}/StatusList2021EntryEntity.js +11 -6
- package/dist/entities/statusList/StatusList2021EntryEntity.js.map +1 -0
- package/dist/entities/statusList/StatusListEntities.d.ts +23 -0
- package/dist/entities/statusList/StatusListEntities.d.ts.map +1 -0
- package/dist/entities/{statusList2021/StatusList2021Entity.js → statusList/StatusListEntities.js} +45 -16
- package/dist/entities/statusList/StatusListEntities.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/migrations/generic/11-FixCredentialClaimsReferenceUuid.d.ts +7 -0
- package/dist/migrations/generic/11-FixCredentialClaimsReferenceUuid.d.ts.map +1 -0
- package/dist/migrations/generic/11-FixCredentialClaimsReferenceUuid.js +80 -0
- package/dist/migrations/generic/11-FixCredentialClaimsReferenceUuid.js.map +1 -0
- package/dist/migrations/generic/4-CreateStatusList.d.ts.map +1 -1
- package/dist/migrations/generic/4-CreateStatusList.js +22 -12
- package/dist/migrations/generic/4-CreateStatusList.js.map +1 -1
- 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/1693866470001-CreateStatusList.d.ts.map +1 -1
- package/dist/migrations/postgres/1693866470001-CreateStatusList.js +40 -7
- package/dist/migrations/postgres/1693866470001-CreateStatusList.js.map +1 -1
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.d.ts.map +1 -1
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +1 -0
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js.map +1 -1
- package/dist/migrations/postgres/1737110469001-UpdateStatusList.d.ts +7 -0
- package/dist/migrations/postgres/1737110469001-UpdateStatusList.d.ts.map +1 -0
- package/dist/migrations/postgres/1737110469001-UpdateStatusList.js +39 -0
- package/dist/migrations/postgres/1737110469001-UpdateStatusList.js.map +1 -0
- package/dist/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.d.ts +7 -0
- package/dist/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.d.ts.map +1 -0
- package/dist/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.js +37 -0
- package/dist/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.js.map +1 -0
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.d.ts.map +1 -1
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.js +45 -5
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.js.map +1 -1
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.d.ts.map +1 -1
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +1 -0
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js.map +1 -1
- package/dist/migrations/sqlite/1737110469000-UpdateStatusList.d.ts +7 -0
- package/dist/migrations/sqlite/1737110469000-UpdateStatusList.d.ts.map +1 -0
- package/dist/migrations/sqlite/1737110469000-UpdateStatusList.js +96 -0
- package/dist/migrations/sqlite/1737110469000-UpdateStatusList.js.map +1 -0
- package/dist/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.d.ts +7 -0
- package/dist/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.d.ts.map +1 -0
- package/dist/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.js +80 -0
- package/dist/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.js.map +1 -0
- package/dist/statusList/IStatusListStore.d.ts +2 -2
- package/dist/statusList/IStatusListStore.d.ts.map +1 -1
- package/dist/statusList/StatusListStore.d.ts +9 -8
- package/dist/statusList/StatusListStore.d.ts.map +1 -1
- package/dist/statusList/StatusListStore.js +72 -42
- package/dist/statusList/StatusListStore.js.map +1 -1
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts +2 -2
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts.map +1 -1
- package/dist/types/presentationDefinition/presentationDefinition.d.ts +3 -1
- package/dist/types/presentationDefinition/presentationDefinition.d.ts.map +1 -1
- package/dist/types/statusList/IAbstractStatusListStore.d.ts +5 -4
- package/dist/types/statusList/IAbstractStatusListStore.d.ts.map +1 -1
- package/dist/types/statusList/statusList.d.ts +13 -7
- package/dist/types/statusList/statusList.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +7 -6
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.d.ts.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.js +2 -0
- package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
- package/dist/utils/statusList/MappingUtils.d.ts +5 -0
- package/dist/utils/statusList/MappingUtils.d.ts.map +1 -0
- package/dist/utils/statusList/MappingUtils.js +69 -0
- package/dist/utils/statusList/MappingUtils.js.map +1 -0
- package/package.json +9 -8
- package/src/__tests__/digitalCredential.entities.test.ts +2 -2
- package/src/__tests__/digitalCredential.store.test.ts +2 -2
- package/src/__tests__/pd-manager.entities.test.ts +77 -0
- package/src/__tests__/statusList.entities.test.ts +216 -0
- package/src/__tests__/statusList.store.test.ts +232 -0
- package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +1 -1
- package/src/entities/oid4vcState/Oid4vcStateEntity.ts +32 -0
- package/src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts +6 -2
- package/src/entities/{statusList2021 → statusList}/StatusList2021EntryEntity.ts +10 -6
- package/src/entities/{statusList2021/StatusList2021Entity.ts → statusList/StatusListEntities.ts} +38 -18
- package/src/index.ts +8 -3
- package/src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts +66 -0
- package/src/migrations/generic/4-CreateStatusList.ts +22 -12
- package/src/migrations/generic/index.ts +2 -1
- package/src/migrations/postgres/1693866470001-CreateStatusList.ts +42 -9
- package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +1 -0
- package/src/migrations/postgres/1737110469001-UpdateStatusList.ts +25 -0
- package/src/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.ts +21 -0
- package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +45 -5
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -0
- package/src/migrations/sqlite/1737110469000-UpdateStatusList.ts +94 -0
- package/src/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.ts +73 -0
- package/src/statusList/IStatusListStore.ts +2 -2
- package/src/statusList/StatusListStore.ts +94 -51
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +2 -2
- package/src/types/presentationDefinition/presentationDefinition.ts +3 -1
- package/src/types/statusList/IAbstractStatusListStore.ts +5 -4
- package/src/types/statusList/statusList.ts +24 -16
- package/src/utils/digitalCredential/MappingUtils.ts +3 -2
- package/src/utils/presentationDefinition/MappingUtils.ts +3 -0
- package/src/utils/statusList/MappingUtils.ts +82 -0
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts +0 -19
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts.map +0 -1
- package/dist/entities/statusList2021/StatusList2021Entity.js.map +0 -1
- package/dist/entities/statusList2021/StatusList2021EntryEntity.d.ts.map +0 -1
- package/dist/entities/statusList2021/StatusList2021EntryEntity.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/digitalCredential/MappingUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/digitalCredential/MappingUtils.ts"],"names":[],"mappings":";;;AAyCA,sBAEC;AAED,4CAYC;AAED,8CAgBC;AA3ED,mDAS4B;AAC5B,yCAAgD;AAEhD,uCAOoB;AACpB,wDAA6D;AAC7D,yDAAsD;AAEtD,SAAS,qBAAqB,CAAC,GAAW;IACxC,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;IACzC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,MAAM,QAAQ,GAAG,4BAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;IACvD,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,uBAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,4BAAgB,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;IAC1G,MAAM,cAAc,GAAG,4BAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;IAEnE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,uBAAW,CAAC,QAAQ,CAAC,GAAG,CAAC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GAAG,CAAC,kBAAkD,EAAuB,EAAE;IAChH,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,IAAA,6BAAqB,EAAC,gBAAgB,CAAC,CAAC,CAAA;AAC9F,CAAC,CAAA;AAFY,QAAA,sBAAsB,0BAElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/presentationDefinition/MappingUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wEAAwE,CAAA;AAEzH,OAAO,EAAE,sCAAsC,EAAE,iCAAiC,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"MappingUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/presentationDefinition/MappingUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wEAAwE,CAAA;AAEzH,OAAO,EAAE,sCAAsC,EAAE,iCAAiC,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAKnI,eAAO,MAAM,8BAA8B,WAAY,gCAAgC,KAAG,0BAezF,CAAA;AAED,eAAO,MAAM,oCAAoC,SAAU,sCAAsC,KAAG,gCAWnG,CAAA;AAMD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,iCAAiC,EAAE,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAgB1I"}
|
|
@@ -14,6 +14,7 @@ const presentationDefinitionItemFrom = (entity) => {
|
|
|
14
14
|
name: entity.name,
|
|
15
15
|
purpose: entity.purpose,
|
|
16
16
|
definitionPayload: JSON.parse(entity.definitionPayload),
|
|
17
|
+
dcqlPayload: JSON.parse(entity.dcqlPayload),
|
|
17
18
|
createdAt: entity.createdAt,
|
|
18
19
|
lastUpdatedAt: entity.lastUpdatedAt,
|
|
19
20
|
};
|
|
@@ -28,6 +29,7 @@ const presentationDefinitionEntityItemFrom = (item) => {
|
|
|
28
29
|
entity.name = item.name;
|
|
29
30
|
entity.purpose = item.purpose;
|
|
30
31
|
entity.definitionPayload = JSON.stringify(item.definitionPayload);
|
|
32
|
+
entity.dcqlPayload = JSON.stringify(item.dcqlPayload);
|
|
31
33
|
return entity;
|
|
32
34
|
};
|
|
33
35
|
exports.presentationDefinitionEntityItemFrom = presentationDefinitionEntityItemFrom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/presentationDefinition/MappingUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/presentationDefinition/MappingUtils.ts"],"names":[],"mappings":";;;AAyCA,sEAgBC;AAzDD,6HAAyH;AAGzH,qCAAoC;AACpC,wDAA6D;AAGtD,MAAM,8BAA8B,GAAG,CAAC,MAAwC,EAA8B,EAAE;IACrH,MAAM,MAAM,GAA+B;QACzC,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAA4B;QAClF,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAkB;QAC5D,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;KACpC,CAAA;IAED,OAAO,IAAA,0CAAwB,EAAC,MAAM,CAAC,CAAA;AACzC,CAAC,CAAA;AAfY,QAAA,8BAA8B,kCAe1C;AAEM,MAAM,oCAAoC,GAAG,CAAC,IAA4C,EAAoC,EAAE;IACrI,MAAM,MAAM,GAAG,IAAI,mEAA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,0 +1,5 @@
|
|
|
1
|
+
import { IStatusListEntity } from '../../types';
|
|
2
|
+
import { StatusListEntity } from '../../entities/statusList/StatusListEntities';
|
|
3
|
+
export declare const statusListEntityFrom: (args: IStatusListEntity) => StatusListEntity;
|
|
4
|
+
export declare const statusListFrom: (entity: StatusListEntity) => IStatusListEntity;
|
|
5
|
+
//# sourceMappingURL=MappingUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MappingUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/statusList/MappingUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC9F,OAAO,EAA+C,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAI5H,eAAO,MAAM,oBAAoB,SAAU,iBAAiB,KAAG,gBA8B9D,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,gBAAgB,KAAG,iBAsBzD,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statusListFrom = exports.statusListEntityFrom = void 0;
|
|
4
|
+
const StatusListEntities_1 = require("../../entities/statusList/StatusListEntities");
|
|
5
|
+
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
6
|
+
const FormattingUtils_1 = require("../FormattingUtils");
|
|
7
|
+
const statusListEntityFrom = (args) => {
|
|
8
|
+
if (args.type === ssi_types_1.StatusListType.StatusList2021) {
|
|
9
|
+
const entity = new StatusListEntities_1.StatusList2021Entity();
|
|
10
|
+
const sl2021 = args;
|
|
11
|
+
entity.indexingDirection = sl2021.indexingDirection;
|
|
12
|
+
entity.statusPurpose = sl2021.statusPurpose;
|
|
13
|
+
setBaseFields(entity, args);
|
|
14
|
+
Object.defineProperty(entity, 'type', {
|
|
15
|
+
value: ssi_types_1.StatusListType.StatusList2021,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
});
|
|
19
|
+
return entity;
|
|
20
|
+
}
|
|
21
|
+
if (args.type === ssi_types_1.StatusListType.OAuthStatusList) {
|
|
22
|
+
const entity = new StatusListEntities_1.OAuthStatusListEntity();
|
|
23
|
+
const oauthSl = args;
|
|
24
|
+
entity.bitsPerStatus = oauthSl.bitsPerStatus;
|
|
25
|
+
entity.expiresAt = oauthSl.expiresAt;
|
|
26
|
+
setBaseFields(entity, args);
|
|
27
|
+
Object.defineProperty(entity, 'type', {
|
|
28
|
+
value: ssi_types_1.StatusListType.OAuthStatusList,
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
});
|
|
32
|
+
return entity;
|
|
33
|
+
}
|
|
34
|
+
throw new Error(`Invalid status list type ${args.type}`);
|
|
35
|
+
};
|
|
36
|
+
exports.statusListEntityFrom = statusListEntityFrom;
|
|
37
|
+
const statusListFrom = (entity) => {
|
|
38
|
+
if (entity instanceof StatusListEntities_1.StatusList2021Entity) {
|
|
39
|
+
const result = Object.assign(Object.assign({}, getBaseFields(entity)), { type: ssi_types_1.StatusListType.StatusList2021, indexingDirection: entity.indexingDirection, statusPurpose: entity.statusPurpose });
|
|
40
|
+
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
41
|
+
}
|
|
42
|
+
if (entity instanceof StatusListEntities_1.OAuthStatusListEntity) {
|
|
43
|
+
const result = Object.assign(Object.assign({}, getBaseFields(entity)), { type: ssi_types_1.StatusListType.OAuthStatusList, bitsPerStatus: entity.bitsPerStatus, expiresAt: entity.expiresAt });
|
|
44
|
+
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`Invalid status list type ${typeof entity}`);
|
|
47
|
+
};
|
|
48
|
+
exports.statusListFrom = statusListFrom;
|
|
49
|
+
const setBaseFields = (entity, args) => {
|
|
50
|
+
entity.id = args.id;
|
|
51
|
+
entity.correlationId = args.correlationId;
|
|
52
|
+
entity.length = args.length;
|
|
53
|
+
entity.issuer = args.issuer;
|
|
54
|
+
entity.driverType = args.driverType;
|
|
55
|
+
entity.credentialIdMode = args.credentialIdMode;
|
|
56
|
+
entity.proofFormat = args.proofFormat;
|
|
57
|
+
entity.statusListCredential = args.statusListCredential;
|
|
58
|
+
};
|
|
59
|
+
const getBaseFields = (entity) => ({
|
|
60
|
+
id: entity.id,
|
|
61
|
+
correlationId: entity.correlationId,
|
|
62
|
+
length: entity.length,
|
|
63
|
+
issuer: entity.issuer,
|
|
64
|
+
driverType: entity.driverType,
|
|
65
|
+
credentialIdMode: entity.credentialIdMode,
|
|
66
|
+
proofFormat: entity.proofFormat,
|
|
67
|
+
statusListCredential: entity.statusListCredential,
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=MappingUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/statusList/MappingUtils.ts"],"names":[],"mappings":";;;AACA,qFAA4H;AAC5H,mDAAoD;AACpD,wDAA6D;AAEtD,MAAM,oBAAoB,GAAG,CAAC,IAAuB,EAAoB,EAAE;IAChF,IAAI,IAAI,CAAC,IAAI,KAAK,0BAAc,CAAC,cAAc,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,yCAAoB,EAAE,CAAA;QACzC,MAAM,MAAM,GAAG,IAA6B,CAAA;QAC5C,MAAM,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAA;QACnD,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAA;QAC3C,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAC3B,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;YACpC,KAAK,EAAE,0BAAc,CAAC,cAAc;YACpC,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;SACnB,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI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index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,17 +16,18 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
|
|
18
18
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
19
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.
|
|
20
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.
|
|
21
|
-
"@sphereon/ssi-sdk.agent-config": "0.32.1-next.
|
|
22
|
-
"@sphereon/ssi-sdk.core": "0.32.1-next.
|
|
23
|
-
"@sphereon/ssi-types": "0.32.1-next.
|
|
19
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.28.0",
|
|
20
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.0",
|
|
21
|
+
"@sphereon/ssi-sdk.agent-config": "0.32.1-next.291+bef8bb12",
|
|
22
|
+
"@sphereon/ssi-sdk.core": "0.32.1-next.291+bef8bb12",
|
|
23
|
+
"@sphereon/ssi-types": "0.32.1-next.291+bef8bb12",
|
|
24
24
|
"@veramo/core": "4.2.0",
|
|
25
25
|
"@veramo/utils": "4.2.0",
|
|
26
26
|
"blakejs": "^1.2.1",
|
|
27
27
|
"class-validator": "^0.14.1",
|
|
28
|
+
"dcql": "0.2.19",
|
|
28
29
|
"debug": "^4.3.5",
|
|
29
|
-
"typeorm": "^0.3.
|
|
30
|
+
"typeorm": "^0.3.21"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/sha.js": "^2.4.4",
|
|
@@ -53,5 +54,5 @@
|
|
|
53
54
|
"Contact Store"
|
|
54
55
|
],
|
|
55
56
|
"nx": {},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bef8bb123f197ecb66da7edff9d2cb55492af7ef"
|
|
57
58
|
}
|
|
@@ -5,8 +5,8 @@ import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
|
5
5
|
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
6
6
|
import { computeEntryHash } from '@veramo/utils'
|
|
7
7
|
import { nonPersistedDigitalCredentialEntityFromAddArgs } from '../utils/digitalCredential/MappingUtils'
|
|
8
|
-
import { createHash } from 'crypto'
|
|
9
8
|
import { AddCredentialArgs, CredentialCorrelationType, CredentialDocumentFormat, DocumentType, NonPersistedDigitalCredential } from '../types'
|
|
9
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
10
10
|
|
|
11
11
|
describe('Database entities tests', (): void => {
|
|
12
12
|
let dbConnection: DataSource
|
|
@@ -257,7 +257,7 @@ describe('Database entities tests', (): void => {
|
|
|
257
257
|
credentialRole: CredentialRole.VERIFIER,
|
|
258
258
|
tenantId: 'urn:uuid:nnag4b43-1e7a-98f8-a32c-a48dbc5b10mj',
|
|
259
259
|
opts: {
|
|
260
|
-
hasher:
|
|
260
|
+
hasher: defaultHasher,
|
|
261
261
|
},
|
|
262
262
|
})
|
|
263
263
|
expect(digitalCredential.documentType).toEqual(DocumentType.VC)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { IVerifiablePresentation } from '@sphereon/ssi-types'
|
|
3
|
-
import { createHash } from 'crypto'
|
|
4
3
|
import { DataSource } from 'typeorm'
|
|
5
4
|
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
6
5
|
import { CredentialRole, DataStoreDigitalCredentialEntities } from '../index'
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
GetCredentialsArgs,
|
|
16
15
|
GetCredentialsResponse,
|
|
17
16
|
} from '../types'
|
|
17
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
18
18
|
|
|
19
19
|
describe('Database entities tests', (): void => {
|
|
20
20
|
let dbConnection: DataSource
|
|
@@ -188,7 +188,7 @@ describe('Database entities tests', (): void => {
|
|
|
188
188
|
credentialRole: CredentialRole.VERIFIER,
|
|
189
189
|
tenantId: 'urn:uuid:nnag4b43-1e7a-98f8-a32c-a48dbc5b10mj',
|
|
190
190
|
opts: {
|
|
191
|
-
hasher:
|
|
191
|
+
hasher: defaultHasher,
|
|
192
192
|
},
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -24,6 +24,83 @@ describe('PresentationDefinitionItemEntity tests', (): void => {
|
|
|
24
24
|
await dbConnection.destroy()
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
+
it('should create and retrieve PresentationDefinitionItemEntity with dcqlPayload', async (): Promise<void> => {
|
|
28
|
+
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
29
|
+
const entity = new PresentationDefinitionItemEntity()
|
|
30
|
+
entity.definitionId = 'definition1'
|
|
31
|
+
entity.version = '1.0'
|
|
32
|
+
entity.definitionPayload = JSON.stringify({ id: 'definition1', input_descriptors: [] })
|
|
33
|
+
entity.dcqlPayload = JSON.stringify({
|
|
34
|
+
credentials: [
|
|
35
|
+
{
|
|
36
|
+
id: 'credential1',
|
|
37
|
+
format: 'jwt_vc',
|
|
38
|
+
claims: [
|
|
39
|
+
{
|
|
40
|
+
namespace: 'test',
|
|
41
|
+
claim_name: 'testClaim',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const savedEntity = await repository.save(entity)
|
|
49
|
+
expect(savedEntity).toBeDefined()
|
|
50
|
+
expect(savedEntity.id).toBeDefined()
|
|
51
|
+
expect(savedEntity.dcqlPayload).toBeDefined()
|
|
52
|
+
|
|
53
|
+
const retrievedEntity = await repository.findOneBy({ id: savedEntity.id })
|
|
54
|
+
expect(retrievedEntity).toBeDefined()
|
|
55
|
+
expect(retrievedEntity!.dcqlPayload).toBeDefined()
|
|
56
|
+
const parsedDcql = JSON.parse(retrievedEntity!.dcqlPayload)
|
|
57
|
+
expect(parsedDcql.credentials[0].id).toEqual('credential1')
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('should update PresentationDefinitionItemEntity dcqlPayload', async (): Promise<void> => {
|
|
61
|
+
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
62
|
+
const entity = new PresentationDefinitionItemEntity()
|
|
63
|
+
entity.definitionId = 'definition1'
|
|
64
|
+
entity.version = '1.0'
|
|
65
|
+
entity.definitionPayload = JSON.stringify({ id: 'definition1', input_descriptors: [] })
|
|
66
|
+
entity.dcqlPayload = JSON.stringify({
|
|
67
|
+
credentials: [
|
|
68
|
+
{
|
|
69
|
+
id: 'credential1',
|
|
70
|
+
format: 'jwt_vc',
|
|
71
|
+
claims: [
|
|
72
|
+
{
|
|
73
|
+
namespace: 'test',
|
|
74
|
+
claim_name: 'testClaim',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const savedEntity = await repository.save(entity)
|
|
82
|
+
expect(savedEntity).toBeDefined()
|
|
83
|
+
|
|
84
|
+
const updatedDcql = {
|
|
85
|
+
credentials: [
|
|
86
|
+
{
|
|
87
|
+
id: 'credential2',
|
|
88
|
+
format: 'jwt_vc',
|
|
89
|
+
claims: [
|
|
90
|
+
{
|
|
91
|
+
namespace: 'test',
|
|
92
|
+
claim_name: 'updatedClaim',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
}
|
|
98
|
+
savedEntity.dcqlPayload = JSON.stringify(updatedDcql)
|
|
99
|
+
const updatedEntity = await repository.save(savedEntity)
|
|
100
|
+
expect(updatedEntity).toBeDefined()
|
|
101
|
+
expect(JSON.parse(updatedEntity.dcqlPayload).credentials[0].id).toEqual('credential2')
|
|
102
|
+
})
|
|
103
|
+
|
|
27
104
|
it('should create and retrieve PresentationDefinitionItemEntity', async (): Promise<void> => {
|
|
28
105
|
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
29
106
|
const entity = new PresentationDefinitionItemEntity()
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm'
|
|
2
|
+
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
3
|
+
import { DataStoreStatusListEntities, StatusListEntryEntity } from '../index'
|
|
4
|
+
import { DataStoreStatusListMigrations } from '../migrations'
|
|
5
|
+
import { OAuthStatusListEntity, StatusList2021Entity } from '../entities/statusList/StatusListEntities'
|
|
6
|
+
import { IIssuer, StatusListCredentialIdMode, StatusListDriverType } from '@sphereon/ssi-types'
|
|
7
|
+
|
|
8
|
+
describe('Status list entities tests', () => {
|
|
9
|
+
let dbConnection: DataSource
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
DataSources.singleInstance().defaultDbType = 'sqlite'
|
|
13
|
+
dbConnection = await new DataSource({
|
|
14
|
+
type: 'sqlite',
|
|
15
|
+
database: ':memory:',
|
|
16
|
+
migrationsRun: false,
|
|
17
|
+
migrations: DataStoreStatusListMigrations,
|
|
18
|
+
synchronize: false,
|
|
19
|
+
entities: [...DataStoreStatusListEntities],
|
|
20
|
+
}).initialize()
|
|
21
|
+
await dbConnection.runMigrations()
|
|
22
|
+
expect(await dbConnection.showMigrations()).toBeFalsy()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
afterEach(async () => {
|
|
26
|
+
await dbConnection.destroy()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('should save status list to database', async () => {
|
|
30
|
+
const statusList = new StatusList2021Entity()
|
|
31
|
+
statusList.id = 'test-list-1'
|
|
32
|
+
statusList.correlationId = 'correlation-1'
|
|
33
|
+
statusList.driverType = StatusListDriverType.AGENT_TYPEORM
|
|
34
|
+
statusList.length = 100000
|
|
35
|
+
statusList.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
|
|
36
|
+
statusList.proofFormat = 'jwt'
|
|
37
|
+
statusList.statusPurpose = 'revocation'
|
|
38
|
+
statusList.indexingDirection = 'rightToLeft'
|
|
39
|
+
statusList.issuer = 'did:example:123'
|
|
40
|
+
|
|
41
|
+
const fromDb = await dbConnection.getRepository(StatusList2021Entity).save(statusList)
|
|
42
|
+
expect(fromDb).toBeDefined()
|
|
43
|
+
expect(fromDb.id).toEqual(statusList.id)
|
|
44
|
+
expect(fromDb.correlationId).toEqual(statusList.correlationId)
|
|
45
|
+
expect(fromDb.length).toEqual(statusList.length)
|
|
46
|
+
expect(fromDb.credentialIdMode).toEqual(statusList.credentialIdMode)
|
|
47
|
+
expect(fromDb.statusPurpose).toEqual(statusList.statusPurpose)
|
|
48
|
+
expect(fromDb.indexingDirection).toEqual(statusList.indexingDirection)
|
|
49
|
+
expect(fromDb.issuer).toEqual(statusList.issuer)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('should save status list entry to database', async () => {
|
|
53
|
+
const statusList = new StatusList2021Entity()
|
|
54
|
+
statusList.id = 'test-list-1'
|
|
55
|
+
statusList.correlationId = 'correlation-1'
|
|
56
|
+
statusList.driverType = StatusListDriverType.AGENT_TYPEORM
|
|
57
|
+
statusList.length = 100000
|
|
58
|
+
statusList.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
|
|
59
|
+
statusList.proofFormat = 'jwt'
|
|
60
|
+
statusList.statusPurpose = 'revocation'
|
|
61
|
+
statusList.indexingDirection = 'rightToLeft'
|
|
62
|
+
statusList.issuer = 'did:example:123'
|
|
63
|
+
|
|
64
|
+
await dbConnection.getRepository(StatusList2021Entity).save(statusList)
|
|
65
|
+
|
|
66
|
+
const entry = new StatusListEntryEntity()
|
|
67
|
+
entry.statusList = statusList
|
|
68
|
+
entry.statusListIndex = 1
|
|
69
|
+
entry.credentialId = 'credential-1'
|
|
70
|
+
entry.credentialHash = 'hash-1'
|
|
71
|
+
entry.statusList.correlationId = 'correlation-1'
|
|
72
|
+
entry.value = '1'
|
|
73
|
+
|
|
74
|
+
const fromDb = await dbConnection.getRepository(StatusListEntryEntity).save(entry)
|
|
75
|
+
expect(fromDb).toBeDefined()
|
|
76
|
+
expect(fromDb.statusListIndex).toEqual(entry.statusListIndex)
|
|
77
|
+
expect(fromDb.credentialId).toEqual(entry.credentialId)
|
|
78
|
+
expect(fromDb.credentialHash).toEqual(entry.credentialHash)
|
|
79
|
+
expect(fromDb.statusList.correlationId).toEqual(entry.statusList.correlationId)
|
|
80
|
+
expect(fromDb.value).toEqual(entry.value)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('should handle complex issuer object', async () => {
|
|
84
|
+
const statusList = new StatusList2021Entity()
|
|
85
|
+
statusList.id = 'test-list-1'
|
|
86
|
+
statusList.correlationId = 'correlation-1'
|
|
87
|
+
statusList.driverType = StatusListDriverType.AGENT_TYPEORM
|
|
88
|
+
statusList.length = 100000
|
|
89
|
+
statusList.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
|
|
90
|
+
statusList.proofFormat = 'jwt'
|
|
91
|
+
statusList.statusPurpose = 'revocation'
|
|
92
|
+
statusList.indexingDirection = 'rightToLeft'
|
|
93
|
+
statusList.issuer = { id: 'did:example:123', name: 'Test Issuer' }
|
|
94
|
+
|
|
95
|
+
const fromDb = await dbConnection.getRepository(StatusList2021Entity).save(statusList)
|
|
96
|
+
expect(fromDb).toBeDefined()
|
|
97
|
+
expect(fromDb.issuer).toEqual(statusList.issuer)
|
|
98
|
+
expect(typeof fromDb.issuer).toEqual('object')
|
|
99
|
+
expect((fromDb.issuer as IIssuer).id).toEqual('did:example:123')
|
|
100
|
+
expect((fromDb.issuer as IIssuer).name).toEqual('Test Issuer')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it('should save OAuth status list to database', async () => {
|
|
104
|
+
const statusList = new OAuthStatusListEntity()
|
|
105
|
+
statusList.id = 'oauth-list-1'
|
|
106
|
+
statusList.correlationId = 'correlation-oauth-1'
|
|
107
|
+
statusList.driverType = StatusListDriverType.AGENT_TYPEORM
|
|
108
|
+
statusList.length = 100000
|
|
109
|
+
statusList.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
|
|
110
|
+
statusList.proofFormat = 'jwt'
|
|
111
|
+
statusList.bitsPerStatus = 1
|
|
112
|
+
statusList.expiresAt = new Date('2025-01-01T00:00:00Z')
|
|
113
|
+
statusList.issuer = 'did:example:123'
|
|
114
|
+
|
|
115
|
+
const fromDb = await dbConnection.getRepository(OAuthStatusListEntity).save(statusList)
|
|
116
|
+
expect(fromDb).toBeDefined()
|
|
117
|
+
expect(fromDb.id).toEqual(statusList.id)
|
|
118
|
+
expect(fromDb.correlationId).toEqual(statusList.correlationId)
|
|
119
|
+
expect(fromDb.length).toEqual(statusList.length)
|
|
120
|
+
expect(fromDb.credentialIdMode).toEqual(statusList.credentialIdMode)
|
|
121
|
+
expect(fromDb.bitsPerStatus).toEqual(statusList.bitsPerStatus)
|
|
122
|
+
expect(fromDb.expiresAt).toEqual(statusList.expiresAt)
|
|
123
|
+
expect(fromDb.issuer).toEqual(statusList.issuer)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it('should handle both status list types having entries', async () => {
|
|
127
|
+
const statusList2021 = new StatusList2021Entity()
|
|
128
|
+
statusList2021.id = 'test-list-1'
|
|
129
|
+
statusList2021.correlationId = 'correlation-1'
|
|
130
|
+
statusList2021.driverType = StatusListDriverType.AGENT_TYPEORM
|
|
131
|
+
statusList2021.length = 100000
|
|
132
|
+
statusList2021.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
|
|
133
|
+
statusList2021.proofFormat = 'jwt'
|
|
134
|
+
statusList2021.statusPurpose = 'revocation'
|
|
135
|
+
statusList2021.indexingDirection = 'rightToLeft'
|
|
136
|
+
statusList2021.issuer = 'did:example:123'
|
|
137
|
+
await dbConnection.getRepository(StatusList2021Entity).save(statusList2021)
|
|
138
|
+
|
|
139
|
+
const oauthStatusList = new OAuthStatusListEntity()
|
|
140
|
+
oauthStatusList.id = 'oauth-list-1'
|
|
141
|
+
oauthStatusList.correlationId = 'correlation-oauth-1'
|
|
142
|
+
oauthStatusList.driverType = StatusListDriverType.AGENT_TYPEORM
|
|
143
|
+
oauthStatusList.length = 100000
|
|
144
|
+
oauthStatusList.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
|
|
145
|
+
oauthStatusList.proofFormat = 'jwt'
|
|
146
|
+
oauthStatusList.bitsPerStatus = 1
|
|
147
|
+
oauthStatusList.issuer = 'did:example:456'
|
|
148
|
+
await dbConnection.getRepository(OAuthStatusListEntity).save(oauthStatusList)
|
|
149
|
+
|
|
150
|
+
const entry2021 = new StatusListEntryEntity()
|
|
151
|
+
entry2021.statusList = statusList2021
|
|
152
|
+
entry2021.statusListIndex = 1
|
|
153
|
+
entry2021.credentialId = 'credential-1'
|
|
154
|
+
entry2021.credentialHash = 'hash-1'
|
|
155
|
+
entry2021.value = '1'
|
|
156
|
+
await dbConnection.getRepository(StatusListEntryEntity).save(entry2021)
|
|
157
|
+
|
|
158
|
+
const entryOAuth = new StatusListEntryEntity()
|
|
159
|
+
entryOAuth.statusList = oauthStatusList
|
|
160
|
+
entryOAuth.statusListIndex = 1
|
|
161
|
+
entryOAuth.credentialId = 'credential-2'
|
|
162
|
+
entryOAuth.credentialHash = 'hash-2'
|
|
163
|
+
entryOAuth.value = '1'
|
|
164
|
+
await dbConnection.getRepository(StatusListEntryEntity).save(entryOAuth)
|
|
165
|
+
|
|
166
|
+
const found2021Entry = await dbConnection.getRepository(StatusListEntryEntity).findOne({
|
|
167
|
+
where: { statusList: { id: statusList2021.id }, statusListIndex: 1 },
|
|
168
|
+
relations: { statusList: true },
|
|
169
|
+
})
|
|
170
|
+
const foundOAuthEntry = await dbConnection.getRepository(StatusListEntryEntity).findOne({
|
|
171
|
+
where: { statusList: { id: oauthStatusList.id }, statusListIndex: 1 },
|
|
172
|
+
relations: { statusList: true },
|
|
173
|
+
})
|
|
174
|
+
expect(found2021Entry).toBeTruthy()
|
|
175
|
+
expect(found2021Entry?.credentialId).toEqual('credential-1')
|
|
176
|
+
expect(foundOAuthEntry).toBeTruthy()
|
|
177
|
+
expect(foundOAuthEntry?.credentialId).toEqual('credential-2')
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
it('should cascade delete entries when status list is deleted', async () => {
|
|
181
|
+
const statusList = new StatusList2021Entity()
|
|
182
|
+
statusList.id = 'test-list-1'
|
|
183
|
+
statusList.correlationId = 'correlation-1'
|
|
184
|
+
statusList.driverType = StatusListDriverType.AGENT_TYPEORM
|
|
185
|
+
statusList.length = 100000
|
|
186
|
+
statusList.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
|
|
187
|
+
statusList.proofFormat = 'jwt'
|
|
188
|
+
statusList.statusPurpose = 'revocation'
|
|
189
|
+
statusList.indexingDirection = 'rightToLeft'
|
|
190
|
+
statusList.issuer = 'did:example:123'
|
|
191
|
+
|
|
192
|
+
const savedStatusList = await dbConnection.getRepository(StatusList2021Entity).save(statusList)
|
|
193
|
+
|
|
194
|
+
const entry = new StatusListEntryEntity()
|
|
195
|
+
entry.statusList = statusList
|
|
196
|
+
entry.statusListIndex = 1
|
|
197
|
+
entry.credentialId = 'credential-1'
|
|
198
|
+
entry.credentialHash = 'hash-1'
|
|
199
|
+
entry.statusList.correlationId = 'correlation-1'
|
|
200
|
+
entry.value = '1'
|
|
201
|
+
|
|
202
|
+
await dbConnection.getRepository(StatusListEntryEntity).save(entry)
|
|
203
|
+
|
|
204
|
+
// First delete entry, otherwise constraint fails
|
|
205
|
+
await dbConnection.getRepository(StatusListEntryEntity).delete({ statusListId: savedStatusList.id })
|
|
206
|
+
await dbConnection.getRepository(StatusList2021Entity).remove(savedStatusList)
|
|
207
|
+
|
|
208
|
+
const foundEntry = await dbConnection.getRepository(StatusListEntryEntity).findOne({
|
|
209
|
+
where: {
|
|
210
|
+
statusList: statusList.id,
|
|
211
|
+
statusListIndex: entry.statusListIndex,
|
|
212
|
+
},
|
|
213
|
+
})
|
|
214
|
+
expect(foundEntry).toBeNull()
|
|
215
|
+
})
|
|
216
|
+
})
|