@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.
- package/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +707 -0
- package/dist/esm/index.mjs +692 -0
- package/dist/types/identityProfileRoutes.d.ts +61 -0
- package/dist/types/identityProfileService.d.ts +85 -0
- package/dist/types/identityRoutes.d.ts +21 -0
- package/dist/types/identityService.d.ts +30 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/models/IIdentityServiceConfig.d.ts +9 -0
- package/dist/types/restEntryPoints.d.ts +2 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/open-api/spec.json +1361 -0
- package/docs/reference/classes/IdentityProfileService.md +255 -0
- package/docs/reference/classes/IdentityService.md +73 -0
- package/docs/reference/functions/generateRestRoutesIdentity.md +21 -0
- package/docs/reference/functions/generateRestRoutesIdentityProfile.md +21 -0
- package/docs/reference/functions/identitiesList.md +25 -0
- package/docs/reference/functions/identityGet.md +25 -0
- package/docs/reference/functions/identityGetPublic.md +25 -0
- package/docs/reference/functions/identityProfileCreate.md +25 -0
- package/docs/reference/functions/identityProfileRemove.md +25 -0
- package/docs/reference/functions/identityProfileUpdate.md +25 -0
- package/docs/reference/functions/identityResolve.md +25 -0
- package/docs/reference/index.md +28 -0
- package/docs/reference/interfaces/IIdentityServiceConfig.md +11 -0
- package/docs/reference/variables/restEntryPoints.md +3 -0
- package/docs/reference/variables/tagsIdentity.md +5 -0
- package/docs/reference/variables/tagsIdentityProfile.md +5 -0
- package/locales/en.json +22 -0
- package/package.json +78 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { IHttpRequestContext, INoContentRequest, INoContentResponse, IRestRoute, ITag } from "@twin.org/api-models";
|
|
2
|
+
import type { IIdentityProfileCreateRequest, IIdentityProfileGetPublicRequest, IIdentityProfileGetPublicResponse, IIdentityProfileGetRequest, IIdentityProfileGetResponse, IIdentityProfileListRequest, IIdentityProfileListResponse, IIdentityProfileUpdateRequest } from "@twin.org/identity-models";
|
|
3
|
+
/**
|
|
4
|
+
* The tag to associate with the routes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tagsIdentityProfile: ITag[];
|
|
7
|
+
/**
|
|
8
|
+
* The REST routes for identity.
|
|
9
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
10
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
11
|
+
* @returns The generated routes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateRestRoutesIdentityProfile(baseRouteName: string, componentName: string): IRestRoute[];
|
|
14
|
+
/**
|
|
15
|
+
* Create an identity profile.
|
|
16
|
+
* @param httpRequestContext The request context for the API.
|
|
17
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
18
|
+
* @param request The request.
|
|
19
|
+
* @returns The response object with additional http response properties.
|
|
20
|
+
*/
|
|
21
|
+
export declare function identityProfileCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IIdentityProfileCreateRequest): Promise<INoContentResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the identity profile.
|
|
24
|
+
* @param httpRequestContext The request context for the API.
|
|
25
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
26
|
+
* @param request The request.
|
|
27
|
+
* @returns The response object with additional http response properties.
|
|
28
|
+
*/
|
|
29
|
+
export declare function identityGet(httpRequestContext: IHttpRequestContext, componentName: string, request: IIdentityProfileGetRequest): Promise<IIdentityProfileGetResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the identity public profile.
|
|
32
|
+
* @param httpRequestContext The request context for the API.
|
|
33
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
34
|
+
* @param request The request.
|
|
35
|
+
* @returns The response object with additional http response properties.
|
|
36
|
+
*/
|
|
37
|
+
export declare function identityGetPublic(httpRequestContext: IHttpRequestContext, componentName: string, request: IIdentityProfileGetPublicRequest): Promise<IIdentityProfileGetPublicResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Update an identity profile.
|
|
40
|
+
* @param httpRequestContext The request context for the API.
|
|
41
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
42
|
+
* @param request The request.
|
|
43
|
+
* @returns The response object with additional http response properties.
|
|
44
|
+
*/
|
|
45
|
+
export declare function identityProfileUpdate(httpRequestContext: IHttpRequestContext, componentName: string, request: IIdentityProfileUpdateRequest): Promise<INoContentResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Remove an identity profile.
|
|
48
|
+
* @param httpRequestContext The request context for the API.
|
|
49
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
50
|
+
* @param request The request.
|
|
51
|
+
* @returns The response object with additional http response properties.
|
|
52
|
+
*/
|
|
53
|
+
export declare function identityProfileRemove(httpRequestContext: IHttpRequestContext, componentName: string, request: INoContentRequest): Promise<INoContentResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Get the list of organizations.
|
|
56
|
+
* @param httpRequestContext The request context for the API.
|
|
57
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
58
|
+
* @param request The request.
|
|
59
|
+
* @returns The response object with additional http response properties.
|
|
60
|
+
*/
|
|
61
|
+
export declare function identitiesList(httpRequestContext: IHttpRequestContext, componentName: string, request: IIdentityProfileListRequest): Promise<IIdentityProfileListResponse>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { IJsonLdDocument } from "@twin.org/data-json-ld";
|
|
2
|
+
import { type IIdentityProfileComponent } from "@twin.org/identity-models";
|
|
3
|
+
/**
|
|
4
|
+
* Class which implements the identity profile contract.
|
|
5
|
+
*/
|
|
6
|
+
export declare class IdentityProfileService<T extends IJsonLdDocument = IJsonLdDocument, U extends IJsonLdDocument = IJsonLdDocument> implements IIdentityProfileComponent<T, U> {
|
|
7
|
+
/**
|
|
8
|
+
* Runtime name for the class.
|
|
9
|
+
*/
|
|
10
|
+
readonly CLASS_NAME: string;
|
|
11
|
+
/**
|
|
12
|
+
* Create a new instance of IdentityProfileService.
|
|
13
|
+
* @param options The dependencies for the identity profile service.
|
|
14
|
+
* @param options.profileEntityConnectorType The storage connector for the profiles, default to "identity-profile".
|
|
15
|
+
*/
|
|
16
|
+
constructor(options?: {
|
|
17
|
+
profileEntityConnectorType?: string;
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Create the profile properties for an identity.
|
|
21
|
+
* @param publicProfile The public profile data as JSON-LD.
|
|
22
|
+
* @param privateProfile The private profile data as JSON-LD.
|
|
23
|
+
* @param identity The identity to perform the profile operation on.
|
|
24
|
+
* @returns Nothing.
|
|
25
|
+
*/
|
|
26
|
+
create(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the profile properties for an identity.
|
|
29
|
+
* @param publicPropertyNames The public properties to get for the profile, defaults to all.
|
|
30
|
+
* @param privatePropertyNames The private properties to get for the profile, defaults to all.
|
|
31
|
+
* @param identity The identity to perform the profile operation on.
|
|
32
|
+
* @returns The items identity and the properties.
|
|
33
|
+
*/
|
|
34
|
+
get(publicPropertyNames?: (keyof T)[], privatePropertyNames?: (keyof U)[], identity?: string): Promise<{
|
|
35
|
+
identity: string;
|
|
36
|
+
publicProfile?: Partial<T>;
|
|
37
|
+
privateProfile?: Partial<U>;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the public profile properties for an identity.
|
|
41
|
+
* @param identity The identity to perform the profile operation on.
|
|
42
|
+
* @param propertyNames The properties to get for the item, defaults to all.
|
|
43
|
+
* @returns The items properties.
|
|
44
|
+
*/
|
|
45
|
+
getPublic(identity: string, propertyNames?: (keyof T)[]): Promise<Partial<T>>;
|
|
46
|
+
/**
|
|
47
|
+
* Update the profile properties of an identity.
|
|
48
|
+
* @param publicProfile The public profile data as JSON-LD.
|
|
49
|
+
* @param privateProfile The private profile data as JSON-LD.
|
|
50
|
+
* @param identity The identity to perform the profile operation on.
|
|
51
|
+
* @returns Nothing.
|
|
52
|
+
*/
|
|
53
|
+
update(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Delete the profile for an identity.
|
|
56
|
+
* @param identity The identity to perform the profile operation on.
|
|
57
|
+
* @returns Nothing.
|
|
58
|
+
*/
|
|
59
|
+
remove(identity?: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Get a list of the requested types.
|
|
62
|
+
* @param publicFilters The filters to apply to the identities public profiles.
|
|
63
|
+
* @param publicPropertyNames The public properties to get for the profile, defaults to all.
|
|
64
|
+
* @param cursor The cursor for paged requests.
|
|
65
|
+
* @param pageSize The maximum number of items in a page.
|
|
66
|
+
* @returns The list of items and cursor for paging.
|
|
67
|
+
*/
|
|
68
|
+
list(publicFilters?: {
|
|
69
|
+
propertyName: string;
|
|
70
|
+
propertyValue: unknown;
|
|
71
|
+
}[], publicPropertyNames?: (keyof T)[], cursor?: string, pageSize?: number): Promise<{
|
|
72
|
+
/**
|
|
73
|
+
* The identities.
|
|
74
|
+
*/
|
|
75
|
+
items: {
|
|
76
|
+
identity: string;
|
|
77
|
+
publicProfile?: Partial<T>;
|
|
78
|
+
privateProfile?: Partial<U>;
|
|
79
|
+
}[];
|
|
80
|
+
/**
|
|
81
|
+
* An optional cursor, when defined can be used to call find to get more entities.
|
|
82
|
+
*/
|
|
83
|
+
cursor?: string;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IHttpRequestContext, IRestRoute, ITag } from "@twin.org/api-models";
|
|
2
|
+
import type { IIdentityResolveRequest, IIdentityResolveResponse } from "@twin.org/identity-models";
|
|
3
|
+
/**
|
|
4
|
+
* The tag to associate with the routes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tagsIdentity: ITag[];
|
|
7
|
+
/**
|
|
8
|
+
* The REST routes for identity.
|
|
9
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
10
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
11
|
+
* @returns The generated routes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateRestRoutesIdentity(baseRouteName: string, componentName: string): IRestRoute[];
|
|
14
|
+
/**
|
|
15
|
+
* Resolve an identity.
|
|
16
|
+
* @param httpRequestContext The request context for the API.
|
|
17
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
18
|
+
* @param request The request.
|
|
19
|
+
* @returns The response object with additional http response properties.
|
|
20
|
+
*/
|
|
21
|
+
export declare function identityResolve(httpRequestContext: IHttpRequestContext, componentName: string, request: IIdentityResolveRequest): Promise<IIdentityResolveResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type IIdentityComponent } from "@twin.org/identity-models";
|
|
2
|
+
import type { IDidDocument } from "@twin.org/standards-w3c-did";
|
|
3
|
+
import type { IIdentityServiceConfig } from "./models/IIdentityServiceConfig";
|
|
4
|
+
/**
|
|
5
|
+
* Class which implements the identity contract.
|
|
6
|
+
*/
|
|
7
|
+
export declare class IdentityService implements IIdentityComponent {
|
|
8
|
+
/**
|
|
9
|
+
* The namespace supported by the identity service.
|
|
10
|
+
*/
|
|
11
|
+
static readonly NAMESPACE: string;
|
|
12
|
+
/**
|
|
13
|
+
* Runtime name for the class.
|
|
14
|
+
*/
|
|
15
|
+
readonly CLASS_NAME: string;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new instance of IdentityService.
|
|
18
|
+
* @param options The options for the service.
|
|
19
|
+
* @param options.config The configuration for the service.
|
|
20
|
+
*/
|
|
21
|
+
constructor(options?: {
|
|
22
|
+
config?: IIdentityServiceConfig;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Resolve an identity.
|
|
26
|
+
* @param documentId The id of the document to resolve.
|
|
27
|
+
* @returns The resolved document.
|
|
28
|
+
*/
|
|
29
|
+
resolve(documentId: string): Promise<IDidDocument>;
|
|
30
|
+
}
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/identity-service - Examples
|