@sphereon/ssi-sdk.contact-manager-rest-api 0.18.2-next.3 → 0.18.2-unstable.10

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.
@@ -1,12 +1,12 @@
1
- import { ISingleEndpointOpts } from '@sphereon/ssi-express-support';
2
- import { Router } from 'express';
3
- import { IRequiredContext } from './types';
4
- export declare function partiesReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
5
- export declare function partyReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
6
- export declare function partyWriteEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
7
- export declare function partyDeleteEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
8
- export declare function partiesTypeReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
9
- export declare function partyTypeReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
10
- export declare function identitiesReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
11
- export declare function identityReadEndpoints(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
1
+ import { ISingleEndpointOpts } from '@sphereon/ssi-express-support';
2
+ import { Router } from 'express';
3
+ import { IRequiredContext } from './types';
4
+ export declare function partiesReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
5
+ export declare function partyReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
6
+ export declare function partyWriteEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
7
+ export declare function partyDeleteEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
8
+ export declare function partiesTypeReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
9
+ export declare function partyTypeReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
10
+ export declare function identitiesReadEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
11
+ export declare function identityReadEndpoints(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
12
12
  //# sourceMappingURL=api-functions.d.ts.map
@@ -1,173 +1,173 @@
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.identityReadEndpoints = exports.identitiesReadEndpoint = exports.partyTypeReadEndpoint = exports.partiesTypeReadEndpoint = exports.partyDeleteEndpoint = exports.partyWriteEndpoint = exports.partyReadEndpoint = exports.partiesReadEndpoint = void 0;
13
- const ssi_express_support_1 = require("@sphereon/ssi-express-support");
14
- function partiesReadEndpoint(router, context, opts) {
15
- var _a;
16
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
17
- console.log(`"partiesReadEndpoint" Endpoint is disabled`);
18
- return;
19
- }
20
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
21
- router.get(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
22
- try {
23
- // later we will add filter to this
24
- const parties = yield context.agent.cmGetContacts();
25
- response.statusCode = 200;
26
- return response.send(parties);
27
- }
28
- catch (error) {
29
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
30
- }
31
- }));
32
- }
33
- exports.partiesReadEndpoint = partiesReadEndpoint;
34
- function partyReadEndpoint(router, context, opts) {
35
- var _a;
36
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
37
- console.log(`"partyReadEndpoint" Endpoint is disabled`);
38
- return;
39
- }
40
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
41
- router.get(`${path}/:partyId`, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
42
- try {
43
- const partyId = request.params.partyId;
44
- const party = yield context.agent.cmGetContact({ contactId: partyId });
45
- response.statusCode = 200;
46
- return response.send(party);
47
- }
48
- catch (error) {
49
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
50
- }
51
- }));
52
- }
53
- exports.partyReadEndpoint = partyReadEndpoint;
54
- function partyWriteEndpoint(router, context, opts) {
55
- var _a;
56
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
57
- console.log(`"partyWriteEndpoint" Endpoint is disabled`);
58
- return;
59
- }
60
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
61
- router.post(path, (request, response) => __awaiter(this, void 0, void 0, function* () {
62
- try {
63
- const addParty = request.body;
64
- const party = yield context.agent.cmAddContact(addParty);
65
- response.statusCode = 201;
66
- return response.send(party);
67
- }
68
- catch (error) {
69
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
70
- }
71
- }));
72
- }
73
- exports.partyWriteEndpoint = partyWriteEndpoint;
74
- function partyDeleteEndpoint(router, context, opts) {
75
- var _a;
76
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
77
- console.log(`"partyDeleteEndpoint" Endpoint is disabled`);
78
- return;
79
- }
80
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
81
- router.delete(`${path}/:partyId`, (request, response) => __awaiter(this, void 0, void 0, function* () {
82
- try {
83
- const partyId = request.params.partyId;
84
- const result = yield context.agent.cmRemoveContact({ contactId: partyId });
85
- return response.send(result);
86
- }
87
- catch (error) {
88
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
89
- }
90
- }));
91
- }
92
- exports.partyDeleteEndpoint = partyDeleteEndpoint;
93
- function partiesTypeReadEndpoint(router, context, opts) {
94
- var _a;
95
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
96
- console.log(`"partiesTypeReadEndpoint" Endpoint is disabled`);
97
- return;
98
- }
99
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/party-types';
100
- router.get(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
101
- try {
102
- // later we will add filter to this
103
- const partyTypes = yield context.agent.cmGetContactTypes();
104
- response.statusCode = 200;
105
- return response.send(partyTypes);
106
- }
107
- catch (error) {
108
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
109
- }
110
- }));
111
- }
112
- exports.partiesTypeReadEndpoint = partiesTypeReadEndpoint;
113
- function partyTypeReadEndpoint(router, context, opts) {
114
- var _a;
115
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
116
- console.log(`"partyTypeReadEndpoint" Endpoint is disabled`);
117
- return;
118
- }
119
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/party-types';
120
- router.get(`${path}/:partyTypeId`, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
121
- try {
122
- const partyTypeId = request.params.partyTypeId;
123
- const partyType = yield context.agent.cmGetContactType({ contactTypeId: partyTypeId });
124
- response.statusCode = 200;
125
- return response.send(partyType);
126
- }
127
- catch (error) {
128
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
129
- }
130
- }));
131
- }
132
- exports.partyTypeReadEndpoint = partyTypeReadEndpoint;
133
- function identitiesReadEndpoint(router, context, opts) {
134
- var _a;
135
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
136
- console.log(`"identitiesReadEndpoint" Endpoint is disabled`);
137
- return;
138
- }
139
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/identities';
140
- router.get(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
141
- try {
142
- // later we will add filter to this
143
- const identities = yield context.agent.cmGetIdentities();
144
- response.statusCode = 200;
145
- return response.send(identities);
146
- }
147
- catch (error) {
148
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
149
- }
150
- }));
151
- }
152
- exports.identitiesReadEndpoint = identitiesReadEndpoint;
153
- function identityReadEndpoints(router, context, opts) {
154
- var _a;
155
- if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
156
- console.log(`"identityReadEndpoints" Endpoint is disabled`);
157
- return;
158
- }
159
- const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/identities';
160
- router.get(`${path}/:identityId`, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
161
- try {
162
- const identityId = request.params.identityId;
163
- const identity = yield context.agent.cmGetIdentity({ identityId });
164
- response.statusCode = 200;
165
- return response.send(identity);
166
- }
167
- catch (error) {
168
- return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
169
- }
170
- }));
171
- }
172
- exports.identityReadEndpoints = identityReadEndpoints;
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.identityReadEndpoints = exports.identitiesReadEndpoint = exports.partyTypeReadEndpoint = exports.partiesTypeReadEndpoint = exports.partyDeleteEndpoint = exports.partyWriteEndpoint = exports.partyReadEndpoint = exports.partiesReadEndpoint = void 0;
13
+ const ssi_express_support_1 = require("@sphereon/ssi-express-support");
14
+ function partiesReadEndpoint(router, context, opts) {
15
+ var _a;
16
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
17
+ console.log(`"partiesReadEndpoint" Endpoint is disabled`);
18
+ return;
19
+ }
20
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
21
+ router.get(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
22
+ try {
23
+ // later we will add filter to this
24
+ const parties = yield context.agent.cmGetContacts();
25
+ response.statusCode = 200;
26
+ return response.send(parties);
27
+ }
28
+ catch (error) {
29
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
30
+ }
31
+ }));
32
+ }
33
+ exports.partiesReadEndpoint = partiesReadEndpoint;
34
+ function partyReadEndpoint(router, context, opts) {
35
+ var _a;
36
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
37
+ console.log(`"partyReadEndpoint" Endpoint is disabled`);
38
+ return;
39
+ }
40
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
41
+ router.get(`${path}/:partyId`, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
42
+ try {
43
+ const partyId = request.params.partyId;
44
+ const party = yield context.agent.cmGetContact({ contactId: partyId });
45
+ response.statusCode = 200;
46
+ return response.send(party);
47
+ }
48
+ catch (error) {
49
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
50
+ }
51
+ }));
52
+ }
53
+ exports.partyReadEndpoint = partyReadEndpoint;
54
+ function partyWriteEndpoint(router, context, opts) {
55
+ var _a;
56
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
57
+ console.log(`"partyWriteEndpoint" Endpoint is disabled`);
58
+ return;
59
+ }
60
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
61
+ router.post(path, (request, response) => __awaiter(this, void 0, void 0, function* () {
62
+ try {
63
+ const addParty = request.body;
64
+ const party = yield context.agent.cmAddContact(addParty);
65
+ response.statusCode = 201;
66
+ return response.send(party);
67
+ }
68
+ catch (error) {
69
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
70
+ }
71
+ }));
72
+ }
73
+ exports.partyWriteEndpoint = partyWriteEndpoint;
74
+ function partyDeleteEndpoint(router, context, opts) {
75
+ var _a;
76
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
77
+ console.log(`"partyDeleteEndpoint" Endpoint is disabled`);
78
+ return;
79
+ }
80
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/parties';
81
+ router.delete(`${path}/:partyId`, (request, response) => __awaiter(this, void 0, void 0, function* () {
82
+ try {
83
+ const partyId = request.params.partyId;
84
+ const result = yield context.agent.cmRemoveContact({ contactId: partyId });
85
+ return response.send(result);
86
+ }
87
+ catch (error) {
88
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
89
+ }
90
+ }));
91
+ }
92
+ exports.partyDeleteEndpoint = partyDeleteEndpoint;
93
+ function partiesTypeReadEndpoint(router, context, opts) {
94
+ var _a;
95
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
96
+ console.log(`"partiesTypeReadEndpoint" Endpoint is disabled`);
97
+ return;
98
+ }
99
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/party-types';
100
+ router.get(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
101
+ try {
102
+ // later we will add filter to this
103
+ const partyTypes = yield context.agent.cmGetContactTypes();
104
+ response.statusCode = 200;
105
+ return response.send(partyTypes);
106
+ }
107
+ catch (error) {
108
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
109
+ }
110
+ }));
111
+ }
112
+ exports.partiesTypeReadEndpoint = partiesTypeReadEndpoint;
113
+ function partyTypeReadEndpoint(router, context, opts) {
114
+ var _a;
115
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
116
+ console.log(`"partyTypeReadEndpoint" Endpoint is disabled`);
117
+ return;
118
+ }
119
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/party-types';
120
+ router.get(`${path}/:partyTypeId`, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
121
+ try {
122
+ const partyTypeId = request.params.partyTypeId;
123
+ const partyType = yield context.agent.cmGetContactType({ contactTypeId: partyTypeId });
124
+ response.statusCode = 200;
125
+ return response.send(partyType);
126
+ }
127
+ catch (error) {
128
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
129
+ }
130
+ }));
131
+ }
132
+ exports.partyTypeReadEndpoint = partyTypeReadEndpoint;
133
+ function identitiesReadEndpoint(router, context, opts) {
134
+ var _a;
135
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
136
+ console.log(`"identitiesReadEndpoint" Endpoint is disabled`);
137
+ return;
138
+ }
139
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/identities';
140
+ router.get(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
141
+ try {
142
+ // later we will add filter to this
143
+ const identities = yield context.agent.cmGetIdentities();
144
+ response.statusCode = 200;
145
+ return response.send(identities);
146
+ }
147
+ catch (error) {
148
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
149
+ }
150
+ }));
151
+ }
152
+ exports.identitiesReadEndpoint = identitiesReadEndpoint;
153
+ function identityReadEndpoints(router, context, opts) {
154
+ var _a;
155
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
156
+ console.log(`"identityReadEndpoints" Endpoint is disabled`);
157
+ return;
158
+ }
159
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/identities';
160
+ router.get(`${path}/:identityId`, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
161
+ try {
162
+ const identityId = request.params.identityId;
163
+ const identity = yield context.agent.cmGetIdentity({ identityId });
164
+ response.statusCode = 200;
165
+ return response.send(identity);
166
+ }
167
+ catch (error) {
168
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, error.message, error);
169
+ }
170
+ }));
171
+ }
172
+ exports.identityReadEndpoints = identityReadEndpoints;
173
173
  //# sourceMappingURL=api-functions.js.map
@@ -1,20 +1,20 @@
1
- import { TAgent } from '@veramo/core';
2
- import { Express, Router } from 'express';
3
- import { IContactManagerAPIEndpointOpts, IRequiredPlugins } from './types';
4
- import { ExpressSupport } from '@sphereon/ssi-express-support';
5
- export declare class ContactManagerApiServer {
6
- private readonly _express;
7
- private readonly _agent;
8
- private readonly _opts?;
9
- private readonly _router;
10
- constructor(args: {
11
- agent: TAgent<IRequiredPlugins>;
12
- expressSupport: ExpressSupport;
13
- opts?: IContactManagerAPIEndpointOpts;
14
- });
15
- get express(): Express;
16
- get router(): Router;
17
- get agent(): TAgent<IRequiredPlugins>;
18
- get opts(): IContactManagerAPIEndpointOpts | undefined;
19
- }
1
+ import { TAgent } from '@veramo/core';
2
+ import { Express, Router } from 'express';
3
+ import { IContactManagerAPIEndpointOpts, IRequiredPlugins } from './types';
4
+ import { ExpressSupport } from '@sphereon/ssi-express-support';
5
+ export declare class ContactManagerApiServer {
6
+ private readonly _express;
7
+ private readonly _agent;
8
+ private readonly _opts?;
9
+ private readonly _router;
10
+ constructor(args: {
11
+ agent: TAgent<IRequiredPlugins>;
12
+ expressSupport: ExpressSupport;
13
+ opts?: IContactManagerAPIEndpointOpts;
14
+ });
15
+ get express(): Express;
16
+ get router(): Router;
17
+ get agent(): TAgent<IRequiredPlugins>;
18
+ get opts(): IContactManagerAPIEndpointOpts | undefined;
19
+ }
20
20
  //# sourceMappingURL=contact-manager-api-server.d.ts.map
@@ -1,59 +1,59 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ContactManagerApiServer = void 0;
7
- const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
8
- const express_1 = __importDefault(require("express"));
9
- const api_functions_1 = require("./api-functions");
10
- const ssi_express_support_1 = require("@sphereon/ssi-express-support");
11
- class ContactManagerApiServer {
12
- 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
- const { agent, opts } = args;
15
- this._agent = agent;
16
- (0, ssi_express_support_1.copyGlobalAuthToEndpoints)({ opts, keys: ['partyRead', 'partyWrite', 'partyTypeRead', 'identityRead'] });
17
- if ((_b = (_a = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _a === void 0 ? void 0 : _a.globalAuth) === null || _b === void 0 ? void 0 : _b.secureContactManagerEndpoints) {
18
- (0, ssi_express_support_1.copyGlobalAuthToEndpoints)({ opts, keys: ['partyRead', 'partyWrite', 'partyTypeRead', 'identityRead'] });
19
- }
20
- this._opts = opts;
21
- this._express = args.expressSupport.express;
22
- this._router = express_1.default.Router();
23
- const context = (0, ssi_sdk_core_1.agentContext)(agent);
24
- const features = (_c = opts === null || opts === void 0 ? void 0 : opts.enableFeatures) !== null && _c !== void 0 ? _c : ['party_read', 'party_write', 'party_type_read', 'identity_read'];
25
- console.log(`Contact Manager API enabled, with features: ${JSON.stringify(features)}}`);
26
- // endpoints
27
- if (features.includes('party_read')) {
28
- (0, api_functions_1.partiesReadEndpoint)(this.router, context, (_e = (_d = this._opts) === null || _d === void 0 ? void 0 : _d.endpointOpts) === null || _e === void 0 ? void 0 : _e.partyRead);
29
- (0, api_functions_1.partyReadEndpoint)(this.router, context, (_g = (_f = this._opts) === null || _f === void 0 ? void 0 : _f.endpointOpts) === null || _g === void 0 ? void 0 : _g.partyRead);
30
- }
31
- if (features.includes('party_write')) {
32
- (0, api_functions_1.partyWriteEndpoint)(this.router, context, (_j = (_h = this._opts) === null || _h === void 0 ? void 0 : _h.endpointOpts) === null || _j === void 0 ? void 0 : _j.partyWrite);
33
- (0, api_functions_1.partyDeleteEndpoint)(this.router, context, (_l = (_k = this._opts) === null || _k === void 0 ? void 0 : _k.endpointOpts) === null || _l === void 0 ? void 0 : _l.partyWrite);
34
- }
35
- if (features.includes('party_type_read')) {
36
- (0, api_functions_1.partiesTypeReadEndpoint)(this.router, context, (_o = (_m = this._opts) === null || _m === void 0 ? void 0 : _m.endpointOpts) === null || _o === void 0 ? void 0 : _o.partyTypeRead);
37
- (0, api_functions_1.partyTypeReadEndpoint)(this.router, context, (_q = (_p = this._opts) === null || _p === void 0 ? void 0 : _p.endpointOpts) === null || _q === void 0 ? void 0 : _q.partyTypeRead);
38
- }
39
- if (features.includes('identity_read')) {
40
- (0, api_functions_1.identitiesReadEndpoint)(this.router, context, (_s = (_r = this._opts) === null || _r === void 0 ? void 0 : _r.endpointOpts) === null || _s === void 0 ? void 0 : _s.identityRead);
41
- (0, api_functions_1.identityReadEndpoints)(this.router, context, (_u = (_t = this._opts) === null || _t === void 0 ? void 0 : _t.endpointOpts) === null || _u === void 0 ? void 0 : _u.identityRead);
42
- }
43
- this._express.use((_w = (_v = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _v === void 0 ? void 0 : _v.basePath) !== null && _w !== void 0 ? _w : '', this.router);
44
- }
45
- get express() {
46
- return this._express;
47
- }
48
- get router() {
49
- return this._router;
50
- }
51
- get agent() {
52
- return this._agent;
53
- }
54
- get opts() {
55
- return this._opts;
56
- }
57
- }
58
- exports.ContactManagerApiServer = ContactManagerApiServer;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ContactManagerApiServer = void 0;
7
+ const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
8
+ const express_1 = __importDefault(require("express"));
9
+ const api_functions_1 = require("./api-functions");
10
+ const ssi_express_support_1 = require("@sphereon/ssi-express-support");
11
+ class ContactManagerApiServer {
12
+ 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
+ const { agent, opts } = args;
15
+ this._agent = agent;
16
+ (0, ssi_express_support_1.copyGlobalAuthToEndpoints)({ opts, keys: ['partyRead', 'partyWrite', 'partyTypeRead', 'identityRead'] });
17
+ if ((_b = (_a = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _a === void 0 ? void 0 : _a.globalAuth) === null || _b === void 0 ? void 0 : _b.secureContactManagerEndpoints) {
18
+ (0, ssi_express_support_1.copyGlobalAuthToEndpoints)({ opts, keys: ['partyRead', 'partyWrite', 'partyTypeRead', 'identityRead'] });
19
+ }
20
+ this._opts = opts;
21
+ this._express = args.expressSupport.express;
22
+ this._router = express_1.default.Router();
23
+ const context = (0, ssi_sdk_core_1.agentContext)(agent);
24
+ const features = (_c = opts === null || opts === void 0 ? void 0 : opts.enableFeatures) !== null && _c !== void 0 ? _c : ['party_read', 'party_write', 'party_type_read', 'identity_read'];
25
+ console.log(`Contact Manager API enabled, with features: ${JSON.stringify(features)}}`);
26
+ // endpoints
27
+ if (features.includes('party_read')) {
28
+ (0, api_functions_1.partiesReadEndpoint)(this.router, context, (_e = (_d = this._opts) === null || _d === void 0 ? void 0 : _d.endpointOpts) === null || _e === void 0 ? void 0 : _e.partyRead);
29
+ (0, api_functions_1.partyReadEndpoint)(this.router, context, (_g = (_f = this._opts) === null || _f === void 0 ? void 0 : _f.endpointOpts) === null || _g === void 0 ? void 0 : _g.partyRead);
30
+ }
31
+ if (features.includes('party_write')) {
32
+ (0, api_functions_1.partyWriteEndpoint)(this.router, context, (_j = (_h = this._opts) === null || _h === void 0 ? void 0 : _h.endpointOpts) === null || _j === void 0 ? void 0 : _j.partyWrite);
33
+ (0, api_functions_1.partyDeleteEndpoint)(this.router, context, (_l = (_k = this._opts) === null || _k === void 0 ? void 0 : _k.endpointOpts) === null || _l === void 0 ? void 0 : _l.partyWrite);
34
+ }
35
+ if (features.includes('party_type_read')) {
36
+ (0, api_functions_1.partiesTypeReadEndpoint)(this.router, context, (_o = (_m = this._opts) === null || _m === void 0 ? void 0 : _m.endpointOpts) === null || _o === void 0 ? void 0 : _o.partyTypeRead);
37
+ (0, api_functions_1.partyTypeReadEndpoint)(this.router, context, (_q = (_p = this._opts) === null || _p === void 0 ? void 0 : _p.endpointOpts) === null || _q === void 0 ? void 0 : _q.partyTypeRead);
38
+ }
39
+ if (features.includes('identity_read')) {
40
+ (0, api_functions_1.identitiesReadEndpoint)(this.router, context, (_s = (_r = this._opts) === null || _r === void 0 ? void 0 : _r.endpointOpts) === null || _s === void 0 ? void 0 : _s.identityRead);
41
+ (0, api_functions_1.identityReadEndpoints)(this.router, context, (_u = (_t = this._opts) === null || _t === void 0 ? void 0 : _t.endpointOpts) === null || _u === void 0 ? void 0 : _u.identityRead);
42
+ }
43
+ this._express.use((_w = (_v = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _v === void 0 ? void 0 : _v.basePath) !== null && _w !== void 0 ? _w : '', this.router);
44
+ }
45
+ get express() {
46
+ return this._express;
47
+ }
48
+ get router() {
49
+ return this._router;
50
+ }
51
+ get agent() {
52
+ return this._agent;
53
+ }
54
+ get opts() {
55
+ return this._opts;
56
+ }
57
+ }
58
+ exports.ContactManagerApiServer = ContactManagerApiServer;
59
59
  //# sourceMappingURL=contact-manager-api-server.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './types';
2
- export * from './contact-manager-api-server';
3
- export * from './api-functions';
1
+ export * from './types';
2
+ export * from './contact-manager-api-server';
3
+ export * from './api-functions';
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
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
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
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);
20
20
  //# sourceMappingURL=index.js.map
package/dist/types.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- import { GenericAuthArgs, ISingleEndpointOpts } from '@sphereon/ssi-express-support';
2
- import { IContactManager } from '@sphereon/ssi-sdk.contact-manager';
3
- import { IAgentContext, IDataStore, IDIDManager, IKeyManager } from '@veramo/core';
4
- export type ContactManagerMRestApiFeatures = 'party_read' | 'party_write' | 'party_type_read' | 'identity_read';
5
- export interface IContactManagerAPIEndpointOpts {
6
- endpointOpts?: {
7
- basePath?: string;
8
- globalAuth?: GenericAuthArgs & {
9
- secureContactManagerEndpoints?: boolean;
10
- };
11
- partyRead?: ISingleEndpointOpts;
12
- partyWrite?: ISingleEndpointOpts;
13
- partyTypeRead?: ISingleEndpointOpts;
14
- identityRead?: ISingleEndpointOpts;
15
- };
16
- enableFeatures?: ContactManagerMRestApiFeatures[];
17
- }
18
- export type IRequiredPlugins = IContactManager & IDataStore & IKeyManager & IDIDManager;
19
- export type IRequiredContext = IAgentContext<IRequiredPlugins>;
1
+ import { GenericAuthArgs, ISingleEndpointOpts } from '@sphereon/ssi-express-support';
2
+ import { IContactManager } from '@sphereon/ssi-sdk.contact-manager';
3
+ import { IAgentContext, IDataStore, IDIDManager, IKeyManager } from '@veramo/core';
4
+ export type ContactManagerMRestApiFeatures = 'party_read' | 'party_write' | 'party_type_read' | 'identity_read';
5
+ export interface IContactManagerAPIEndpointOpts {
6
+ endpointOpts?: {
7
+ basePath?: string;
8
+ globalAuth?: GenericAuthArgs & {
9
+ secureContactManagerEndpoints?: boolean;
10
+ };
11
+ partyRead?: ISingleEndpointOpts;
12
+ partyWrite?: ISingleEndpointOpts;
13
+ partyTypeRead?: ISingleEndpointOpts;
14
+ identityRead?: ISingleEndpointOpts;
15
+ };
16
+ enableFeatures?: ContactManagerMRestApiFeatures[];
17
+ }
18
+ export type IRequiredPlugins = IContactManager & IDataStore & IKeyManager & IDIDManager;
19
+ export type IRequiredContext = IAgentContext<IRequiredPlugins>;
20
20
  //# sourceMappingURL=types.d.ts.map
package/dist/types.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.contact-manager-rest-api",
3
- "version": "0.18.2-next.3+8d0ea61f",
3
+ "version": "0.18.2-unstable.10+f2428c90",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,15 +11,15 @@
11
11
  "start:dev": "ts-node __tests__/RestAPI.ts"
12
12
  },
13
13
  "dependencies": {
14
- "@sphereon/ssi-express-support": "^0.18.2-next.3+8d0ea61f",
14
+ "@sphereon/ssi-express-support": "^0.18.2-unstable.10+f2428c90",
15
15
  "@sphereon/ssi-sdk-ext.key-manager": "0.14.0",
16
16
  "@sphereon/ssi-sdk-ext.key-utils": "0.14.0",
17
- "@sphereon/ssi-sdk.agent-config": "^0.18.2-next.3+8d0ea61f",
18
- "@sphereon/ssi-sdk.contact-manager": "^0.18.2-next.3+8d0ea61f",
19
- "@sphereon/ssi-sdk.core": "^0.18.2-next.3+8d0ea61f",
20
- "@sphereon/ssi-sdk.data-store": "^0.18.2-next.3+8d0ea61f",
21
- "@sphereon/ssi-sdk.kv-store-temp": "^0.18.2-next.3+8d0ea61f",
22
- "@sphereon/ssi-types": "^0.18.2-next.3+8d0ea61f",
17
+ "@sphereon/ssi-sdk.agent-config": "^0.18.2-unstable.10+f2428c90",
18
+ "@sphereon/ssi-sdk.contact-manager": "^0.18.2-unstable.10+f2428c90",
19
+ "@sphereon/ssi-sdk.core": "^0.18.2-unstable.10+f2428c90",
20
+ "@sphereon/ssi-sdk.data-store": "^0.18.2-unstable.10+f2428c90",
21
+ "@sphereon/ssi-sdk.kv-store-temp": "^0.18.2-unstable.10+f2428c90",
22
+ "@sphereon/ssi-types": "^0.18.2-unstable.10+f2428c90",
23
23
  "@veramo/core": "4.2.0",
24
24
  "body-parser": "^1.19.0",
25
25
  "casbin": "^5.26.2",
@@ -82,5 +82,5 @@
82
82
  "REST",
83
83
  "API"
84
84
  ],
85
- "gitHead": "8d0ea61f25e33ef614e9579e727ba319cce5bcc0"
85
+ "gitHead": "f2428c90a2d35170a6c8e6c732ce74add79a4ffe"
86
86
  }