@twin.org/identity-service 0.9.1 → 0.9.2-next.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.
@@ -109,6 +109,58 @@ export function generateRestRoutesIdentityProfile(baseRouteName, componentName)
109
109
  }
110
110
  ]
111
111
  };
112
+ const identityProfileAdminGetRoute = {
113
+ operationId: "identityProfileAdminGet",
114
+ summary: "Get the identity profile properties of another user",
115
+ tag: tagsIdentityProfile[0].name,
116
+ method: "GET",
117
+ path: `${baseRouteName}/:userIdentity`,
118
+ requiredScope: ["user-admin"],
119
+ handler: async (httpRequestContext, request) => identityProfileAdminGet(httpRequestContext, componentName, request),
120
+ requestType: {
121
+ type: "IIdentityProfileAdminGetRequest",
122
+ examples: [
123
+ {
124
+ id: "identityProfileAdminGetRequestExample",
125
+ request: {
126
+ pathParams: {
127
+ userIdentity: "did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70"
128
+ },
129
+ query: {
130
+ publicPropertyNames: "name,jobTitle"
131
+ }
132
+ }
133
+ }
134
+ ]
135
+ },
136
+ responseType: [
137
+ {
138
+ type: "IIdentityProfileGetResponse",
139
+ examples: [
140
+ {
141
+ id: "identityProfileAdminGetResponseExample",
142
+ response: {
143
+ body: {
144
+ identity: "did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
145
+ publicProfile: {
146
+ "@context": "https://schema.org",
147
+ "@type": "Person",
148
+ jobTitle: "Professor",
149
+ name: "Jane Doe"
150
+ }
151
+ }
152
+ }
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ type: "INotFoundResponse"
158
+ },
159
+ {
160
+ type: "IForbiddenResponse"
161
+ }
162
+ ]
163
+ };
112
164
  const identityProfileGetPublicRoute = {
113
165
  operationId: "identityProfileGetPublic",
114
166
  summary: "Get the identity profile public properties",
@@ -198,6 +250,86 @@ export function generateRestRoutesIdentityProfile(baseRouteName, componentName)
198
250
  }
199
251
  ]
200
252
  };
253
+ const identityProfileAdminUpdateRoute = {
254
+ operationId: "identityProfileAdminUpdate",
255
+ summary: "Update the identity profile properties of another user",
256
+ tag: tagsIdentityProfile[0].name,
257
+ method: "PUT",
258
+ path: `${baseRouteName}/:userIdentity`,
259
+ requiredScope: ["user-admin"],
260
+ handler: async (httpRequestContext, request) => identityProfileAdminUpdate(httpRequestContext, componentName, request),
261
+ requestType: {
262
+ type: "IIdentityProfileAdminUpdateRequest",
263
+ examples: [
264
+ {
265
+ id: "identityProfileAdminUpdateRequestExample",
266
+ request: {
267
+ pathParams: {
268
+ userIdentity: "did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70"
269
+ },
270
+ body: {
271
+ publicProfile: {
272
+ "@context": "https://schema.org",
273
+ "@type": "Person",
274
+ jobTitle: "Professor",
275
+ name: "Jane Doe"
276
+ },
277
+ privateProfile: {
278
+ "@context": "https://schema.org",
279
+ "@type": "Person",
280
+ telephone: "(425) 123-4567",
281
+ url: "http://www.janedoe.com"
282
+ }
283
+ }
284
+ }
285
+ }
286
+ ]
287
+ },
288
+ responseType: [
289
+ {
290
+ type: "INoContentResponse"
291
+ },
292
+ {
293
+ type: "INotFoundResponse"
294
+ },
295
+ {
296
+ type: "IForbiddenResponse"
297
+ }
298
+ ]
299
+ };
300
+ const identityProfileAdminRemoveRoute = {
301
+ operationId: "identityProfileAdminRemove",
302
+ summary: "Remove the identity profile of another user",
303
+ tag: tagsIdentityProfile[0].name,
304
+ method: "DELETE",
305
+ path: `${baseRouteName}/:userIdentity`,
306
+ requiredScope: ["user-admin"],
307
+ handler: async (httpRequestContext, request) => identityProfileAdminRemove(httpRequestContext, componentName, request),
308
+ requestType: {
309
+ type: "IIdentityProfileAdminRemoveRequest",
310
+ examples: [
311
+ {
312
+ id: "identityProfileAdminRemoveRequestExample",
313
+ request: {
314
+ pathParams: {
315
+ userIdentity: "did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70"
316
+ }
317
+ }
318
+ }
319
+ ]
320
+ },
321
+ responseType: [
322
+ {
323
+ type: "INoContentResponse"
324
+ },
325
+ {
326
+ type: "INotFoundResponse"
327
+ },
328
+ {
329
+ type: "IForbiddenResponse"
330
+ }
331
+ ]
332
+ };
201
333
  const identityProfileRemoveRoute = {
202
334
  operationId: "identityProfileRemove",
203
335
  summary: "Remove an identity profile",
@@ -267,13 +399,80 @@ export function generateRestRoutesIdentityProfile(baseRouteName, componentName)
267
399
  }
268
400
  ]
269
401
  };
402
+ const identityProfileAdminListRoute = {
403
+ operationId: "identitiesProfileAdminList",
404
+ summary: "Get the list of profile data for identities including private properties",
405
+ tag: tagsIdentityProfile[0].name,
406
+ method: "GET",
407
+ path: `${baseRouteName}/admin/query/`,
408
+ requiredScope: ["user-admin"],
409
+ handler: async (httpRequestContext, request) => identitiesAdminList(httpRequestContext, componentName, request),
410
+ requestType: {
411
+ type: "IIdentityProfileAdminListRequest",
412
+ examples: [
413
+ {
414
+ id: "identityProfileAdminListRequestExample",
415
+ request: {
416
+ query: {}
417
+ }
418
+ },
419
+ {
420
+ id: "identityProfileAdminListRequestFilteredExample",
421
+ request: {
422
+ query: {
423
+ publicFilters: "jobTitle:Professor",
424
+ privateFilters: "department:Engineering"
425
+ }
426
+ }
427
+ }
428
+ ]
429
+ },
430
+ responseType: [
431
+ {
432
+ type: "IIdentityProfileAdminListResponse",
433
+ examples: [
434
+ {
435
+ id: "identitiesProfileAdminListResponseExample",
436
+ response: {
437
+ body: {
438
+ items: [
439
+ {
440
+ identity: "did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
441
+ publicProfile: {
442
+ "@context": "https://schema.org",
443
+ "@type": "Person",
444
+ jobTitle: "Professor",
445
+ name: "Jane Doe"
446
+ },
447
+ privateProfile: {
448
+ "@context": "https://schema.org",
449
+ "@type": "Person",
450
+ telephone: "(425) 123-4567"
451
+ }
452
+ }
453
+ ],
454
+ cursor: "1"
455
+ }
456
+ }
457
+ }
458
+ ]
459
+ },
460
+ {
461
+ type: "IForbiddenResponse"
462
+ }
463
+ ]
464
+ };
270
465
  return [
271
466
  identityProfileCreateRoute,
272
467
  identityProfileGetRoute,
468
+ identityProfileAdminGetRoute,
273
469
  identityProfileGetPublicRoute,
274
470
  identityProfileUpdateRoute,
471
+ identityProfileAdminUpdateRoute,
275
472
  identityProfileRemoveRoute,
276
- identityProfileListRoute
473
+ identityProfileAdminRemoveRoute,
474
+ identityProfileListRoute,
475
+ identityProfileAdminListRoute
277
476
  ];
278
477
  }
279
478
  /**
@@ -311,6 +510,22 @@ export async function identityGet(httpRequestContext, componentName, request) {
311
510
  body: result
312
511
  };
313
512
  }
513
+ /**
514
+ * Get the identity profile of another user as an admin.
515
+ * @param httpRequestContext The request context for the API.
516
+ * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
517
+ * @param request The request.
518
+ * @returns The response object with additional http response properties.
519
+ */
520
+ export async function identityProfileAdminGet(httpRequestContext, componentName, request) {
521
+ Guards.object(ROUTES_SOURCE, "request", request);
522
+ Guards.stringValue(ROUTES_SOURCE, "request.pathParams.userIdentity", request.pathParams?.userIdentity);
523
+ const component = ComponentFactory.get(componentName);
524
+ const result = await component.get(HttpParameterHelper.arrayFromString(request?.query?.publicPropertyNames), HttpParameterHelper.arrayFromString(request?.query?.privatePropertyNames), request.pathParams.userIdentity);
525
+ return {
526
+ body: result
527
+ };
528
+ }
314
529
  /**
315
530
  * Get the identity public profile.
316
531
  * @param httpRequestContext The request context for the API.
@@ -348,6 +563,23 @@ export async function identityProfileUpdate(httpRequestContext, componentName, r
348
563
  statusCode: HttpStatusCode.noContent
349
564
  };
350
565
  }
566
+ /**
567
+ * Update the identity profile of another user as an admin.
568
+ * @param httpRequestContext The request context for the API.
569
+ * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
570
+ * @param request The request.
571
+ * @returns The response object with additional http response properties.
572
+ */
573
+ export async function identityProfileAdminUpdate(httpRequestContext, componentName, request) {
574
+ Guards.object(ROUTES_SOURCE, "request", request);
575
+ Guards.object(ROUTES_SOURCE, "request.body", request.body);
576
+ Guards.stringValue(ROUTES_SOURCE, "request.pathParams.userIdentity", request.pathParams?.userIdentity);
577
+ const component = ComponentFactory.get(componentName);
578
+ await component.update(request.body.publicProfile, request.body.privateProfile, request.pathParams.userIdentity);
579
+ return {
580
+ statusCode: HttpStatusCode.noContent
581
+ };
582
+ }
351
583
  /**
352
584
  * Remove an identity profile.
353
585
  * @param httpRequestContext The request context for the API.
@@ -364,6 +596,22 @@ export async function identityProfileRemove(httpRequestContext, componentName, r
364
596
  statusCode: HttpStatusCode.noContent
365
597
  };
366
598
  }
599
+ /**
600
+ * Remove the identity profile of another user as an admin.
601
+ * @param httpRequestContext The request context for the API.
602
+ * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
603
+ * @param request The request.
604
+ * @returns The response object with additional http response properties.
605
+ */
606
+ export async function identityProfileAdminRemove(httpRequestContext, componentName, request) {
607
+ Guards.object(ROUTES_SOURCE, "request", request);
608
+ Guards.stringValue(ROUTES_SOURCE, "request.pathParams.userIdentity", request.pathParams?.userIdentity);
609
+ const component = ComponentFactory.get(componentName);
610
+ await component.remove(request.pathParams.userIdentity);
611
+ return {
612
+ statusCode: HttpStatusCode.noContent
613
+ };
614
+ }
367
615
  /**
368
616
  * Get the list of organizations.
369
617
  * @param httpRequestContext The request context for the API.
@@ -385,4 +633,33 @@ export async function identitiesList(httpRequestContext, componentName, request)
385
633
  body: await component.list(publicFilters, HttpParameterHelper.arrayFromString(request?.query?.publicPropertyNames), request?.query?.cursor, Coerce.integer(request.query?.limit))
386
634
  };
387
635
  }
636
+ /**
637
+ * Get the list of identity profiles including private properties as an admin.
638
+ * @param httpRequestContext The request context for the API.
639
+ * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
640
+ * @param request The request.
641
+ * @returns The response object with additional http response properties.
642
+ */
643
+ export async function identitiesAdminList(httpRequestContext, componentName, request) {
644
+ const component = ComponentFactory.get(componentName);
645
+ const publicFilterPairs = HttpParameterHelper.arrayFromString(request?.query?.publicFilters);
646
+ const publicFilters = publicFilterPairs?.map(pair => {
647
+ const parts = pair.split(":");
648
+ return {
649
+ propertyName: parts[0],
650
+ propertyValue: parts[1]
651
+ };
652
+ });
653
+ const privateFilterPairs = HttpParameterHelper.arrayFromString(request?.query?.privateFilters);
654
+ const privateFilters = privateFilterPairs?.map(pair => {
655
+ const parts = pair.split(":");
656
+ return {
657
+ propertyName: parts[0],
658
+ propertyValue: parts[1]
659
+ };
660
+ });
661
+ return {
662
+ body: await component.listAdmin(publicFilters, privateFilters, HttpParameterHelper.arrayFromString(request?.query?.publicPropertyNames), HttpParameterHelper.arrayFromString(request?.query?.privatePropertyNames), request?.query?.cursor, Coerce.integer(request.query?.limit))
663
+ };
664
+ }
388
665
  //# sourceMappingURL=identityProfileRoutes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"identityProfileRoutes.js","sourceRoot":"","sources":["../../src/identityProfileRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,mBAAmB,EAQnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAclE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvE;;GAEG;AACH,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAW;IAC1C;QACC,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,uEAAuE;KACpF;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAChD,aAAqB,EACrB,aAA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AE,KAAK,CAAC,CAAC,CAAC;SACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACN,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CACzB,aAAa,EACb,mBAAmB,CAAC,eAAe,CAClC,OAAO,EAAE,KAAK,EAAE,mBAAmB,CACnC,EACD,OAAO,EAAE,KAAK,EAAE,MAAM,EACtB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACpC;KACD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpParameterHelper,\n\ttype IConflictResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentRequest,\n\ttype INoContentResponse,\n\ttype INotFoundResponse,\n\ttype IRestRoute,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, Guards } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\nimport type {\n\tIIdentityProfileComponent,\n\tIIdentityProfileCreateRequest,\n\tIIdentityProfileGetPublicRequest,\n\tIIdentityProfileGetPublicResponse,\n\tIIdentityProfileGetRequest,\n\tIIdentityProfileGetResponse,\n\tIIdentityProfileListRequest,\n\tIIdentityProfileListResponse,\n\tIIdentityProfileUpdateRequest\n} from \"@twin.org/identity-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { HeaderTypes, HttpStatusCode, MimeTypes } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"identityProfileRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsIdentityProfile: ITag[] = [\n\t{\n\t\tname: \"Identity Profile\",\n\t\tdescription: \"Service to provide all features related to digital identity profiles.\"\n\t}\n];\n\n/**\n * The REST routes for identity.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesIdentityProfile(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst identityProfileCreateRoute: IRestRoute<IIdentityProfileCreateRequest, INoContentResponse> =\n\t\t{\n\t\t\toperationId: \"identityProfileCreate\",\n\t\t\tsummary: \"Create an identity profile\",\n\t\t\ttag: tagsIdentityProfile[0].name,\n\t\t\tmethod: \"POST\",\n\t\t\tpath: `${baseRouteName}/`,\n\t\t\thandler: async (httpRequestContext, request) =>\n\t\t\t\tidentityProfileCreate(httpRequestContext, componentName, request),\n\t\t\trequestType: {\n\t\t\t\ttype: nameof<IIdentityProfileCreateRequest>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityProfileCreateRequestExample\",\n\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprivateProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\ttelephone: \"(425) 123-4567\",\n\t\t\t\t\t\t\t\t\turl: \"http://www.janedoe.com\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\tresponseType: [\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<IConflictResponse>()\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\n\tconst identityProfileGetRoute: IRestRoute<\n\t\tIIdentityProfileGetRequest,\n\t\tIIdentityProfileGetResponse\n\t> = {\n\t\toperationId: \"identityProfileGet\",\n\t\tsummary: \"Get the identity profile properties\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityGetProfileRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpublicPropertyNames: \"name,jobTitle\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileGetPublicRoute: IRestRoute<\n\t\tIIdentityProfileGetPublicRequest,\n\t\tIIdentityProfileGetPublicResponse\n\t> = {\n\t\toperationId: \"identityProfileGetPublic\",\n\t\tsummary: \"Get the identity profile public properties\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:identity/public`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityGetPublic(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileGetPublicRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityGetPublicProfileRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpropertyNames: \"role,email,name\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileGetPublicResponse>(),\n\t\t\t\tmimeType: MimeTypes.JsonLd,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityGetPublicResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.ContentType]: MimeTypes.JsonLd\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileUpdateRoute: IRestRoute<IIdentityProfileUpdateRequest, INoContentResponse> =\n\t\t{\n\t\t\toperationId: \"identityProfileUpdate\",\n\t\t\tsummary: \"Update an identity profile properties\",\n\t\t\ttag: tagsIdentityProfile[0].name,\n\t\t\tmethod: \"PUT\",\n\t\t\tpath: `${baseRouteName}/`,\n\t\t\thandler: async (httpRequestContext, request) =>\n\t\t\t\tidentityProfileUpdate(httpRequestContext, componentName, request),\n\t\t\trequestType: {\n\t\t\t\ttype: nameof<IIdentityProfileUpdateRequest>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityProfileUpdateRequestExample\",\n\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprivateProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\ttelephone: \"(425) 123-4567\",\n\t\t\t\t\t\t\t\t\turl: \"http://www.janedoe.com\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\tresponseType: [\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\n\tconst identityProfileRemoveRoute: IRestRoute<INoContentRequest, INoContentResponse> = {\n\t\toperationId: \"identityProfileRemove\",\n\t\tsummary: \"Remove an identity profile\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityProfileRemove(httpRequestContext, componentName, request),\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileListRoute: IRestRoute<\n\t\tIIdentityProfileListRequest,\n\t\tIIdentityProfileListResponse\n\t> = {\n\t\toperationId: \"identitiesProfileList\",\n\t\tsummary: \"Get the list of profile data for identities\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/query/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentitiesList(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileListRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileListRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileListRequestFilteredExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpublicFilters: \"jobTitle:Professor\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileListResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identitiesProfileListResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tcursor: \"1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [\n\t\tidentityProfileCreateRoute,\n\t\tidentityProfileGetRoute,\n\t\tidentityProfileGetPublicRoute,\n\t\tidentityProfileUpdateRoute,\n\t\tidentityProfileRemoveRoute,\n\t\tidentityProfileListRoute\n\t];\n}\n\n/**\n * Create an identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileCreateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IIdentityProfileCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IIdentityProfileCreateRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.create(\n\t\trequest.body.publicProfile,\n\t\trequest.body.privateProfile,\n\t\tcontextIds[ContextIdKeys.User]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Get the identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileGetRequest\n): Promise<IIdentityProfileGetResponse> {\n\tGuards.object<IIdentityProfileGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst result = await component.get(\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(request?.query?.publicPropertyNames),\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(\n\t\t\trequest?.query?.privatePropertyNames\n\t\t),\n\t\tcontextIds[ContextIdKeys.User]\n\t);\n\n\treturn {\n\t\tbody: result\n\t};\n}\n\n/**\n * Get the identity public profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityGetPublic(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileGetPublicRequest\n): Promise<IIdentityProfileGetPublicResponse> {\n\tGuards.object<IIdentityProfileGetPublicRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams?.identity),\n\t\trequest.pathParams?.identity\n\t);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst result = await component.getPublic(\n\t\trequest?.pathParams.identity,\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(request?.query?.propertyNames)\n\t);\n\n\treturn {\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]: MimeTypes.JsonLd\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * Update an identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IIdentityProfileUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tGuards.object<IIdentityProfileUpdateRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.update(\n\t\trequest.body.publicProfile,\n\t\trequest.body.privateProfile,\n\t\tcontextIds[ContextIdKeys.User]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Remove an identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INoContentRequest\n): Promise<INoContentResponse> {\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.remove(contextIds[ContextIdKeys.User]);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Get the list of organizations.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identitiesList(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileListRequest\n): Promise<IIdentityProfileListResponse> {\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst publicFilterPairs = HttpParameterHelper.arrayFromString(request?.query?.publicFilters);\n\tconst publicFilters = publicFilterPairs?.map(pair => {\n\t\tconst parts = pair.split(\":\");\n\t\treturn {\n\t\t\tpropertyName: parts[0],\n\t\t\tpropertyValue: parts[1]\n\t\t};\n\t});\n\n\treturn {\n\t\tbody: await component.list(\n\t\t\tpublicFilters,\n\t\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(\n\t\t\t\trequest?.query?.publicPropertyNames\n\t\t\t),\n\t\t\trequest?.query?.cursor,\n\t\t\tCoerce.integer(request.query?.limit)\n\t\t)\n\t};\n}\n"]}
1
+ {"version":3,"file":"identityProfileRoutes.js","sourceRoot":"","sources":["../../src/identityProfileRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,mBAAmB,EASnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAmBlE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvE;;GAEG;AACH,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAW;IAC1C;QACC,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,uEAAuE;KACpF;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAChD,aAAqB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AAC;IAC7F,MAAM,aAAa,GAAG,iBAAiB,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO;YACN,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;YACtB,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;SACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;IAC/F,MAAM,cAAc,GAAG,kBAAkB,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO;YACN,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;YACtB,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;SACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACN,IAAI,EAAE,MAAM,SAAS,CAAC,SAAS,CAC9B,aAAa,EACb,cAAc,EACd,mBAAmB,CAAC,eAAe,CAClC,OAAO,EAAE,KAAK,EAAE,mBAAmB,CACnC,EACD,mBAAmB,CAAC,eAAe,CAClC,OAAO,EAAE,KAAK,EAAE,oBAAoB,CACpC,EACD,OAAO,EAAE,KAAK,EAAE,MAAM,EACtB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACpC;KACD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpParameterHelper,\n\ttype IConflictResponse,\n\ttype IForbiddenResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentRequest,\n\ttype INoContentResponse,\n\ttype INotFoundResponse,\n\ttype IRestRoute,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, Guards } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\nimport type {\n\tIIdentityProfileAdminGetRequest,\n\tIIdentityProfileAdminListRequest,\n\tIIdentityProfileAdminListResponse,\n\tIIdentityProfileAdminRemoveRequest,\n\tIIdentityProfileAdminUpdateRequest,\n\tIIdentityProfileComponent,\n\tIIdentityProfileCreateRequest,\n\tIIdentityProfileGetPublicRequest,\n\tIIdentityProfileGetPublicResponse,\n\tIIdentityProfileGetRequest,\n\tIIdentityProfileGetResponse,\n\tIIdentityProfileListRequest,\n\tIIdentityProfileListResponse,\n\tIIdentityProfileUpdateRequest\n} from \"@twin.org/identity-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { HeaderTypes, HttpStatusCode, MimeTypes } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"identityProfileRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsIdentityProfile: ITag[] = [\n\t{\n\t\tname: \"Identity Profile\",\n\t\tdescription: \"Service to provide all features related to digital identity profiles.\"\n\t}\n];\n\n/**\n * The REST routes for identity.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesIdentityProfile(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst identityProfileCreateRoute: IRestRoute<IIdentityProfileCreateRequest, INoContentResponse> =\n\t\t{\n\t\t\toperationId: \"identityProfileCreate\",\n\t\t\tsummary: \"Create an identity profile\",\n\t\t\ttag: tagsIdentityProfile[0].name,\n\t\t\tmethod: \"POST\",\n\t\t\tpath: `${baseRouteName}/`,\n\t\t\thandler: async (httpRequestContext, request) =>\n\t\t\t\tidentityProfileCreate(httpRequestContext, componentName, request),\n\t\t\trequestType: {\n\t\t\t\ttype: nameof<IIdentityProfileCreateRequest>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityProfileCreateRequestExample\",\n\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprivateProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\ttelephone: \"(425) 123-4567\",\n\t\t\t\t\t\t\t\t\turl: \"http://www.janedoe.com\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\tresponseType: [\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<IConflictResponse>()\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\n\tconst identityProfileGetRoute: IRestRoute<\n\t\tIIdentityProfileGetRequest,\n\t\tIIdentityProfileGetResponse\n\t> = {\n\t\toperationId: \"identityProfileGet\",\n\t\tsummary: \"Get the identity profile properties\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityGetProfileRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpublicPropertyNames: \"name,jobTitle\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileAdminGetRoute: IRestRoute<\n\t\tIIdentityProfileAdminGetRequest,\n\t\tIIdentityProfileGetResponse\n\t> = {\n\t\toperationId: \"identityProfileAdminGet\",\n\t\tsummary: \"Get the identity profile properties of another user\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:userIdentity`,\n\t\trequiredScope: [\"user-admin\"],\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityProfileAdminGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileAdminGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileAdminGetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tuserIdentity:\n\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpublicPropertyNames: \"name,jobTitle\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityProfileAdminGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IForbiddenResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileGetPublicRoute: IRestRoute<\n\t\tIIdentityProfileGetPublicRequest,\n\t\tIIdentityProfileGetPublicResponse\n\t> = {\n\t\toperationId: \"identityProfileGetPublic\",\n\t\tsummary: \"Get the identity profile public properties\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:identity/public`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityGetPublic(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileGetPublicRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityGetPublicProfileRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpropertyNames: \"role,email,name\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileGetPublicResponse>(),\n\t\t\t\tmimeType: MimeTypes.JsonLd,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityGetPublicResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.ContentType]: MimeTypes.JsonLd\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileUpdateRoute: IRestRoute<IIdentityProfileUpdateRequest, INoContentResponse> =\n\t\t{\n\t\t\toperationId: \"identityProfileUpdate\",\n\t\t\tsummary: \"Update an identity profile properties\",\n\t\t\ttag: tagsIdentityProfile[0].name,\n\t\t\tmethod: \"PUT\",\n\t\t\tpath: `${baseRouteName}/`,\n\t\t\thandler: async (httpRequestContext, request) =>\n\t\t\t\tidentityProfileUpdate(httpRequestContext, componentName, request),\n\t\t\trequestType: {\n\t\t\t\ttype: nameof<IIdentityProfileUpdateRequest>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identityProfileUpdateRequestExample\",\n\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprivateProfile: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\ttelephone: \"(425) 123-4567\",\n\t\t\t\t\t\t\t\t\turl: \"http://www.janedoe.com\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\tresponseType: [\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\n\tconst identityProfileAdminUpdateRoute: IRestRoute<\n\t\tIIdentityProfileAdminUpdateRequest,\n\t\tINoContentResponse\n\t> = {\n\t\toperationId: \"identityProfileAdminUpdate\",\n\t\tsummary: \"Update the identity profile properties of another user\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:userIdentity`,\n\t\trequiredScope: [\"user-admin\"],\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityProfileAdminUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileAdminUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileAdminUpdateRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tuserIdentity:\n\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tprivateProfile: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\ttelephone: \"(425) 123-4567\",\n\t\t\t\t\t\t\t\turl: \"http://www.janedoe.com\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IForbiddenResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileAdminRemoveRoute: IRestRoute<\n\t\tIIdentityProfileAdminRemoveRequest,\n\t\tINoContentResponse\n\t> = {\n\t\toperationId: \"identityProfileAdminRemove\",\n\t\tsummary: \"Remove the identity profile of another user\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:userIdentity`,\n\t\trequiredScope: [\"user-admin\"],\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityProfileAdminRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileAdminRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileAdminRemoveRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tuserIdentity:\n\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IForbiddenResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileRemoveRoute: IRestRoute<INoContentRequest, INoContentResponse> = {\n\t\toperationId: \"identityProfileRemove\",\n\t\tsummary: \"Remove an identity profile\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentityProfileRemove(httpRequestContext, componentName, request),\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileListRoute: IRestRoute<\n\t\tIIdentityProfileListRequest,\n\t\tIIdentityProfileListResponse\n\t> = {\n\t\toperationId: \"identitiesProfileList\",\n\t\tsummary: \"Get the list of profile data for identities\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/query/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentitiesList(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileListRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileListRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileListRequestFilteredExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpublicFilters: \"jobTitle:Professor\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileListResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identitiesProfileListResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tcursor: \"1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst identityProfileAdminListRoute: IRestRoute<\n\t\tIIdentityProfileAdminListRequest,\n\t\tIIdentityProfileAdminListResponse\n\t> = {\n\t\toperationId: \"identitiesProfileAdminList\",\n\t\tsummary: \"Get the list of profile data for identities including private properties\",\n\t\ttag: tagsIdentityProfile[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/admin/query/`,\n\t\trequiredScope: [\"user-admin\"],\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tidentitiesAdminList(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IIdentityProfileAdminListRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileAdminListRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"identityProfileAdminListRequestFilteredExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tpublicFilters: \"jobTitle:Professor\",\n\t\t\t\t\t\t\tprivateFilters: \"department:Engineering\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IIdentityProfileAdminListResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"identitiesProfileAdminListResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tidentity:\n\t\t\t\t\t\t\t\t\t\t\t\"did:iota:tst:0xc57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tpublicProfile: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\t\t\tjobTitle: \"Professor\",\n\t\t\t\t\t\t\t\t\t\t\tname: \"Jane Doe\"\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tprivateProfile: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\t\t\t\t\t\t\ttelephone: \"(425) 123-4567\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tcursor: \"1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IForbiddenResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [\n\t\tidentityProfileCreateRoute,\n\t\tidentityProfileGetRoute,\n\t\tidentityProfileAdminGetRoute,\n\t\tidentityProfileGetPublicRoute,\n\t\tidentityProfileUpdateRoute,\n\t\tidentityProfileAdminUpdateRoute,\n\t\tidentityProfileRemoveRoute,\n\t\tidentityProfileAdminRemoveRoute,\n\t\tidentityProfileListRoute,\n\t\tidentityProfileAdminListRoute\n\t];\n}\n\n/**\n * Create an identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileCreateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IIdentityProfileCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IIdentityProfileCreateRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.create(\n\t\trequest.body.publicProfile,\n\t\trequest.body.privateProfile,\n\t\tcontextIds[ContextIdKeys.User]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Get the identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileGetRequest\n): Promise<IIdentityProfileGetResponse> {\n\tGuards.object<IIdentityProfileGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst result = await component.get(\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(request?.query?.publicPropertyNames),\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(\n\t\t\trequest?.query?.privatePropertyNames\n\t\t),\n\t\tcontextIds[ContextIdKeys.User]\n\t);\n\n\treturn {\n\t\tbody: result\n\t};\n}\n\n/**\n * Get the identity profile of another user as an admin.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileAdminGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileAdminGetRequest\n): Promise<IIdentityProfileGetResponse> {\n\tGuards.object<IIdentityProfileAdminGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams?.userIdentity),\n\t\trequest.pathParams?.userIdentity\n\t);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst result = await component.get(\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(request?.query?.publicPropertyNames),\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(\n\t\t\trequest?.query?.privatePropertyNames\n\t\t),\n\t\trequest.pathParams.userIdentity\n\t);\n\n\treturn {\n\t\tbody: result\n\t};\n}\n\n/**\n * Get the identity public profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityGetPublic(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileGetPublicRequest\n): Promise<IIdentityProfileGetPublicResponse> {\n\tGuards.object<IIdentityProfileGetPublicRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams?.identity),\n\t\trequest.pathParams?.identity\n\t);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst result = await component.getPublic(\n\t\trequest?.pathParams.identity,\n\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(request?.query?.propertyNames)\n\t);\n\n\treturn {\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]: MimeTypes.JsonLd\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * Update an identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IIdentityProfileUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tGuards.object<IIdentityProfileUpdateRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.update(\n\t\trequest.body.publicProfile,\n\t\trequest.body.privateProfile,\n\t\tcontextIds[ContextIdKeys.User]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Update the identity profile of another user as an admin.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileAdminUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileAdminUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IIdentityProfileAdminUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IIdentityProfileAdminUpdateRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams?.userIdentity),\n\t\trequest.pathParams?.userIdentity\n\t);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.update(\n\t\trequest.body.publicProfile,\n\t\trequest.body.privateProfile,\n\t\trequest.pathParams.userIdentity\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Remove an identity profile.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INoContentRequest\n): Promise<INoContentResponse> {\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.User);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.remove(contextIds[ContextIdKeys.User]);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Remove the identity profile of another user as an admin.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identityProfileAdminRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileAdminRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IIdentityProfileAdminRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams?.userIdentity),\n\t\trequest.pathParams?.userIdentity\n\t);\n\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tawait component.remove(request.pathParams.userIdentity);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Get the list of organizations.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identitiesList(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileListRequest\n): Promise<IIdentityProfileListResponse> {\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst publicFilterPairs = HttpParameterHelper.arrayFromString(request?.query?.publicFilters);\n\tconst publicFilters = publicFilterPairs?.map(pair => {\n\t\tconst parts = pair.split(\":\");\n\t\treturn {\n\t\t\tpropertyName: parts[0],\n\t\t\tpropertyValue: parts[1]\n\t\t};\n\t});\n\n\treturn {\n\t\tbody: await component.list(\n\t\t\tpublicFilters,\n\t\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(\n\t\t\t\trequest?.query?.publicPropertyNames\n\t\t\t),\n\t\t\trequest?.query?.cursor,\n\t\t\tCoerce.integer(request.query?.limit)\n\t\t)\n\t};\n}\n\n/**\n * Get the list of identity profiles including private properties as an admin.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function identitiesAdminList(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IIdentityProfileAdminListRequest\n): Promise<IIdentityProfileAdminListResponse> {\n\tconst component = ComponentFactory.get<IIdentityProfileComponent>(componentName);\n\n\tconst publicFilterPairs = HttpParameterHelper.arrayFromString(request?.query?.publicFilters);\n\tconst publicFilters = publicFilterPairs?.map(pair => {\n\t\tconst parts = pair.split(\":\");\n\t\treturn {\n\t\t\tpropertyName: parts[0],\n\t\t\tpropertyValue: parts[1]\n\t\t};\n\t});\n\n\tconst privateFilterPairs = HttpParameterHelper.arrayFromString(request?.query?.privateFilters);\n\tconst privateFilters = privateFilterPairs?.map(pair => {\n\t\tconst parts = pair.split(\":\");\n\t\treturn {\n\t\t\tpropertyName: parts[0],\n\t\t\tpropertyValue: parts[1]\n\t\t};\n\t});\n\n\treturn {\n\t\tbody: await component.listAdmin(\n\t\t\tpublicFilters,\n\t\t\tprivateFilters,\n\t\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(\n\t\t\t\trequest?.query?.publicPropertyNames\n\t\t\t),\n\t\t\tHttpParameterHelper.arrayFromString<keyof IJsonLdDocument>(\n\t\t\t\trequest?.query?.privatePropertyNames\n\t\t\t),\n\t\t\trequest?.query?.cursor,\n\t\t\tCoerce.integer(request.query?.limit)\n\t\t)\n\t};\n}\n"]}
@@ -155,11 +155,35 @@ export class IdentityProfileService {
155
155
  // We don't want to return private profile for this type of query
156
156
  // as it would expose the values to the REST api
157
157
  const result = await this._identityProfileConnector.list(publicFilters, undefined, publicPropertyNames, undefined, cursor, limit);
158
- return result;
158
+ return {
159
+ items: result.items.map(item => ({
160
+ identity: item.identity,
161
+ publicProfile: item.publicProfile
162
+ })),
163
+ cursor: result.cursor
164
+ };
159
165
  }
160
166
  catch (error) {
161
167
  throw new GeneralError(IdentityProfileService.CLASS_NAME, "listFailed", undefined, error);
162
168
  }
163
169
  }
170
+ /**
171
+ * Get a list of identities including private profile data.
172
+ * @param publicFilters The filters to apply to the identities public profiles.
173
+ * @param privateFilters The filters to apply to the identities private profiles.
174
+ * @param publicPropertyNames The public properties to get for the profile, defaults to all.
175
+ * @param privatePropertyNames The private properties to get for the profile, defaults to none.
176
+ * @param cursor The cursor for paged requests.
177
+ * @param limit The maximum number of items in a page.
178
+ * @returns The list of items and cursor for paging.
179
+ */
180
+ async listAdmin(publicFilters, privateFilters, publicPropertyNames, privatePropertyNames, cursor, limit) {
181
+ try {
182
+ return await this._identityProfileConnector.list(publicFilters, privateFilters, publicPropertyNames, privatePropertyNames, cursor, limit);
183
+ }
184
+ catch (error) {
185
+ throw new GeneralError(IdentityProfileService.CLASS_NAME, "listAdminFailed", undefined, error);
186
+ }
187
+ }
164
188
  }
165
189
  //# sourceMappingURL=identityProfileService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"identityProfileService.js","sourceRoot":"","sources":["../../src/identityProfileService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpF,OAAO,EACN,+BAA+B,EAG/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAIlC;;OAEG;IACI,MAAM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QAAQ,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,sBAAsB,CAAC,UAAU,CAAC,EAAE,CAAC;gBACxE,MAAM,KAAK,CAAC;YACb,CAAC;YACD,MAAM,IAAI,YAAY,CACrB,sBAAsB,CAAC,UAAU,EACjC,cAAc,EACd,EAAE,QAAQ,EAAE,EACZ,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,IAAI,CAChB,aAGG,EACH,mBAAiC,EACjC,MAAe,EACf,KAAc;QAWd,IAAI,CAAC;YACJ,iEAAiE;YACjE,gDAAgD;YAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,IAAI,CACvD,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,KAAK,CACL,CAAC;YACF,OAAO,MAAM,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,YAAY,CAAC,sBAAsB,CAAC,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC3F,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, GeneralError, Guards, Is, NotFoundError } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\nimport {\n\tIdentityProfileConnectorFactory,\n\ttype IIdentityProfileComponent,\n\ttype IIdentityProfileConnector\n} from \"@twin.org/identity-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { IdentityService } from \"./identityService.js\";\nimport type { IIdentityProfileServiceConstructorOptions } from \"./models/IIdentityProfileServiceConstructorOptions.js\";\n\n/**\n * Class which implements the identity profile contract.\n */\nexport class IdentityProfileService<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> implements IIdentityProfileComponent<T, U> {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<IdentityProfileService>();\n\n\t/**\n\t * The identity profile connector.\n\t * @internal\n\t */\n\tprivate readonly _identityProfileConnector: IIdentityProfileConnector<T, U>;\n\n\t/**\n\t * Create a new instance of IdentityProfileService.\n\t * @param options The dependencies for the identity profile service.\n\t */\n\tconstructor(options?: IIdentityProfileServiceConstructorOptions) {\n\t\tthis._identityProfileConnector = IdentityProfileConnectorFactory.get<\n\t\t\tIIdentityProfileConnector<T, U>\n\t\t>(options?.profileEntityConnectorType ?? \"identity-profile\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn IdentityService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been created.\n\t */\n\tpublic async create(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tawait this._identityProfileConnector.create(identity, publicProfile, privateProfile);\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"createFailed\",\n\t\t\t\t{ identity },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns The items identity and the properties.\n\t */\n\tpublic async get(\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tidentity?: string\n\t): Promise<{\n\t\tidentity: string;\n\t\tpublicProfile?: Partial<T>;\n\t\tprivateProfile?: Partial<U>;\n\t}> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(\n\t\t\t\tidentity,\n\t\t\t\tpublicPropertyNames,\n\t\t\t\tprivatePropertyNames\n\t\t\t);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tidentity,\n\t\t\t\tpublicProfile: result.publicProfile,\n\t\t\t\tprivateProfile: result.privateProfile\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(IdentityProfileService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the public profile properties for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @param propertyNames The properties to get for the item, defaults to all.\n\t * @returns The items properties.\n\t */\n\tpublic async getPublic(identity: string, propertyNames?: (keyof T)[]): Promise<Partial<T>> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(identity, propertyNames);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\treturn result.publicProfile;\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"getPublicFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been updated.\n\t */\n\tpublic async update(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(identity);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\tawait this._identityProfileConnector.update(identity, publicProfile, privateProfile);\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"updateFailed\",\n\t\t\t\t{ identity },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been removed.\n\t */\n\tpublic async remove(identity?: string): Promise<void> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(identity);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\tawait this._identityProfileConnector.remove(identity);\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"removeFailed\",\n\t\t\t\t{ identity },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get a list of the requested types.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tpublic async list(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identities.\n\t\t */\n\t\titems: { identity: string; publicProfile?: Partial<T>; privateProfile?: Partial<U> }[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\ttry {\n\t\t\t// We don't want to return private profile for this type of query\n\t\t\t// as it would expose the values to the REST api\n\t\t\tconst result = await this._identityProfileConnector.list(\n\t\t\t\tpublicFilters,\n\t\t\t\tundefined,\n\t\t\t\tpublicPropertyNames,\n\t\t\t\tundefined,\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(IdentityProfileService.CLASS_NAME, \"listFailed\", undefined, error);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"identityProfileService.js","sourceRoot":"","sources":["../../src/identityProfileService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpF,OAAO,EACN,+BAA+B,EAG/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,M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AAI,CAAC,yBAAyB,CAAC,IAAI,CAC/C,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,EACN,KAAK,CACL,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,YAAY,CACrB,sBAAsB,CAAC,UAAU,EACjC,iBAAiB,EACjB,SAAS,EACT,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, GeneralError, Guards, Is, NotFoundError } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\nimport {\n\tIdentityProfileConnectorFactory,\n\ttype IIdentityProfileComponent,\n\ttype IIdentityProfileConnector\n} from \"@twin.org/identity-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { IdentityService } from \"./identityService.js\";\nimport type { IIdentityProfileServiceConstructorOptions } from \"./models/IIdentityProfileServiceConstructorOptions.js\";\n\n/**\n * Class which implements the identity profile contract.\n */\nexport class IdentityProfileService<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> implements IIdentityProfileComponent<T, U> {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<IdentityProfileService>();\n\n\t/**\n\t * The identity profile connector.\n\t * @internal\n\t */\n\tprivate readonly _identityProfileConnector: IIdentityProfileConnector<T, U>;\n\n\t/**\n\t * Create a new instance of IdentityProfileService.\n\t * @param options The dependencies for the identity profile service.\n\t */\n\tconstructor(options?: IIdentityProfileServiceConstructorOptions) {\n\t\tthis._identityProfileConnector = IdentityProfileConnectorFactory.get<\n\t\t\tIIdentityProfileConnector<T, U>\n\t\t>(options?.profileEntityConnectorType ?? \"identity-profile\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn IdentityService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been created.\n\t */\n\tpublic async create(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tawait this._identityProfileConnector.create(identity, publicProfile, privateProfile);\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"createFailed\",\n\t\t\t\t{ identity },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns The items identity and the properties.\n\t */\n\tpublic async get(\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tidentity?: string\n\t): Promise<{\n\t\tidentity: string;\n\t\tpublicProfile?: Partial<T>;\n\t\tprivateProfile?: Partial<U>;\n\t}> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(\n\t\t\t\tidentity,\n\t\t\t\tpublicPropertyNames,\n\t\t\t\tprivatePropertyNames\n\t\t\t);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tidentity,\n\t\t\t\tpublicProfile: result.publicProfile,\n\t\t\t\tprivateProfile: result.privateProfile\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(IdentityProfileService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the public profile properties for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @param propertyNames The properties to get for the item, defaults to all.\n\t * @returns The items properties.\n\t */\n\tpublic async getPublic(identity: string, propertyNames?: (keyof T)[]): Promise<Partial<T>> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(identity, propertyNames);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\treturn result.publicProfile;\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"getPublicFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been updated.\n\t */\n\tpublic async update(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(identity);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\tawait this._identityProfileConnector.update(identity, publicProfile, privateProfile);\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"updateFailed\",\n\t\t\t\t{ identity },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been removed.\n\t */\n\tpublic async remove(identity?: string): Promise<void> {\n\t\tGuards.stringValue(IdentityProfileService.CLASS_NAME, nameof(identity), identity);\n\n\t\ttry {\n\t\t\tconst result = await this._identityProfileConnector.get(identity);\n\t\t\tif (Is.undefined(result)) {\n\t\t\t\tthrow new NotFoundError(IdentityProfileService.CLASS_NAME, \"notFound\", identity);\n\t\t\t}\n\t\t\tawait this._identityProfileConnector.remove(identity);\n\t\t} catch (error) {\n\t\t\tif (BaseError.someErrorClass(error, IdentityProfileService.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"removeFailed\",\n\t\t\t\t{ identity },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get a list of the requested types.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tpublic async list(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identities.\n\t\t */\n\t\titems: { identity: string; publicProfile?: Partial<T> }[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\ttry {\n\t\t\t// We don't want to return private profile for this type of query\n\t\t\t// as it would expose the values to the REST api\n\t\t\tconst result = await this._identityProfileConnector.list(\n\t\t\t\tpublicFilters,\n\t\t\t\tundefined,\n\t\t\t\tpublicPropertyNames,\n\t\t\t\tundefined,\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\t\t\treturn {\n\t\t\t\titems: result.items.map(item => ({\n\t\t\t\t\tidentity: item.identity,\n\t\t\t\t\tpublicProfile: item.publicProfile\n\t\t\t\t})),\n\t\t\t\tcursor: result.cursor\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(IdentityProfileService.CLASS_NAME, \"listFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get a list of identities including private profile data.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param privateFilters The filters to apply to the identities private profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to none.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tpublic async listAdmin(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tprivateFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identities.\n\t\t */\n\t\titems: { identity: string; publicProfile?: Partial<T>; privateProfile?: Partial<U> }[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\ttry {\n\t\t\treturn await this._identityProfileConnector.list(\n\t\t\t\tpublicFilters,\n\t\t\t\tprivateFilters,\n\t\t\t\tpublicPropertyNames,\n\t\t\t\tprivatePropertyNames,\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tIdentityProfileService.CLASS_NAME,\n\t\t\t\t\"listAdminFailed\",\n\t\t\t\tundefined,\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
@@ -895,7 +895,7 @@ export async function identityRemove(httpRequestContext, componentName, request)
895
895
  const contextIds = await ContextIdStore.getContextIds();
896
896
  ContextIdHelper.guard(contextIds, ContextIdKeys.Organization);
897
897
  const component = ComponentFactory.get(componentName);
898
- await component.identityRemove(request.pathParams.identity, contextIds[ContextIdKeys.Organization]);
898
+ await component.identityRemove(request.pathParams.identity, { removeKeys: Coerce.boolean(request.query?.removeKeys) }, contextIds[ContextIdKeys.Organization]);
899
899
  return {
900
900
  statusCode: HttpStatusCode.noContent
901
901
  };
@@ -934,7 +934,7 @@ export async function identityVerificationMethodRemove(httpRequestContext, compo
934
934
  const contextIds = await ContextIdStore.getContextIds();
935
935
  ContextIdHelper.guard(contextIds, ContextIdKeys.Organization);
936
936
  const component = ComponentFactory.get(componentName);
937
- await component.verificationMethodRemove(DocumentHelper.joinId(request.pathParams.identity, request.pathParams.verificationMethodId), contextIds[ContextIdKeys.Organization]);
937
+ await component.verificationMethodRemove(DocumentHelper.joinId(request.pathParams.identity, request.pathParams.verificationMethodId), { removeKeys: Coerce.boolean(request.query?.removeKeys) }, contextIds[ContextIdKeys.Organization]);
938
938
  return {
939
939
  statusCode: HttpStatusCode.noContent
940
940
  };