@sphereon/ssi-sdk.contact-manager-rest-api 0.32.1-next.54 → 0.33.1-feature.vcdm2.4
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/api-functions.js +57 -84
- package/dist/api-functions.js.map +1 -1
- package/dist/contact-manager-api-server.js +24 -28
- package/dist/contact-manager-api-server.js.map +1 -1
- package/dist/index.js +3 -19
- package/dist/index.js.map +1 -1
- package/dist/types.js +1 -2
- package/package.json +12 -12
package/dist/api-functions.js
CHANGED
|
@@ -1,173 +1,146 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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.partiesReadEndpoint = partiesReadEndpoint;
|
|
13
|
-
exports.partyReadEndpoint = partyReadEndpoint;
|
|
14
|
-
exports.partyWriteEndpoint = partyWriteEndpoint;
|
|
15
|
-
exports.partyDeleteEndpoint = partyDeleteEndpoint;
|
|
16
|
-
exports.partiesTypeReadEndpoint = partiesTypeReadEndpoint;
|
|
17
|
-
exports.partyTypeReadEndpoint = partyTypeReadEndpoint;
|
|
18
|
-
exports.identitiesReadEndpoint = identitiesReadEndpoint;
|
|
19
|
-
exports.identityReadEndpoints = identityReadEndpoints;
|
|
20
|
-
const ssi_express_support_1 = require("@sphereon/ssi-express-support");
|
|
21
|
-
function partiesReadEndpoint(router, context, opts) {
|
|
22
|
-
var _a;
|
|
23
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
1
|
+
import { checkAuth, sendErrorResponse } from '@sphereon/ssi-express-support';
|
|
2
|
+
export function partiesReadEndpoint(router, context, opts) {
|
|
3
|
+
if (opts?.enabled === false) {
|
|
24
4
|
console.log(`"partiesReadEndpoint" Endpoint is disabled`);
|
|
25
5
|
return;
|
|
26
6
|
}
|
|
27
|
-
const path =
|
|
28
|
-
router.get(path,
|
|
7
|
+
const path = opts?.path ?? '/parties';
|
|
8
|
+
router.get(path, checkAuth(opts?.endpoint), async (request, response) => {
|
|
29
9
|
try {
|
|
30
10
|
// later we will add filter to this
|
|
31
|
-
const parties =
|
|
11
|
+
const parties = await context.agent.cmGetContacts();
|
|
32
12
|
response.statusCode = 200;
|
|
33
13
|
return response.send(parties);
|
|
34
14
|
}
|
|
35
15
|
catch (error) {
|
|
36
|
-
return
|
|
16
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
37
17
|
}
|
|
38
|
-
})
|
|
18
|
+
});
|
|
39
19
|
}
|
|
40
|
-
function partyReadEndpoint(router, context, opts) {
|
|
41
|
-
|
|
42
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
20
|
+
export function partyReadEndpoint(router, context, opts) {
|
|
21
|
+
if (opts?.enabled === false) {
|
|
43
22
|
console.log(`"partyReadEndpoint" Endpoint is disabled`);
|
|
44
23
|
return;
|
|
45
24
|
}
|
|
46
|
-
const path =
|
|
47
|
-
router.get(`${path}/:partyId`,
|
|
25
|
+
const path = opts?.path ?? '/parties';
|
|
26
|
+
router.get(`${path}/:partyId`, checkAuth(opts?.endpoint), async (request, response) => {
|
|
48
27
|
try {
|
|
49
28
|
const partyId = request.params.partyId;
|
|
50
|
-
const party =
|
|
29
|
+
const party = await context.agent.cmGetContact({ contactId: partyId });
|
|
51
30
|
response.statusCode = 200;
|
|
52
31
|
return response.send(party);
|
|
53
32
|
}
|
|
54
33
|
catch (error) {
|
|
55
|
-
return
|
|
34
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
56
35
|
}
|
|
57
|
-
})
|
|
36
|
+
});
|
|
58
37
|
}
|
|
59
|
-
function partyWriteEndpoint(router, context, opts) {
|
|
60
|
-
|
|
61
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
38
|
+
export function partyWriteEndpoint(router, context, opts) {
|
|
39
|
+
if (opts?.enabled === false) {
|
|
62
40
|
console.log(`"partyWriteEndpoint" Endpoint is disabled`);
|
|
63
41
|
return;
|
|
64
42
|
}
|
|
65
|
-
const path =
|
|
66
|
-
router.post(path, (request, response) =>
|
|
43
|
+
const path = opts?.path ?? '/parties';
|
|
44
|
+
router.post(path, async (request, response) => {
|
|
67
45
|
try {
|
|
68
46
|
const addParty = request.body;
|
|
69
|
-
const party =
|
|
47
|
+
const party = await context.agent.cmAddContact(addParty);
|
|
70
48
|
response.statusCode = 201;
|
|
71
49
|
return response.send(party);
|
|
72
50
|
}
|
|
73
51
|
catch (error) {
|
|
74
|
-
return
|
|
52
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
75
53
|
}
|
|
76
|
-
})
|
|
54
|
+
});
|
|
77
55
|
}
|
|
78
|
-
function partyDeleteEndpoint(router, context, opts) {
|
|
79
|
-
|
|
80
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
56
|
+
export function partyDeleteEndpoint(router, context, opts) {
|
|
57
|
+
if (opts?.enabled === false) {
|
|
81
58
|
console.log(`"partyDeleteEndpoint" Endpoint is disabled`);
|
|
82
59
|
return;
|
|
83
60
|
}
|
|
84
|
-
const path =
|
|
85
|
-
router.delete(`${path}/:partyId`, (request, response) =>
|
|
61
|
+
const path = opts?.path ?? '/parties';
|
|
62
|
+
router.delete(`${path}/:partyId`, async (request, response) => {
|
|
86
63
|
try {
|
|
87
64
|
const partyId = request.params.partyId;
|
|
88
|
-
const result =
|
|
65
|
+
const result = await context.agent.cmRemoveContact({ contactId: partyId });
|
|
89
66
|
response.statusCode = 200;
|
|
90
67
|
return response.send(result);
|
|
91
68
|
}
|
|
92
69
|
catch (error) {
|
|
93
|
-
return
|
|
70
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
94
71
|
}
|
|
95
|
-
})
|
|
72
|
+
});
|
|
96
73
|
}
|
|
97
|
-
function partiesTypeReadEndpoint(router, context, opts) {
|
|
98
|
-
|
|
99
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
74
|
+
export function partiesTypeReadEndpoint(router, context, opts) {
|
|
75
|
+
if (opts?.enabled === false) {
|
|
100
76
|
console.log(`"partiesTypeReadEndpoint" Endpoint is disabled`);
|
|
101
77
|
return;
|
|
102
78
|
}
|
|
103
|
-
const path =
|
|
104
|
-
router.get(path,
|
|
79
|
+
const path = opts?.path ?? '/party-types';
|
|
80
|
+
router.get(path, checkAuth(opts?.endpoint), async (request, response) => {
|
|
105
81
|
try {
|
|
106
82
|
// later we will add filter to this
|
|
107
|
-
const partyTypes =
|
|
83
|
+
const partyTypes = await context.agent.cmGetContactTypes();
|
|
108
84
|
response.statusCode = 200;
|
|
109
85
|
return response.send(partyTypes);
|
|
110
86
|
}
|
|
111
87
|
catch (error) {
|
|
112
|
-
return
|
|
88
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
113
89
|
}
|
|
114
|
-
})
|
|
90
|
+
});
|
|
115
91
|
}
|
|
116
|
-
function partyTypeReadEndpoint(router, context, opts) {
|
|
117
|
-
|
|
118
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
92
|
+
export function partyTypeReadEndpoint(router, context, opts) {
|
|
93
|
+
if (opts?.enabled === false) {
|
|
119
94
|
console.log(`"partyTypeReadEndpoint" Endpoint is disabled`);
|
|
120
95
|
return;
|
|
121
96
|
}
|
|
122
|
-
const path =
|
|
123
|
-
router.get(`${path}/:partyTypeId`,
|
|
97
|
+
const path = opts?.path ?? '/party-types';
|
|
98
|
+
router.get(`${path}/:partyTypeId`, checkAuth(opts?.endpoint), async (request, response) => {
|
|
124
99
|
try {
|
|
125
100
|
const partyTypeId = request.params.partyTypeId;
|
|
126
|
-
const partyType =
|
|
101
|
+
const partyType = await context.agent.cmGetContactType({ contactTypeId: partyTypeId });
|
|
127
102
|
response.statusCode = 200;
|
|
128
103
|
return response.send(partyType);
|
|
129
104
|
}
|
|
130
105
|
catch (error) {
|
|
131
|
-
return
|
|
106
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
132
107
|
}
|
|
133
|
-
})
|
|
108
|
+
});
|
|
134
109
|
}
|
|
135
|
-
function identitiesReadEndpoint(router, context, opts) {
|
|
136
|
-
|
|
137
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
110
|
+
export function identitiesReadEndpoint(router, context, opts) {
|
|
111
|
+
if (opts?.enabled === false) {
|
|
138
112
|
console.log(`"identitiesReadEndpoint" Endpoint is disabled`);
|
|
139
113
|
return;
|
|
140
114
|
}
|
|
141
|
-
const path =
|
|
142
|
-
router.get(path,
|
|
115
|
+
const path = opts?.path ?? '/identities';
|
|
116
|
+
router.get(path, checkAuth(opts?.endpoint), async (request, response) => {
|
|
143
117
|
try {
|
|
144
118
|
// later we will add filter to this
|
|
145
|
-
const identities =
|
|
119
|
+
const identities = await context.agent.cmGetIdentities();
|
|
146
120
|
response.statusCode = 200;
|
|
147
121
|
return response.send(identities);
|
|
148
122
|
}
|
|
149
123
|
catch (error) {
|
|
150
|
-
return
|
|
124
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
151
125
|
}
|
|
152
|
-
})
|
|
126
|
+
});
|
|
153
127
|
}
|
|
154
|
-
function identityReadEndpoints(router, context, opts) {
|
|
155
|
-
|
|
156
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
|
|
128
|
+
export function identityReadEndpoints(router, context, opts) {
|
|
129
|
+
if (opts?.enabled === false) {
|
|
157
130
|
console.log(`"identityReadEndpoints" Endpoint is disabled`);
|
|
158
131
|
return;
|
|
159
132
|
}
|
|
160
|
-
const path =
|
|
161
|
-
router.get(`${path}/:identityId`,
|
|
133
|
+
const path = opts?.path ?? '/identities';
|
|
134
|
+
router.get(`${path}/:identityId`, checkAuth(opts?.endpoint), async (request, response) => {
|
|
162
135
|
try {
|
|
163
136
|
const identityId = request.params.identityId;
|
|
164
|
-
const identity =
|
|
137
|
+
const identity = await context.agent.cmGetIdentity({ identityId });
|
|
165
138
|
response.statusCode = 200;
|
|
166
139
|
return response.send(identity);
|
|
167
140
|
}
|
|
168
141
|
catch (error) {
|
|
169
|
-
return
|
|
142
|
+
return sendErrorResponse(response, 500, error.message, error);
|
|
170
143
|
}
|
|
171
|
-
})
|
|
144
|
+
});
|
|
172
145
|
}
|
|
173
146
|
//# sourceMappingURL=api-functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-functions.js","sourceRoot":"","sources":["../src/api-functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-functions.js","sourceRoot":"","sources":["../src/api-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAA;AAKjG,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,OAAyB,EAAE,IAA0B;IACvG,IAAI,IAAI,EAAE,OAAO,KAAK,KAAK,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAA;QACzD,OAAM;IACR,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,UAAU,CAAA;IACrC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAgB,EAAE,QAAkB,EAAE,EAAE;QACzF,IAAI,CAAC;YACH,mCAAmC;YACnC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAA;YACnD,QAAQ,CAAC,UAAU,GAAG,GAAG,CA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class ContactManagerApiServer {
|
|
1
|
+
import { agentContext } from '@sphereon/ssi-sdk.core';
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import { identityReadEndpoints, partiesReadEndpoint, partyDeleteEndpoint, partyReadEndpoint, partiesTypeReadEndpoint, partyWriteEndpoint, partyTypeReadEndpoint, identitiesReadEndpoint, } from './api-functions';
|
|
4
|
+
import { copyGlobalAuthToEndpoints } from '@sphereon/ssi-express-support';
|
|
5
|
+
export class ContactManagerApiServer {
|
|
6
|
+
_express;
|
|
7
|
+
_agent;
|
|
8
|
+
_opts;
|
|
9
|
+
_router;
|
|
12
10
|
constructor(args) {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
14
11
|
const { agent, opts } = args;
|
|
15
12
|
this._agent = agent;
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
13
|
+
copyGlobalAuthToEndpoints({ opts, keys: ['partyRead', 'partyWrite', 'partyTypeRead', 'identityRead'] });
|
|
14
|
+
if (opts?.endpointOpts?.globalAuth?.secureContactManagerEndpoints) {
|
|
15
|
+
copyGlobalAuthToEndpoints({ opts, keys: ['partyRead', 'partyWrite', 'partyTypeRead', 'identityRead'] });
|
|
19
16
|
}
|
|
20
17
|
this._opts = opts;
|
|
21
18
|
this._express = args.expressSupport.express;
|
|
22
|
-
this._router =
|
|
23
|
-
const context =
|
|
24
|
-
const features =
|
|
19
|
+
this._router = express.Router();
|
|
20
|
+
const context = agentContext(agent);
|
|
21
|
+
const features = opts?.enableFeatures ?? ['party_read', 'party_write', 'party_type_read', 'identity_read'];
|
|
25
22
|
console.log(`Contact Manager API enabled, with features: ${JSON.stringify(features)}}`);
|
|
26
23
|
// endpoints
|
|
27
24
|
if (features.includes('party_read')) {
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
partiesReadEndpoint(this.router, context, this._opts?.endpointOpts?.partyRead);
|
|
26
|
+
partyReadEndpoint(this.router, context, this._opts?.endpointOpts?.partyRead);
|
|
30
27
|
}
|
|
31
28
|
if (features.includes('party_write')) {
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
partyWriteEndpoint(this.router, context, this._opts?.endpointOpts?.partyWrite);
|
|
30
|
+
partyDeleteEndpoint(this.router, context, this._opts?.endpointOpts?.partyWrite);
|
|
34
31
|
}
|
|
35
32
|
if (features.includes('party_type_read')) {
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
partiesTypeReadEndpoint(this.router, context, this._opts?.endpointOpts?.partyTypeRead);
|
|
34
|
+
partyTypeReadEndpoint(this.router, context, this._opts?.endpointOpts?.partyTypeRead);
|
|
38
35
|
}
|
|
39
36
|
if (features.includes('identity_read')) {
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
identitiesReadEndpoint(this.router, context, this._opts?.endpointOpts?.identityRead);
|
|
38
|
+
identityReadEndpoints(this.router, context, this._opts?.endpointOpts?.identityRead);
|
|
42
39
|
}
|
|
43
|
-
this._express.use(
|
|
40
|
+
this._express.use(opts?.endpointOpts?.basePath ?? '', this.router);
|
|
44
41
|
}
|
|
45
42
|
get express() {
|
|
46
43
|
return this._express;
|
|
@@ -55,5 +52,4 @@ class ContactManagerApiServer {
|
|
|
55
52
|
return this._opts;
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
exports.ContactManagerApiServer = ContactManagerApiServer;
|
|
59
55
|
//# sourceMappingURL=contact-manager-api-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-manager-api-server.js","sourceRoot":"","sources":["../src/contact-manager-api-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contact-manager-api-server.js","sourceRoot":"","sources":["../src/contact-manager-api-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAGrD,OAAO,OAA4B,MAAM,SAAS,CAAA;AAElD,OAAO,EACL,qBAAqB,EACrB,mBAA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AM,CAAC,CAAA;IACpE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IACD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./contact-manager-api-server"), exports);
|
|
19
|
-
__exportStar(require("./api-functions"), exports);
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './contact-manager-api-server';
|
|
3
|
+
export * from './api-functions';
|
|
20
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iBAAiB,CAAA"}
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.contact-manager-rest-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"start:dev": "ts-node __tests__/RestAPI.ts"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@sphereon/ssi-express-support": "0.
|
|
15
|
-
"@sphereon/ssi-sdk-ext.key-manager": "0.
|
|
16
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.
|
|
17
|
-
"@sphereon/ssi-sdk.contact-manager": "0.
|
|
18
|
-
"@sphereon/ssi-sdk.core": "0.
|
|
19
|
-
"@sphereon/ssi-sdk.data-store": "0.
|
|
20
|
-
"@sphereon/ssi-sdk.kv-store-temp": "0.
|
|
21
|
-
"@sphereon/ssi-types": "0.
|
|
14
|
+
"@sphereon/ssi-express-support": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
15
|
+
"@sphereon/ssi-sdk-ext.key-manager": "0.28.0",
|
|
16
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.28.0",
|
|
17
|
+
"@sphereon/ssi-sdk.contact-manager": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
18
|
+
"@sphereon/ssi-sdk.core": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
19
|
+
"@sphereon/ssi-sdk.data-store": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
20
|
+
"@sphereon/ssi-sdk.kv-store-temp": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
21
|
+
"@sphereon/ssi-types": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
22
22
|
"@veramo/core": "4.2.0",
|
|
23
23
|
"body-parser": "^1.20.2",
|
|
24
24
|
"casbin": "^5.30.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@decentralized-identity/ion-sdk": "^0.6.0",
|
|
36
|
-
"@sphereon/ssi-sdk.agent-config": "0.
|
|
36
|
+
"@sphereon/ssi-sdk.agent-config": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
37
37
|
"@types/body-parser": "^1.19.5",
|
|
38
38
|
"@types/cookie-parser": "^1.4.7",
|
|
39
39
|
"@types/cors": "^2.8.17",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"passport": "^0.6.0",
|
|
58
58
|
"passport-http-bearer": "^1.0.1",
|
|
59
59
|
"ts-node": "^10.9.2",
|
|
60
|
-
"typeorm": "^0.3.
|
|
60
|
+
"typeorm": "^0.3.21"
|
|
61
61
|
},
|
|
62
62
|
"files": [
|
|
63
63
|
"dist/**/*",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"API"
|
|
82
82
|
],
|
|
83
83
|
"nx": {},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "9f634bdb714061141e277508c124b08d626f6036"
|
|
85
85
|
}
|