@sphereon/ssi-sdk.credential-store 0.33.1-next.3 → 0.33.1-next.73
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 +2056 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{ssi-sdk.credential-store.d.ts → index.d.cts} +235 -286
- package/dist/index.d.ts +231 -8
- package/dist/index.js +2035 -34
- package/dist/index.js.map +1 -1
- package/package.json +26 -15
- package/plugin.schema.json +332 -504
- package/src/agent/CredentialStore.ts +6 -6
- package/src/index.ts +2 -2
- package/src/types/ICredentialStore.ts +7 -7
- package/src/utils/filters.ts +1 -1
- package/dist/agent/CredentialStore.d.ts +0 -45
- package/dist/agent/CredentialStore.d.ts.map +0 -1
- package/dist/agent/CredentialStore.js +0 -253
- package/dist/agent/CredentialStore.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/ICredentialStore.d.ts +0 -106
- package/dist/types/ICredentialStore.d.ts.map +0 -1
- package/dist/types/ICredentialStore.js +0 -13
- package/dist/types/ICredentialStore.js.map +0 -1
- package/dist/types/claims.d.ts +0 -43
- package/dist/types/claims.d.ts.map +0 -1
- package/dist/types/claims.js +0 -3
- package/dist/types/claims.js.map +0 -1
- package/dist/utils/filters.d.ts +0 -36
- package/dist/utils/filters.d.ts.map +0 -1
- package/dist/utils/filters.js +0 -90
- package/dist/utils/filters.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AbstractDigitalCredentialStore,
|
|
3
|
-
DigitalCredential,
|
|
4
|
-
UpdateCredentialStateArgs,
|
|
3
|
+
type DigitalCredential,
|
|
4
|
+
type UpdateCredentialStateArgs,
|
|
5
5
|
DocumentType,
|
|
6
6
|
parseRawDocument,
|
|
7
7
|
} from '@sphereon/ssi-sdk.data-store'
|
|
8
8
|
import { shaHasher as defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
9
|
-
import { IVerifiableCredential } from '@sphereon/ssi-types'
|
|
10
|
-
import { IAgentPlugin } from '@veramo/core'
|
|
9
|
+
import { type IVerifiableCredential } from '@sphereon/ssi-types'
|
|
10
|
+
import { type IAgentPlugin } from '@veramo/core'
|
|
11
11
|
import { schema, logger } from '../index'
|
|
12
12
|
import { credentialIdOrHashFilter } from '../utils/filters'
|
|
13
|
-
import {
|
|
13
|
+
import type {
|
|
14
14
|
AddCredentialArgs,
|
|
15
15
|
DeleteCredentialArgs,
|
|
16
16
|
DeleteCredentialsArgs,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
OptionalUniqueDigitalCredential,
|
|
23
23
|
UniqueDigitalCredential,
|
|
24
24
|
} from '../types/ICredentialStore'
|
|
25
|
-
import { TClaimsColumns } from '../types/claims'
|
|
25
|
+
import type { TClaimsColumns } from '../types/claims'
|
|
26
26
|
|
|
27
27
|
// Exposing the methods here for any REST implementation
|
|
28
28
|
export const credentialStoreMethods: Array<string> = [
|
package/src/index.ts
CHANGED
|
@@ -15,8 +15,8 @@ export {
|
|
|
15
15
|
CredentialCorrelationType,
|
|
16
16
|
CredentialDocumentFormat,
|
|
17
17
|
DocumentType,
|
|
18
|
-
DigitalCredential,
|
|
19
|
-
FindDigitalCredentialArgs,
|
|
18
|
+
type DigitalCredential,
|
|
19
|
+
type FindDigitalCredentialArgs,
|
|
20
20
|
} from '@sphereon/ssi-sdk.data-store'
|
|
21
21
|
export * from './types/ICredentialStore'
|
|
22
22
|
export * from './types/claims'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { contextHasPlugin } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import {
|
|
3
3
|
CredentialRole,
|
|
4
|
-
DigitalCredential,
|
|
5
|
-
FindDigitalCredentialArgs,
|
|
6
|
-
NonPersistedDigitalCredential,
|
|
7
|
-
UpdateCredentialStateArgs,
|
|
4
|
+
type DigitalCredential,
|
|
5
|
+
type FindDigitalCredentialArgs,
|
|
6
|
+
type NonPersistedDigitalCredential,
|
|
7
|
+
type UpdateCredentialStateArgs,
|
|
8
8
|
} from '@sphereon/ssi-sdk.data-store'
|
|
9
|
-
import {
|
|
9
|
+
import type {
|
|
10
10
|
HasherSync,
|
|
11
11
|
ICredential,
|
|
12
12
|
IPresentation,
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
OriginalVerifiableCredential,
|
|
16
16
|
OriginalVerifiablePresentation,
|
|
17
17
|
} from '@sphereon/ssi-types'
|
|
18
|
-
import { IAgentContext, IPluginMethodMap } from '@veramo/core'
|
|
19
|
-
import { FindClaimsArgs } from './claims'
|
|
18
|
+
import type { IAgentContext, IPluginMethodMap } from '@veramo/core'
|
|
19
|
+
import type { FindClaimsArgs } from './claims'
|
|
20
20
|
|
|
21
21
|
export type { UpdateCredentialStateArgs } // TODO create a local copy?
|
|
22
22
|
|
package/src/utils/filters.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CredentialRole, DigitalCredential, DocumentType, FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store'
|
|
1
|
+
import { CredentialRole, type DigitalCredential, DocumentType, type FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store'
|
|
2
2
|
import { validate as uuidValidate } from 'uuid'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { AbstractDigitalCredentialStore } from '@sphereon/ssi-sdk.data-store';
|
|
2
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
3
|
-
import { ICredentialStore } from '../types/ICredentialStore';
|
|
4
|
-
export declare const credentialStoreMethods: Array<string>;
|
|
5
|
-
/**
|
|
6
|
-
* {@inheritDoc ICRManager}
|
|
7
|
-
*/
|
|
8
|
-
export declare class CredentialStore implements IAgentPlugin {
|
|
9
|
-
readonly schema: any;
|
|
10
|
-
readonly methods: ICredentialStore;
|
|
11
|
-
private readonly store;
|
|
12
|
-
constructor(options: {
|
|
13
|
-
store: AbstractDigitalCredentialStore;
|
|
14
|
-
});
|
|
15
|
-
/** {@inheritDoc ICredentialStore.crsAddCredential} */
|
|
16
|
-
private crsAddCredential;
|
|
17
|
-
/** {@inheritDoc ICredentialStore.crsUpdateCredentialState} */
|
|
18
|
-
private crsUpdateCredentialState;
|
|
19
|
-
/** {@inheritDoc ICredentialStore.crsGetCredential} */
|
|
20
|
-
private crsGetCredential;
|
|
21
|
-
/** {@inheritDoc ICredentialStore.crsGetCredentials} */
|
|
22
|
-
private crsGetCredentials;
|
|
23
|
-
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentialByIdOrHash} */
|
|
24
|
-
private crsGetUniqueCredentialByIdOrHash;
|
|
25
|
-
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentials} */
|
|
26
|
-
private crsGetUniqueCredentials;
|
|
27
|
-
/** {@inheritDoc ICredentialStore.crsDeleteCredential} */
|
|
28
|
-
private crsDeleteCredential;
|
|
29
|
-
/** {@inheritDoc ICredentialStore.crsDeleteCredentials} */
|
|
30
|
-
private crsDeleteCredentials;
|
|
31
|
-
/**
|
|
32
|
-
* Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
33
|
-
* @param args
|
|
34
|
-
*/
|
|
35
|
-
private crsGetCredentialsByClaims;
|
|
36
|
-
private getValueFromCredential;
|
|
37
|
-
/**
|
|
38
|
-
* Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
39
|
-
* @param args
|
|
40
|
-
*/
|
|
41
|
-
private crsGetCredentialsByClaimsCount;
|
|
42
|
-
private secureParse;
|
|
43
|
-
private toUniqueCredentials;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=CredentialStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialStore.d.ts","sourceRoot":"","sources":["../../src/agent/CredentialStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAK/B,MAAM,8BAA8B,CAAA;AAGrC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAQL,gBAAgB,EAGjB,MAAM,2BAA2B,CAAA;AAIlC,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,MAAM,CAWhD,CAAA;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,YAAY;IAClD,QAAQ,CAAC,MAAM,MAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAWjC;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;gBAE1C,OAAO,EAAE;QAAE,KAAK,EAAE,8BAA8B,CAAA;KAAE;IAI9D,sDAAsD;YACxC,gBAAgB;IAI9B,8DAA8D;YAChD,wBAAwB;IAItC,sDAAsD;YACxC,gBAAgB;IAM9B,uDAAuD;YACzC,iBAAiB;IAO/B,sEAAsE;YACxD,gCAAgC;IAW9C,6DAA6D;YAC/C,uBAAuB;IAMrC,yDAAyD;YAC3C,mBAAmB;IAIjC,0DAA0D;YAC5C,oBAAoB;IAalC;;;OAGG;YACW,yBAAyB;IA4DvC,OAAO,CAAC,sBAAsB;IA2B9B;;;OAGG;YACW,8BAA8B;IAK5C,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,mBAAmB;CAoC5B"}
|
|
@@ -1,253 +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.CredentialStore = exports.credentialStoreMethods = void 0;
|
|
13
|
-
const ssi_sdk_data_store_1 = require("@sphereon/ssi-sdk.data-store");
|
|
14
|
-
const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
|
|
15
|
-
const index_1 = require("../index");
|
|
16
|
-
const filters_1 = require("../utils/filters");
|
|
17
|
-
// Exposing the methods here for any REST implementation
|
|
18
|
-
exports.credentialStoreMethods = [
|
|
19
|
-
'crsAddCredential',
|
|
20
|
-
'crsUpdateCredentialState',
|
|
21
|
-
'crsGetCredential',
|
|
22
|
-
'crsGetCredentials',
|
|
23
|
-
'crsDeleteCredential',
|
|
24
|
-
'crsDeleteCredentials',
|
|
25
|
-
'crsGetUniqueCredentials',
|
|
26
|
-
'crsGetUniqueCredentialByIdOrHash',
|
|
27
|
-
'crsGetCredentialsByClaims',
|
|
28
|
-
'crsGetCredentialsByClaimsCount',
|
|
29
|
-
];
|
|
30
|
-
/**
|
|
31
|
-
* {@inheritDoc ICRManager}
|
|
32
|
-
*/
|
|
33
|
-
class CredentialStore {
|
|
34
|
-
constructor(options) {
|
|
35
|
-
this.schema = index_1.schema.ICredentialStore;
|
|
36
|
-
this.methods = {
|
|
37
|
-
crsAddCredential: this.crsAddCredential.bind(this),
|
|
38
|
-
crsUpdateCredentialState: this.crsUpdateCredentialState.bind(this),
|
|
39
|
-
crsGetCredential: this.crsGetCredential.bind(this),
|
|
40
|
-
crsGetCredentials: this.crsGetCredentials.bind(this),
|
|
41
|
-
crsGetUniqueCredentialByIdOrHash: this.crsGetUniqueCredentialByIdOrHash.bind(this),
|
|
42
|
-
crsGetUniqueCredentials: this.crsGetUniqueCredentials.bind(this),
|
|
43
|
-
crsDeleteCredential: this.crsDeleteCredential.bind(this),
|
|
44
|
-
crsDeleteCredentials: this.crsDeleteCredentials.bind(this),
|
|
45
|
-
crsGetCredentialsByClaims: this.crsGetCredentialsByClaims.bind(this),
|
|
46
|
-
crsGetCredentialsByClaimsCount: this.crsGetCredentialsByClaimsCount.bind(this),
|
|
47
|
-
};
|
|
48
|
-
this.store = options.store;
|
|
49
|
-
}
|
|
50
|
-
/** {@inheritDoc ICredentialStore.crsAddCredential} */
|
|
51
|
-
crsAddCredential(args) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
return yield this.store.addCredential(Object.assign(Object.assign({}, args.credential), { opts: Object.assign(Object.assign({}, args.opts), { hasher: (_b = (_a = args.opts) === null || _a === void 0 ? void 0 : _a.hasher) !== null && _b !== void 0 ? _b : ssi_sdk_core_1.shaHasher }) }));
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/** {@inheritDoc ICredentialStore.crsUpdateCredentialState} */
|
|
58
|
-
crsUpdateCredentialState(args) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
return yield this.store.updateCredentialState(args);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/** {@inheritDoc ICredentialStore.crsGetCredential} */
|
|
64
|
-
crsGetCredential(args) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const { id } = args;
|
|
67
|
-
return this.store.getCredential({ id });
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/** {@inheritDoc ICredentialStore.crsGetCredentials} */
|
|
71
|
-
crsGetCredentials(args) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const { filter } = args;
|
|
74
|
-
const credentials = yield this.store.getCredentials({ filter });
|
|
75
|
-
return credentials.data;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentialByIdOrHash} */
|
|
79
|
-
crsGetUniqueCredentialByIdOrHash(args) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
const credentials = yield this.crsGetCredentials({ filter: (0, filters_1.credentialIdOrHashFilter)(args.credentialRole, args.idOrHash) });
|
|
82
|
-
if (credentials.length === 0) {
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
else if (credentials.length > 1) {
|
|
86
|
-
index_1.logger.warning('Duplicate credentials detected in crsGetUniqueCredentialByIdOrHash', args);
|
|
87
|
-
}
|
|
88
|
-
return this.toUniqueCredentials(credentials)[0];
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentials} */
|
|
92
|
-
crsGetUniqueCredentials(args) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const credentials = yield this.crsGetCredentials(args);
|
|
95
|
-
return this.toUniqueCredentials(credentials);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/** {@inheritDoc ICredentialStore.crsDeleteCredential} */
|
|
99
|
-
crsDeleteCredential(args) {
|
|
100
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
return this.store.removeCredential(args);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/** {@inheritDoc ICredentialStore.crsDeleteCredentials} */
|
|
105
|
-
crsDeleteCredentials(args) {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const credentials = yield this.crsGetCredentials(args);
|
|
108
|
-
let count = 0;
|
|
109
|
-
for (const credential of credentials) {
|
|
110
|
-
const result = yield this.store.removeCredential({ id: credential.id });
|
|
111
|
-
if (result) {
|
|
112
|
-
count++;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return count;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
120
|
-
* @param args
|
|
121
|
-
*/
|
|
122
|
-
crsGetCredentialsByClaims(args) {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
const digitalCredentials = yield this.crsGetUniqueCredentials({
|
|
125
|
-
filter: [
|
|
126
|
-
// TODO SDK-25 Implement param for documentType & support VP filtering below
|
|
127
|
-
{
|
|
128
|
-
documentType: ssi_sdk_data_store_1.DocumentType.VC,
|
|
129
|
-
credentialRole: args.credentialRole,
|
|
130
|
-
tenantId: args.tenantId,
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
documentType: ssi_sdk_data_store_1.DocumentType.C,
|
|
134
|
-
credentialRole: args.credentialRole,
|
|
135
|
-
tenantId: args.tenantId,
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
});
|
|
139
|
-
// This a copy of how Veramo did this. TODO Use GraphQL in the future?
|
|
140
|
-
return digitalCredentials.filter((uniqueVC) => {
|
|
141
|
-
var _a, _b;
|
|
142
|
-
if (!uniqueVC.uniformVerifiableCredential) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
const credential = uniqueVC.uniformVerifiableCredential;
|
|
146
|
-
return ((_b = (_a = args.filter.where) === null || _a === void 0 ? void 0 : _a.every((whereClause) => {
|
|
147
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
148
|
-
const value = this.getValueFromCredential(credential, whereClause.column);
|
|
149
|
-
if (value === undefined) {
|
|
150
|
-
return whereClause.op === 'IsNull';
|
|
151
|
-
}
|
|
152
|
-
switch (whereClause.op) {
|
|
153
|
-
case 'In':
|
|
154
|
-
return (_a = whereClause.value) === null || _a === void 0 ? void 0 : _a.includes(value);
|
|
155
|
-
case 'Like':
|
|
156
|
-
return typeof value === 'string' && value.includes(((_b = whereClause.value) === null || _b === void 0 ? void 0 : _b[0]) || '');
|
|
157
|
-
case 'Between':
|
|
158
|
-
return value >= (((_c = whereClause.value) === null || _c === void 0 ? void 0 : _c[0]) || '') && value <= (((_d = whereClause.value) === null || _d === void 0 ? void 0 : _d[1]) || '');
|
|
159
|
-
case 'LessThan':
|
|
160
|
-
return value < (((_e = whereClause.value) === null || _e === void 0 ? void 0 : _e[0]) || '');
|
|
161
|
-
case 'LessThanOrEqual':
|
|
162
|
-
return value <= (((_f = whereClause.value) === null || _f === void 0 ? void 0 : _f[0]) || '');
|
|
163
|
-
case 'MoreThan':
|
|
164
|
-
return value > (((_g = whereClause.value) === null || _g === void 0 ? void 0 : _g[0]) || '');
|
|
165
|
-
case 'MoreThanOrEqual':
|
|
166
|
-
return value >= (((_h = whereClause.value) === null || _h === void 0 ? void 0 : _h[0]) || '');
|
|
167
|
-
case 'Any':
|
|
168
|
-
return Array.isArray(value) && value.some((v) => { var _a; return (_a = whereClause.value) === null || _a === void 0 ? void 0 : _a.includes(v); });
|
|
169
|
-
case 'IsNull':
|
|
170
|
-
return value === null || value === undefined;
|
|
171
|
-
case 'Equal':
|
|
172
|
-
default:
|
|
173
|
-
return value === ((_j = whereClause.value) === null || _j === void 0 ? void 0 : _j[0]);
|
|
174
|
-
}
|
|
175
|
-
})) !== null && _b !== void 0 ? _b : true);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
getValueFromCredential(credential, column) {
|
|
180
|
-
var _a, _b, _c, _d;
|
|
181
|
-
switch (column) {
|
|
182
|
-
case 'context':
|
|
183
|
-
return credential['@context'];
|
|
184
|
-
case 'credentialType':
|
|
185
|
-
return credential.type;
|
|
186
|
-
case 'type':
|
|
187
|
-
return Array.isArray(credential.credentialSubject) ? (_a = credential.credentialSubject[0]) === null || _a === void 0 ? void 0 : _a.type : (_b = credential.credentialSubject) === null || _b === void 0 ? void 0 : _b.type;
|
|
188
|
-
case 'value':
|
|
189
|
-
return JSON.stringify(credential.credentialSubject);
|
|
190
|
-
case 'isObj':
|
|
191
|
-
return typeof credential.credentialSubject === 'object';
|
|
192
|
-
case 'id':
|
|
193
|
-
return credential.id;
|
|
194
|
-
case 'issuer':
|
|
195
|
-
return typeof credential.issuer === 'string' ? credential.issuer : credential.issuer.id;
|
|
196
|
-
case 'subject':
|
|
197
|
-
return Array.isArray(credential.credentialSubject) ? (_c = credential.credentialSubject[0]) === null || _c === void 0 ? void 0 : _c.id : (_d = credential.credentialSubject) === null || _d === void 0 ? void 0 : _d.id;
|
|
198
|
-
case 'expirationDate':
|
|
199
|
-
return credential.expirationDate;
|
|
200
|
-
case 'issuanceDate':
|
|
201
|
-
return credential.issuanceDate;
|
|
202
|
-
default:
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
208
|
-
* @param args
|
|
209
|
-
*/
|
|
210
|
-
crsGetCredentialsByClaimsCount(args) {
|
|
211
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
-
const credentialsByClaims = yield this.crsGetCredentialsByClaims(args);
|
|
213
|
-
return credentialsByClaims.length; // FIXME ?
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
secureParse(original) {
|
|
217
|
-
return (0, ssi_sdk_data_store_1.parseRawDocument)(original);
|
|
218
|
-
}
|
|
219
|
-
toUniqueCredentials(credentials) {
|
|
220
|
-
return Object.values(credentials.reduce((accumulator, credential) => {
|
|
221
|
-
var _a, _b, _c, _d;
|
|
222
|
-
const uniqueCredential = {
|
|
223
|
-
hash: credential.hash,
|
|
224
|
-
digitalCredential: credential,
|
|
225
|
-
};
|
|
226
|
-
switch (credential.documentType) {
|
|
227
|
-
case ssi_sdk_data_store_1.DocumentType.VC:
|
|
228
|
-
uniqueCredential.originalVerifiableCredential = this.secureParse(credential.rawDocument);
|
|
229
|
-
uniqueCredential.uniformVerifiableCredential = this.secureParse(credential.uniformDocument);
|
|
230
|
-
uniqueCredential.id = (_a = uniqueCredential.uniformVerifiableCredential) === null || _a === void 0 ? void 0 : _a.id;
|
|
231
|
-
break;
|
|
232
|
-
case ssi_sdk_data_store_1.DocumentType.VP:
|
|
233
|
-
uniqueCredential.originalVerifiablePresentation = this.secureParse(credential.rawDocument);
|
|
234
|
-
uniqueCredential.uniformVerifiablePresentation = this.secureParse(credential.uniformDocument);
|
|
235
|
-
uniqueCredential.id = (_b = uniqueCredential.uniformVerifiablePresentation) === null || _b === void 0 ? void 0 : _b.id;
|
|
236
|
-
break;
|
|
237
|
-
case ssi_sdk_data_store_1.DocumentType.P:
|
|
238
|
-
uniqueCredential.originalPresentation = this.secureParse(credential.rawDocument);
|
|
239
|
-
uniqueCredential.id = (_c = uniqueCredential.originalPresentation) === null || _c === void 0 ? void 0 : _c.id;
|
|
240
|
-
break;
|
|
241
|
-
case ssi_sdk_data_store_1.DocumentType.C:
|
|
242
|
-
uniqueCredential.originalCredential = this.secureParse(credential.rawDocument);
|
|
243
|
-
uniqueCredential.id = (_d = uniqueCredential.originalCredential) === null || _d === void 0 ? void 0 : _d.id;
|
|
244
|
-
break;
|
|
245
|
-
// TODO CBOR support
|
|
246
|
-
}
|
|
247
|
-
accumulator[credential.hash] = uniqueCredential;
|
|
248
|
-
return accumulator;
|
|
249
|
-
}, {}));
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
exports.CredentialStore = CredentialStore;
|
|
253
|
-
//# sourceMappingURL=CredentialStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialStore.js","sourceRoot":"","sources":["../../src/agent/CredentialStore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qEAMqC;AACrC,yDAAmE;AAGnE,oCAAyC;AACzC,8CAA2D;AAe3D,wDAAwD;AAC3C,QAAA,sBAAsB,GAAkB;IACnD,kBAAkB;IAClB,0BAA0B;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;IACtB,yBAAyB;IACzB,kCAAkC;IAClC,2BAA2B;IAC3B,gCAAgC;CACjC,CAAA;AAED;;GAEG;AACH,MAAa,eAAe;IAiB1B,YAAY,OAAkD;QAhBrD,WAAM,GAAG,cAAM,CAAC,gBAAgB,CAAA;QAChC,YAAO,GAAqB;YACnC,gBAAgB,EAAE,IAAI,C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,yBAAyB,CAAA;AACjF,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,8BAA8B,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.52.5"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { CredentialRole, DigitalCredential, FindDigitalCredentialArgs, NonPersistedDigitalCredential, UpdateCredentialStateArgs } from '@sphereon/ssi-sdk.data-store';
|
|
2
|
-
import { HasherSync, ICredential, IPresentation, IVerifiableCredential, IVerifiablePresentation, OriginalVerifiableCredential, OriginalVerifiablePresentation } from '@sphereon/ssi-types';
|
|
3
|
-
import { IAgentContext, IPluginMethodMap } from '@veramo/core';
|
|
4
|
-
import { FindClaimsArgs } from './claims';
|
|
5
|
-
export type { UpdateCredentialStateArgs };
|
|
6
|
-
export interface ICredentialStore extends IPluginMethodMap {
|
|
7
|
-
/**
|
|
8
|
-
* Add a new credential.
|
|
9
|
-
* @param args
|
|
10
|
-
*/
|
|
11
|
-
crsAddCredential(args: AddCredentialArgs): Promise<DigitalCredential>;
|
|
12
|
-
/**
|
|
13
|
-
* Update credential the state of an existing credential.
|
|
14
|
-
* @param args
|
|
15
|
-
*/
|
|
16
|
-
crsUpdateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>;
|
|
17
|
-
/**
|
|
18
|
-
* Get a single credentials by primary key
|
|
19
|
-
* @param args
|
|
20
|
-
*/
|
|
21
|
-
crsGetCredential(args: GetCredentialArgs): Promise<DigitalCredential>;
|
|
22
|
-
/**
|
|
23
|
-
* Find one or more credentials using filters
|
|
24
|
-
* @param args
|
|
25
|
-
*/
|
|
26
|
-
crsGetCredentials(args: GetCredentialsArgs): Promise<Array<DigitalCredential>>;
|
|
27
|
-
/**
|
|
28
|
-
* Find one or more credentials using filters
|
|
29
|
-
* @param args
|
|
30
|
-
*/
|
|
31
|
-
crsGetUniqueCredentials(args: GetCredentialsArgs): Promise<Array<UniqueDigitalCredential>>;
|
|
32
|
-
/**
|
|
33
|
-
* Find one credential by id or hash
|
|
34
|
-
* @param args
|
|
35
|
-
*/
|
|
36
|
-
crsGetUniqueCredentialByIdOrHash(args: GetCredentialsByIdOrHashArgs): Promise<OptionalUniqueDigitalCredential>;
|
|
37
|
-
/**
|
|
38
|
-
* Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
39
|
-
* @param args
|
|
40
|
-
*/
|
|
41
|
-
crsGetCredentialsByClaims(args: GetCredentialsByClaimsArgs): Promise<Array<UniqueDigitalCredential>>;
|
|
42
|
-
/**
|
|
43
|
-
* Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
44
|
-
* @param args
|
|
45
|
-
*/
|
|
46
|
-
crsGetCredentialsByClaimsCount(args: GetCredentialsByClaimsArgs): Promise<number>;
|
|
47
|
-
/**
|
|
48
|
-
* Delete a single credentials by primary key
|
|
49
|
-
* @param args
|
|
50
|
-
*/
|
|
51
|
-
crsDeleteCredential(args: DeleteCredentialArgs): Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* Delete multiple credentials records using filters
|
|
54
|
-
* @param args
|
|
55
|
-
*/
|
|
56
|
-
crsDeleteCredentials(args: DeleteCredentialsArgs): Promise<number>;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* @param context
|
|
61
|
-
* @internal
|
|
62
|
-
*/
|
|
63
|
-
export declare function contextHasCredentialStore(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ICredentialStore>;
|
|
64
|
-
export type GetCredentialArgs = {
|
|
65
|
-
id: string;
|
|
66
|
-
};
|
|
67
|
-
export type GetCredentialsArgs = {
|
|
68
|
-
filter: FindDigitalCredentialArgs;
|
|
69
|
-
};
|
|
70
|
-
export type GetCredentialsByClaimsArgs = {
|
|
71
|
-
filter: FindClaimsArgs;
|
|
72
|
-
credentialRole?: CredentialRole;
|
|
73
|
-
tenantId?: string;
|
|
74
|
-
};
|
|
75
|
-
export type GetCredentialsByIdOrHashArgs = {
|
|
76
|
-
credentialRole: CredentialRole;
|
|
77
|
-
idOrHash: string;
|
|
78
|
-
};
|
|
79
|
-
export type DeleteCredentialArgs = {
|
|
80
|
-
id: string;
|
|
81
|
-
} | {
|
|
82
|
-
hash: string;
|
|
83
|
-
};
|
|
84
|
-
export type DeleteCredentialsArgs = GetCredentialsArgs;
|
|
85
|
-
export type AddDigitalCredential = Omit<NonPersistedDigitalCredential, 'id' | 'documentType' | 'documentFormat' | 'uniformDocument' | 'hash' | 'createdAt' | 'lastUpdatedAt' | 'validFrom' | 'validUntil'>;
|
|
86
|
-
export type AddCredentialArgs = {
|
|
87
|
-
credential: AddDigitalCredential;
|
|
88
|
-
opts?: {
|
|
89
|
-
maxTimeSkewInMS?: number;
|
|
90
|
-
hasher?: HasherSync;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
export interface UniqueDigitalCredential {
|
|
94
|
-
hash: string;
|
|
95
|
-
id?: string;
|
|
96
|
-
digitalCredential: DigitalCredential;
|
|
97
|
-
originalVerifiableCredential?: OriginalVerifiableCredential;
|
|
98
|
-
originalVerifiablePresentation?: OriginalVerifiablePresentation;
|
|
99
|
-
originalCredential?: ICredential;
|
|
100
|
-
originalPresentation?: IPresentation;
|
|
101
|
-
uniformVerifiableCredential?: IVerifiableCredential;
|
|
102
|
-
uniformVerifiablePresentation?: IVerifiablePresentation;
|
|
103
|
-
}
|
|
104
|
-
export type OptionalUniqueDigitalCredential = UniqueDigitalCredential | undefined;
|
|
105
|
-
export type RequiredContext = IAgentContext<never>;
|
|
106
|
-
//# sourceMappingURL=ICredentialStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ICredentialStore.d.ts","sourceRoot":"","sources":["../../src/types/ICredentialStore.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,yBAAyB,EAC1B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC/B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,YAAY,EAAE,yBAAyB,EAAE,CAAA;AAEzC,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAErE;;;OAGG;IACH,wBAAwB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAErF;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAErE;;;OAGG;IACH,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAE9E;;;OAGG;IACH,uBAAuB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,uBAAuB,CA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AG,IAAI,CACrC,6BAA6B,EAC7B,IAAI,GAAG,cAAc,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,WAAW,GAAG,YAAY,CACnI,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,oBAAoB,CAAA;IAChC,IAAI,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,CAAA;KAAE,CAAA;CACzD,CAAA;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,iBAAiB,EAAE,iBAAiB,CAAA;IAEpC,4BAA4B,CAAC,EAAE,4BAA4B,CAAA;IAC3D,8BAA8B,CAAC,EAAE,8BAA8B,CAAA;IAC/D,kBAAkB,CAAC,EAAE,WAAW,CAAA;IAChC,oBAAoB,CAAC,EAAE,aAAa,CAAA;IACpC,2BAA2B,CAAC,EAAE,qBAAqB,CAAA;IACnD,6BAA6B,CAAC,EAAE,uBAAuB,CAAA;CACxD;AAED,MAAM,MAAM,+BAA+B,GAAG,uBAAuB,GAAG,SAAS,CAAA;AAEjF,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.contextHasCredentialStore = contextHasCredentialStore;
|
|
4
|
-
const ssi_sdk_agent_config_1 = require("@sphereon/ssi-sdk.agent-config");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param context
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
function contextHasCredentialStore(context) {
|
|
11
|
-
return (0, ssi_sdk_agent_config_1.contextHasPlugin)(context, 'crsGetCredential');
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ICredentialStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ICredentialStore.js","sourceRoot":"","sources":["../../src/types/ICredentialStore.ts"],"names":[],"mappings":";;AAyFA,8DAEC;AA3FD,yEAAiE;AAoFjE;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,OAAwC;IAChF,OAAO,IAAA,uCAAgB,EAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;AACtD,CAAC"}
|
package/dist/types/claims.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export type TClaimsColumns = 'context' | 'credentialType' | 'type' | 'value' | 'isObj' | 'id' | 'issuer' | 'subject' | 'expirationDate' | 'issuanceDate';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the sort order of results from a {@link FindArgs} query.
|
|
4
|
-
*
|
|
5
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
6
|
-
*/
|
|
7
|
-
export interface Order<TColumns> {
|
|
8
|
-
column: TColumns;
|
|
9
|
-
direction: 'ASC' | 'DESC';
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Represents a WHERE predicate for a {@link FindArgs} query.
|
|
13
|
-
* In situations where multiple WHERE predicates are present, they are combined with AND.
|
|
14
|
-
*
|
|
15
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
16
|
-
*/
|
|
17
|
-
export interface Where<TColumns> {
|
|
18
|
-
column: TColumns;
|
|
19
|
-
value?: string[];
|
|
20
|
-
not?: boolean;
|
|
21
|
-
op?: 'LessThan' | 'LessThanOrEqual' | 'MoreThan' | 'MoreThanOrEqual' | 'Equal' | 'Like' | 'Between' | 'In' | 'Any' | 'IsNull';
|
|
22
|
-
}
|
|
23
|
-
export interface FindArgs<TColumns> {
|
|
24
|
-
/**
|
|
25
|
-
* Imposes constraints on the values of the given columns.
|
|
26
|
-
* WHERE clauses are combined using AND.
|
|
27
|
-
*/
|
|
28
|
-
where?: Where<TColumns>[];
|
|
29
|
-
/**
|
|
30
|
-
* Sorts the results according to the given array of column priorities.
|
|
31
|
-
*/
|
|
32
|
-
order?: Order<TColumns>[];
|
|
33
|
-
/**
|
|
34
|
-
* Ignores the first number of entries in a {@link IDataStoreORM} query result.
|
|
35
|
-
*/
|
|
36
|
-
skip?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Returns at most this number of results from a {@link IDataStoreORM} query.
|
|
39
|
-
*/
|
|
40
|
-
take?: number;
|
|
41
|
-
}
|
|
42
|
-
export type FindClaimsArgs = FindArgs<TClaimsColumns>;
|
|
43
|
-
//# sourceMappingURL=claims.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/types/claims.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,gBAAgB,GAChB,MAAM,GACN,OAAO,GACP,OAAO,GACP,IAAI,GACJ,QAAQ,GACR,SAAS,GACT,gBAAgB,GAChB,cAAc,CAAA;AAElB;;;;GAIG;AACH,MAAM,WAAW,KAAK,CAAC,QAAQ;IAC7B,MAAM,EAAE,QAAQ,CAAA;IAChB,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAK,CAAC,QAAQ;IAC7B,MAAM,EAAE,QAAQ,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,EAAE,CAAC,EAAE,UAAU,GAAG,iBAAiB,GAAG,UAAU,GAAG,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,GAAG,QAAQ,CAAA;CAC9H;AAED,MAAM,WAAW,QAAQ,CAAC,QAAQ;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAA;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAA;IAEzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA"}
|
package/dist/types/claims.js
DELETED
package/dist/types/claims.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claims.js","sourceRoot":"","sources":["../../src/types/claims.ts"],"names":[],"mappings":""}
|
package/dist/utils/filters.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CredentialRole, FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a filter to find a digital credential by its ID or hash.
|
|
4
|
-
*
|
|
5
|
-
* @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
|
|
6
|
-
* @param idOrHash - The ID or hash of the credential to search for.
|
|
7
|
-
* @returns A FindDigitalCredentialArgs array for filtering by ID or hash.
|
|
8
|
-
*/
|
|
9
|
-
export declare const credentialIdOrHashFilter: (credentialRole: CredentialRole, idOrHash: string) => FindDigitalCredentialArgs;
|
|
10
|
-
/**
|
|
11
|
-
* Creates a filter for verifiable credentials with a specific role.
|
|
12
|
-
*
|
|
13
|
-
* @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
|
|
14
|
-
* @param withFilter - Optional additional filter criteria.
|
|
15
|
-
* @returns A FindDigitalCredentialArgs array for filtering verifiable credentials by role.
|
|
16
|
-
*/
|
|
17
|
-
export declare const verifiableCredentialForRoleFilter: (credentialRole: CredentialRole, withFilter?: FindDigitalCredentialArgs) => FindDigitalCredentialArgs;
|
|
18
|
-
/**
|
|
19
|
-
* Merges two FindDigitalCredentialArgs arrays into a single array.
|
|
20
|
-
*
|
|
21
|
-
* This function combines two filter arrays, merging objects at the same index
|
|
22
|
-
* and adding unique objects from both arrays. When merging objects, properties
|
|
23
|
-
* from filter2 overwrite those from filter1 if they exist in both.
|
|
24
|
-
*
|
|
25
|
-
* @param filter1 - The first FindDigitalCredentialArgs array to merge.
|
|
26
|
-
* @param filter2 - The second FindDigitalCredentialArgs array to merge.
|
|
27
|
-
* @returns A new FindDigitalCredentialArgs array containing the merged result.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* const filter1 = [{ documentType: DocumentType.VC }, { credentialRole: CredentialRole.ISSUER }];
|
|
31
|
-
* const filter2 = [{ documentType: DocumentType.VP }, { hash: 'abc123' }];
|
|
32
|
-
* const mergedFilter = mergeFilter(filter1, filter2);
|
|
33
|
-
* // Result: [{ documentType: DocumentType.VP }, { credentialRole: CredentialRole.ISSUER, hash: 'abc123' }]
|
|
34
|
-
*/
|
|
35
|
-
export declare const mergeFilter: (filter1: FindDigitalCredentialArgs, filter2: FindDigitalCredentialArgs) => FindDigitalCredentialArgs;
|
|
36
|
-
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmC,yBAAyB,EAAE,MAAM,8BAA8B,CAAA;AAGzH;;;;;;GAMG;AAEH,eAAO,MAAM,wBAAwB,mBAAoB,cAAc,YAAY,MAAM,KAAG,yBAoB3F,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,mBAC5B,cAAc,eACjB,yBAAyB,KACrC,yBAWF,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,YAAa,yBAAyB,WAAW,yBAAyB,KAAG,yBAsBpG,CAAA"}
|