@twin.org/identity-service 0.0.1-next.3

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.
Files changed (32) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/index.cjs +707 -0
  4. package/dist/esm/index.mjs +692 -0
  5. package/dist/types/identityProfileRoutes.d.ts +61 -0
  6. package/dist/types/identityProfileService.d.ts +85 -0
  7. package/dist/types/identityRoutes.d.ts +21 -0
  8. package/dist/types/identityService.d.ts +30 -0
  9. package/dist/types/index.d.ts +6 -0
  10. package/dist/types/models/IIdentityServiceConfig.d.ts +9 -0
  11. package/dist/types/restEntryPoints.d.ts +2 -0
  12. package/docs/changelog.md +5 -0
  13. package/docs/examples.md +1 -0
  14. package/docs/open-api/spec.json +1361 -0
  15. package/docs/reference/classes/IdentityProfileService.md +255 -0
  16. package/docs/reference/classes/IdentityService.md +73 -0
  17. package/docs/reference/functions/generateRestRoutesIdentity.md +21 -0
  18. package/docs/reference/functions/generateRestRoutesIdentityProfile.md +21 -0
  19. package/docs/reference/functions/identitiesList.md +25 -0
  20. package/docs/reference/functions/identityGet.md +25 -0
  21. package/docs/reference/functions/identityGetPublic.md +25 -0
  22. package/docs/reference/functions/identityProfileCreate.md +25 -0
  23. package/docs/reference/functions/identityProfileRemove.md +25 -0
  24. package/docs/reference/functions/identityProfileUpdate.md +25 -0
  25. package/docs/reference/functions/identityResolve.md +25 -0
  26. package/docs/reference/index.md +28 -0
  27. package/docs/reference/interfaces/IIdentityServiceConfig.md +11 -0
  28. package/docs/reference/variables/restEntryPoints.md +3 -0
  29. package/docs/reference/variables/tagsIdentity.md +5 -0
  30. package/docs/reference/variables/tagsIdentityProfile.md +5 -0
  31. package/locales/en.json +22 -0
  32. package/package.json +78 -0
@@ -0,0 +1,255 @@
1
+ # Class: IdentityProfileService\<T, U\>
2
+
3
+ Class which implements the identity profile contract.
4
+
5
+ ## Type Parameters
6
+
7
+ • **T** *extends* `IJsonLdDocument` = `IJsonLdDocument`
8
+
9
+ • **U** *extends* `IJsonLdDocument` = `IJsonLdDocument`
10
+
11
+ ## Implements
12
+
13
+ - `IIdentityProfileComponent`\<`T`, `U`\>
14
+
15
+ ## Constructors
16
+
17
+ ### new IdentityProfileService()
18
+
19
+ > **new IdentityProfileService**\<`T`, `U`\>(`options`?): [`IdentityProfileService`](IdentityProfileService.md)\<`T`, `U`\>
20
+
21
+ Create a new instance of IdentityProfileService.
22
+
23
+ #### Parameters
24
+
25
+ • **options?**
26
+
27
+ The dependencies for the identity profile service.
28
+
29
+ • **options.profileEntityConnectorType?**: `string`
30
+
31
+ The storage connector for the profiles, default to "identity-profile".
32
+
33
+ #### Returns
34
+
35
+ [`IdentityProfileService`](IdentityProfileService.md)\<`T`, `U`\>
36
+
37
+ ## Properties
38
+
39
+ ### CLASS\_NAME
40
+
41
+ > `readonly` **CLASS\_NAME**: `string`
42
+
43
+ Runtime name for the class.
44
+
45
+ #### Implementation of
46
+
47
+ `IIdentityProfileComponent.CLASS_NAME`
48
+
49
+ ## Methods
50
+
51
+ ### create()
52
+
53
+ > **create**(`publicProfile`?, `privateProfile`?, `identity`?): `Promise`\<`void`\>
54
+
55
+ Create the profile properties for an identity.
56
+
57
+ #### Parameters
58
+
59
+ • **publicProfile?**: `T`
60
+
61
+ The public profile data as JSON-LD.
62
+
63
+ • **privateProfile?**: `U`
64
+
65
+ The private profile data as JSON-LD.
66
+
67
+ • **identity?**: `string`
68
+
69
+ The identity to perform the profile operation on.
70
+
71
+ #### Returns
72
+
73
+ `Promise`\<`void`\>
74
+
75
+ Nothing.
76
+
77
+ #### Implementation of
78
+
79
+ `IIdentityProfileComponent.create`
80
+
81
+ ***
82
+
83
+ ### get()
84
+
85
+ > **get**(`publicPropertyNames`?, `privatePropertyNames`?, `identity`?): `Promise`\<`object`\>
86
+
87
+ Get the profile properties for an identity.
88
+
89
+ #### Parameters
90
+
91
+ • **publicPropertyNames?**: keyof `T`[]
92
+
93
+ The public properties to get for the profile, defaults to all.
94
+
95
+ • **privatePropertyNames?**: keyof `U`[]
96
+
97
+ The private properties to get for the profile, defaults to all.
98
+
99
+ • **identity?**: `string`
100
+
101
+ The identity to perform the profile operation on.
102
+
103
+ #### Returns
104
+
105
+ `Promise`\<`object`\>
106
+
107
+ The items identity and the properties.
108
+
109
+ ##### identity
110
+
111
+ > **identity**: `string`
112
+
113
+ ##### publicProfile?
114
+
115
+ > `optional` **publicProfile**: `Partial`\<`T`\>
116
+
117
+ ##### privateProfile?
118
+
119
+ > `optional` **privateProfile**: `Partial`\<`U`\>
120
+
121
+ #### Implementation of
122
+
123
+ `IIdentityProfileComponent.get`
124
+
125
+ ***
126
+
127
+ ### getPublic()
128
+
129
+ > **getPublic**(`identity`, `propertyNames`?): `Promise`\<`Partial`\<`T`\>\>
130
+
131
+ Get the public profile properties for an identity.
132
+
133
+ #### Parameters
134
+
135
+ • **identity**: `string`
136
+
137
+ The identity to perform the profile operation on.
138
+
139
+ • **propertyNames?**: keyof `T`[]
140
+
141
+ The properties to get for the item, defaults to all.
142
+
143
+ #### Returns
144
+
145
+ `Promise`\<`Partial`\<`T`\>\>
146
+
147
+ The items properties.
148
+
149
+ #### Implementation of
150
+
151
+ `IIdentityProfileComponent.getPublic`
152
+
153
+ ***
154
+
155
+ ### update()
156
+
157
+ > **update**(`publicProfile`?, `privateProfile`?, `identity`?): `Promise`\<`void`\>
158
+
159
+ Update the profile properties of an identity.
160
+
161
+ #### Parameters
162
+
163
+ • **publicProfile?**: `T`
164
+
165
+ The public profile data as JSON-LD.
166
+
167
+ • **privateProfile?**: `U`
168
+
169
+ The private profile data as JSON-LD.
170
+
171
+ • **identity?**: `string`
172
+
173
+ The identity to perform the profile operation on.
174
+
175
+ #### Returns
176
+
177
+ `Promise`\<`void`\>
178
+
179
+ Nothing.
180
+
181
+ #### Implementation of
182
+
183
+ `IIdentityProfileComponent.update`
184
+
185
+ ***
186
+
187
+ ### remove()
188
+
189
+ > **remove**(`identity`?): `Promise`\<`void`\>
190
+
191
+ Delete the profile for an identity.
192
+
193
+ #### Parameters
194
+
195
+ • **identity?**: `string`
196
+
197
+ The identity to perform the profile operation on.
198
+
199
+ #### Returns
200
+
201
+ `Promise`\<`void`\>
202
+
203
+ Nothing.
204
+
205
+ #### Implementation of
206
+
207
+ `IIdentityProfileComponent.remove`
208
+
209
+ ***
210
+
211
+ ### list()
212
+
213
+ > **list**(`publicFilters`?, `publicPropertyNames`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
214
+
215
+ Get a list of the requested types.
216
+
217
+ #### Parameters
218
+
219
+ • **publicFilters?**: `object`[]
220
+
221
+ The filters to apply to the identities public profiles.
222
+
223
+ • **publicPropertyNames?**: keyof `T`[]
224
+
225
+ The public properties to get for the profile, defaults to all.
226
+
227
+ • **cursor?**: `string`
228
+
229
+ The cursor for paged requests.
230
+
231
+ • **pageSize?**: `number`
232
+
233
+ The maximum number of items in a page.
234
+
235
+ #### Returns
236
+
237
+ `Promise`\<`object`\>
238
+
239
+ The list of items and cursor for paging.
240
+
241
+ ##### items
242
+
243
+ > **items**: `object`[]
244
+
245
+ The identities.
246
+
247
+ ##### cursor?
248
+
249
+ > `optional` **cursor**: `string`
250
+
251
+ An optional cursor, when defined can be used to call find to get more entities.
252
+
253
+ #### Implementation of
254
+
255
+ `IIdentityProfileComponent.list`
@@ -0,0 +1,73 @@
1
+ # Class: IdentityService
2
+
3
+ Class which implements the identity contract.
4
+
5
+ ## Implements
6
+
7
+ - `IIdentityComponent`
8
+
9
+ ## Constructors
10
+
11
+ ### new IdentityService()
12
+
13
+ > **new IdentityService**(`options`?): [`IdentityService`](IdentityService.md)
14
+
15
+ Create a new instance of IdentityService.
16
+
17
+ #### Parameters
18
+
19
+ • **options?**
20
+
21
+ The options for the service.
22
+
23
+ • **options.config?**: [`IIdentityServiceConfig`](../interfaces/IIdentityServiceConfig.md)
24
+
25
+ The configuration for the service.
26
+
27
+ #### Returns
28
+
29
+ [`IdentityService`](IdentityService.md)
30
+
31
+ ## Properties
32
+
33
+ ### NAMESPACE
34
+
35
+ > `readonly` `static` **NAMESPACE**: `string` = `"did"`
36
+
37
+ The namespace supported by the identity service.
38
+
39
+ ***
40
+
41
+ ### CLASS\_NAME
42
+
43
+ > `readonly` **CLASS\_NAME**: `string`
44
+
45
+ Runtime name for the class.
46
+
47
+ #### Implementation of
48
+
49
+ `IIdentityComponent.CLASS_NAME`
50
+
51
+ ## Methods
52
+
53
+ ### resolve()
54
+
55
+ > **resolve**(`documentId`): `Promise`\<`IDidDocument`\>
56
+
57
+ Resolve an identity.
58
+
59
+ #### Parameters
60
+
61
+ • **documentId**: `string`
62
+
63
+ The id of the document to resolve.
64
+
65
+ #### Returns
66
+
67
+ `Promise`\<`IDidDocument`\>
68
+
69
+ The resolved document.
70
+
71
+ #### Implementation of
72
+
73
+ `IIdentityComponent.resolve`
@@ -0,0 +1,21 @@
1
+ # Function: generateRestRoutesIdentity()
2
+
3
+ > **generateRestRoutesIdentity**(`baseRouteName`, `componentName`): `IRestRoute`[]
4
+
5
+ The REST routes for identity.
6
+
7
+ ## Parameters
8
+
9
+ • **baseRouteName**: `string`
10
+
11
+ Prefix to prepend to the paths.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ ## Returns
18
+
19
+ `IRestRoute`[]
20
+
21
+ The generated routes.
@@ -0,0 +1,21 @@
1
+ # Function: generateRestRoutesIdentityProfile()
2
+
3
+ > **generateRestRoutesIdentityProfile**(`baseRouteName`, `componentName`): `IRestRoute`[]
4
+
5
+ The REST routes for identity.
6
+
7
+ ## Parameters
8
+
9
+ • **baseRouteName**: `string`
10
+
11
+ Prefix to prepend to the paths.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ ## Returns
18
+
19
+ `IRestRoute`[]
20
+
21
+ The generated routes.
@@ -0,0 +1,25 @@
1
+ # Function: identitiesList()
2
+
3
+ > **identitiesList**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IIdentityProfileListResponse`\>
4
+
5
+ Get the list of organizations.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ • **request**: `IIdentityProfileListRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`IIdentityProfileListResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: identityGet()
2
+
3
+ > **identityGet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IIdentityProfileGetResponse`\>
4
+
5
+ Get the identity profile.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ • **request**: `IIdentityProfileGetRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`IIdentityProfileGetResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: identityGetPublic()
2
+
3
+ > **identityGetPublic**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IIdentityProfileGetPublicResponse`\>
4
+
5
+ Get the identity public profile.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ • **request**: `IIdentityProfileGetPublicRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`IIdentityProfileGetPublicResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: identityProfileCreate()
2
+
3
+ > **identityProfileCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Create an identity profile.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ • **request**: `IIdentityProfileCreateRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`INoContentResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: identityProfileRemove()
2
+
3
+ > **identityProfileRemove**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Remove an identity profile.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ • **request**: `INoContentRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`INoContentResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: identityProfileUpdate()
2
+
3
+ > **identityProfileUpdate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Update an identity profile.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ • **request**: `IIdentityProfileUpdateRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`INoContentResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: identityResolve()
2
+
3
+ > **identityResolve**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IIdentityResolveResponse`\>
4
+
5
+ Resolve an identity.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ • **request**: `IIdentityResolveRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`IIdentityResolveResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,28 @@
1
+ # @twin.org/identity-service
2
+
3
+ ## Classes
4
+
5
+ - [IdentityProfileService](classes/IdentityProfileService.md)
6
+ - [IdentityService](classes/IdentityService.md)
7
+
8
+ ## Interfaces
9
+
10
+ - [IIdentityServiceConfig](interfaces/IIdentityServiceConfig.md)
11
+
12
+ ## Variables
13
+
14
+ - [tagsIdentityProfile](variables/tagsIdentityProfile.md)
15
+ - [tagsIdentity](variables/tagsIdentity.md)
16
+ - [restEntryPoints](variables/restEntryPoints.md)
17
+
18
+ ## Functions
19
+
20
+ - [generateRestRoutesIdentityProfile](functions/generateRestRoutesIdentityProfile.md)
21
+ - [identityProfileCreate](functions/identityProfileCreate.md)
22
+ - [identityGet](functions/identityGet.md)
23
+ - [identityGetPublic](functions/identityGetPublic.md)
24
+ - [identityProfileUpdate](functions/identityProfileUpdate.md)
25
+ - [identityProfileRemove](functions/identityProfileRemove.md)
26
+ - [identitiesList](functions/identitiesList.md)
27
+ - [generateRestRoutesIdentity](functions/generateRestRoutesIdentity.md)
28
+ - [identityResolve](functions/identityResolve.md)
@@ -0,0 +1,11 @@
1
+ # Interface: IIdentityServiceConfig
2
+
3
+ Configuration for the Identity Service.
4
+
5
+ ## Properties
6
+
7
+ ### defaultNamespace?
8
+
9
+ > `optional` **defaultNamespace**: `string`
10
+
11
+ What is the default connector to use for Identity. If not provided the first connector from the factory will be used.
@@ -0,0 +1,3 @@
1
+ # Variable: restEntryPoints
2
+
3
+ > `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
@@ -0,0 +1,5 @@
1
+ # Variable: tagsIdentity
2
+
3
+ > `const` **tagsIdentity**: `ITag`[]
4
+
5
+ The tag to associate with the routes.
@@ -0,0 +1,5 @@
1
+ # Variable: tagsIdentityProfile
2
+
3
+ > `const` **tagsIdentityProfile**: `ITag`[]
4
+
5
+ The tag to associate with the routes.
@@ -0,0 +1,22 @@
1
+ {
2
+ "error": {
3
+ "identityService": {
4
+ "noConnectors": "There are no connectors registered with the identity factory",
5
+ "resolveFailed": "Resolving the identity failed",
6
+ "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the identity service \"{namespace}\""
7
+ },
8
+ "identityProfileConnectorService": {
9
+ "noConnectors": "There are no connectors registered with the identity profile factory"
10
+ },
11
+ "identityProfileService": {
12
+ "alreadyExists": "The identity profile already exists for the identity \"{existingId}\"",
13
+ "createFailed": "Creating the identity profile failed \"{identity}\"",
14
+ "getFailed": "Getting the identity profile failed",
15
+ "getPublicFailed": "Getting the public identity profile failed",
16
+ "updateFailed": "Updating the identity profile failed \"{identity}\"",
17
+ "notFound": "The identity profile could not be found \"{notFoundId}\"",
18
+ "removeFailed": "Removing the identity profile failed \"{identity}\"",
19
+ "listFailed": "Failed listing identities"
20
+ }
21
+ }
22
+ }