@axinom/mosaic-user-auth 0.2.2-rc.8 → 0.3.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/UserServiceClient/UserServiceClient.d.ts +166 -0
- package/dist/UserServiceClient/UserServiceClient.d.ts.map +1 -0
- package/dist/UserServiceProvider/UserServiceProvider.d.ts +28 -0
- package/dist/UserServiceProvider/UserServiceProvider.d.ts.map +1 -0
- package/dist/common/assertError.d.ts +6 -0
- package/dist/common/assertError.d.ts.map +1 -0
- package/dist/common/enums.d.ts +12 -0
- package/dist/common/enums.d.ts.map +1 -0
- package/dist/common/stringify-gql-query.d.ts +11 -0
- package/dist/common/stringify-gql-query.d.ts.map +1 -0
- package/dist/common/types.d.ts +84 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/generated/ax-auth-management-graphql.types.d.ts +1307 -0
- package/dist/generated/ax-auth-management-graphql.types.d.ts.map +1 -0
- package/dist/generated/user-service-consumer-graphql.types.d.ts +807 -0
- package/dist/generated/user-service-consumer-graphql.types.d.ts.map +1 -0
- package/dist/generated/user-service-management-graphql.types.d.ts +2268 -0
- package/dist/generated/user-service-management-graphql.types.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +2460 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +2465 -0
- package/dist/index.js.map +1 -0
- package/dist/util/consumerApplication.d.ts +11 -0
- package/dist/util/consumerApplication.d.ts.map +1 -0
- package/dist/util/consumerApplication.spec.d.ts +2 -0
- package/dist/util/consumerApplication.spec.d.ts.map +1 -0
- package/dist/util/userAuth.d.ts +84 -0
- package/dist/util/userAuth.d.ts.map +1 -0
- package/dist/util/userAuth.spec.d.ts +2 -0
- package/dist/util/userAuth.spec.d.ts.map +1 -0
- package/dist/util/userProfile.d.ts +13 -0
- package/dist/util/userProfile.d.ts.map +1 -0
- package/dist/util/userProfile.spec.d.ts +2 -0
- package/dist/util/userProfile.spec.d.ts.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { CheckPasswordResetOtpResponse, CheckUserSignUpOtpResponse, CompletePasswordResetResponse, CompleteUserSignUpResponse, IdpConfiguration, InitiatePasswordResetResponse, ROPCSignInResponse, UserSignUpResponse } from '@axinom/mosaic-user-auth-utils';
|
|
2
|
+
import { CheckConsumerPasswordResetOtpInput, CheckConsumerSignUpOtpInput, CompleteConsumerPasswordResetInput, CompleteConsumerSignUpInput, InitiateConsumerSignUpInput } from 'generated/ax-auth-management-graphql.types';
|
|
3
|
+
import { AuthenticateConsumerApplicationInput } from 'generated/user-service-management-graphql.types';
|
|
4
|
+
import { TokenRenewalMethod } from '../common/enums';
|
|
5
|
+
import { AuthenticateConsumerApplicationResponse, ROPCSignInRequest, TokenChangedCallback, TokenResponse, UserAuthConfig, UserProfile, UserServiceConfig } from '../common/types';
|
|
6
|
+
export declare class UserServiceClient {
|
|
7
|
+
private userAuthConfig;
|
|
8
|
+
private userServiceConfig;
|
|
9
|
+
private tokenRenewalMethod;
|
|
10
|
+
private _tokenChangedHandlers;
|
|
11
|
+
private _tokenResponse;
|
|
12
|
+
private _ropcEndpointResponse;
|
|
13
|
+
private _axAuthIdpConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a user service client. For performance reasons there should only be a single client instance created by an application
|
|
16
|
+
* @param userAuthConfig Configuration values for the user service auth API
|
|
17
|
+
* @param userServiceConfig Configuration values for the user service API
|
|
18
|
+
* @param tokenRenewalMethod Token renewal method to use
|
|
19
|
+
*/
|
|
20
|
+
constructor(userAuthConfig: UserAuthConfig, userServiceConfig: UserServiceConfig, tokenRenewalMethod?: TokenRenewalMethod);
|
|
21
|
+
private get tokenResponse();
|
|
22
|
+
private set tokenResponse(value);
|
|
23
|
+
private emitTokenChanged;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a new token by invoking the User API
|
|
26
|
+
*/
|
|
27
|
+
private fetchToken;
|
|
28
|
+
/**
|
|
29
|
+
* Call the well-known endpoint of ax-user-service and retrieves endpoints related to AxAuth.
|
|
30
|
+
* @returns ROPCEndpointResponse
|
|
31
|
+
*/
|
|
32
|
+
private getROPCEndpoints;
|
|
33
|
+
private _recursiveRefreshActive;
|
|
34
|
+
/**
|
|
35
|
+
* Renews the token pre-emptively by recursively refreshing the cached token just before it's expiry
|
|
36
|
+
*/
|
|
37
|
+
private recursivelyRefreshToken;
|
|
38
|
+
/**
|
|
39
|
+
* A utility function which can be used to determine if there exists an `AxAuth` IDP configured for the Mosaic application.
|
|
40
|
+
* Based on the outcome of this function, an end-user application can conditionally offer the option to Sign-In directly
|
|
41
|
+
* via email & password.
|
|
42
|
+
*
|
|
43
|
+
* @see {@link ropcSignIn}
|
|
44
|
+
*
|
|
45
|
+
* @returns a boolean indicating if the Mosaic application has an AxAuth IDP provider configured and it is enabled.
|
|
46
|
+
*/
|
|
47
|
+
isDirectSignInConfigured: () => Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Starts a ROPC Sign-In flow using the AX_AUTH IDP configured for the application.
|
|
50
|
+
*
|
|
51
|
+
* @param ropcSignInRequest
|
|
52
|
+
* @returns `ROPCSignInResponse`
|
|
53
|
+
*/
|
|
54
|
+
ropcSignIn: (ropcSignInRequest: ROPCSignInRequest) => Promise<ROPCSignInResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Registers a new user in the AX_AUTH IDP configured for the application.
|
|
57
|
+
*
|
|
58
|
+
* @param originUrl
|
|
59
|
+
* @param userSignUpRequest
|
|
60
|
+
* @returns `UserSignUpResponse`
|
|
61
|
+
*/
|
|
62
|
+
initiateUserSignUp: (originUrl: string, userSignUpRequest: Omit<InitiateConsumerSignUpInput, 'oAuthClientId'>) => Promise<UserSignUpResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a given User Sign-Up OTP Code is valid
|
|
65
|
+
*
|
|
66
|
+
* @param originUrl
|
|
67
|
+
* @param checkUserSignUpOtpRequest
|
|
68
|
+
* @returns `CheckUserSignUpOtpResponse`
|
|
69
|
+
*/
|
|
70
|
+
checkUserSignUpOTP: (originUrl: string, checkUserSignUpOtpRequest: CheckConsumerSignUpOtpInput) => Promise<CheckUserSignUpOtpResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Completes a user sign up process using the AX_AUTH IDP.
|
|
73
|
+
* The user needs to input the OTP along with a password (if not provided earlier) to finish the process.
|
|
74
|
+
*
|
|
75
|
+
* @param originUrl
|
|
76
|
+
* @param completeUserSignUpRequest
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
completeUserSignUp: (completeUserSignUpRequest: CompleteConsumerSignUpInput) => Promise<CompleteUserSignUpResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Starts the process of resetting a password for a user registered using the AX_AUTH IDP.
|
|
82
|
+
* This will initiate the call to the webhook configured in AX_AUTH to send the generated OTP
|
|
83
|
+
* to the user.
|
|
84
|
+
*
|
|
85
|
+
* @param originUrl
|
|
86
|
+
* @param email
|
|
87
|
+
* @returns `InitiatePasswordResetResponse`
|
|
88
|
+
*/
|
|
89
|
+
initiateResetPassword: (originUrl: string, email: string) => Promise<InitiatePasswordResetResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Checks if a given Reset Password OTP Code is valid
|
|
92
|
+
*
|
|
93
|
+
* @param originUrl
|
|
94
|
+
* @param checkPasswordResetOtpRequest
|
|
95
|
+
* @returns `CheckPasswordResetOtpResponse`
|
|
96
|
+
*/
|
|
97
|
+
checkResetPasswordOTP: (originUrl: string, checkPasswordResetOtpRequest: CheckConsumerPasswordResetOtpInput) => Promise<CheckPasswordResetOtpResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Completes the password reset flow for a user registered using the AX_AUTH IDP.
|
|
100
|
+
* The user needs to input the OTP along with a new password to finish the process.
|
|
101
|
+
*
|
|
102
|
+
* @param originUrl
|
|
103
|
+
* @param completePasswordResetRequest
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
completeResetPassword: (completePasswordResetRequest: CompleteConsumerPasswordResetInput) => Promise<CompletePasswordResetResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Returns a token. The method will ensure to avoid unnecessary API calls by caching valid tokens.
|
|
109
|
+
*
|
|
110
|
+
* It is not recommended to remember the token for later use.
|
|
111
|
+
* When in need of a token, please call this method to get a new token.
|
|
112
|
+
*/
|
|
113
|
+
getToken: () => Promise<TokenResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Adds an event handler that will be invoked whenever a new token response is loaded from the backend
|
|
116
|
+
*
|
|
117
|
+
*/
|
|
118
|
+
addTokenChangedHandler: (callback: TokenChangedCallback) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Removes an event handler for the TokenChanged event
|
|
121
|
+
*/
|
|
122
|
+
removeTokenChangedHandler: (callback: TokenChangedCallback) => void;
|
|
123
|
+
/**
|
|
124
|
+
* Returns an array of IDP Configurations that are configured for the application
|
|
125
|
+
* This list will exclude connections for provider id AX_AUTH as it is used for a user sign-up and ROPC flows.
|
|
126
|
+
*
|
|
127
|
+
* @param originUrl URL to redirect to once the Oauth 2.0 flow is complete
|
|
128
|
+
*/
|
|
129
|
+
getIdpConfigurations: (originUrl: string) => Promise<IdpConfiguration[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Logs out the user
|
|
132
|
+
*/
|
|
133
|
+
logoutUser: () => Promise<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Sets a given Profile ID as the active profile
|
|
136
|
+
*/
|
|
137
|
+
setActiveProfile: (profileId: string) => Promise<boolean>;
|
|
138
|
+
/**
|
|
139
|
+
* Returns a user profile
|
|
140
|
+
*/
|
|
141
|
+
getUserProfile: (profileId: string) => Promise<UserProfile>;
|
|
142
|
+
/**
|
|
143
|
+
* Returns an array of all user profiles
|
|
144
|
+
*/
|
|
145
|
+
getUserProfiles: () => Promise<UserProfile[]>;
|
|
146
|
+
/**
|
|
147
|
+
* Creates a new user profile
|
|
148
|
+
*/
|
|
149
|
+
createUserProfile: (displayName: string) => Promise<UserProfile>;
|
|
150
|
+
/**
|
|
151
|
+
* Updates a user profile
|
|
152
|
+
* @param userProfileToUpdate User Profile object with required updates. This should be based on the current user profile object, with the required changes done on top of it.
|
|
153
|
+
*/
|
|
154
|
+
updateUserProfile: (userProfileToUpdate: UserProfile) => Promise<UserProfile>;
|
|
155
|
+
/**
|
|
156
|
+
* Deletes a user profile
|
|
157
|
+
*/
|
|
158
|
+
deleteUserProfile: (userProfileId: string) => Promise<UserProfile>;
|
|
159
|
+
/**
|
|
160
|
+
* Authenticate a consumer application and receive an Application Token
|
|
161
|
+
* @param authenticateConsumerApplicationRequest an object containing the tenantId/environmentId/applicationId/applicationKey info.
|
|
162
|
+
* @returns AuthenticateConsumerApplicationResponse
|
|
163
|
+
*/
|
|
164
|
+
authenticateConsumerApplication: (authenticateConsumerApplicationRequest: AuthenticateConsumerApplicationInput) => Promise<AuthenticateConsumerApplicationResponse>;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=UserServiceClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserServiceClient.d.ts","sourceRoot":"","sources":["../../src/UserServiceClient/UserServiceClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,EAE1B,gBAAgB,EAChB,6BAA6B,EAE7B,kBAAkB,EAElB,kBAAkB,EAEnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,oCAAoC,EAAE,MAAM,iDAAiD,CAAC;AAEvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,uCAAuC,EAEvC,iBAAiB,EACjB,oBAAoB,EACpB,aA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M,gCACa,kCAAkC,KAC/D,QAAQ,6BAA6B,CAAC,CAsBvC;IAEF;;;;;;;OAOG;IACH,qBAAqB,iCACW,kCAAkC,KAC/D,QAAQ,6BAA6B,CAAC,CAavC;IAEF;;;;;OAKG;IACH,QAAQ,QAAa,QAAQ,aAAa,CAAC,CAoBzC;IAEF;;;OAGG;IACH,sBAAsB,aAAc,oBAAoB,KAAG,IAAI,CAE7D;IAEF;;OAEG;IACH,yBAAyB,aAAc,oBAAoB,KAAG,IAAI,CAIhE;IAEF;;;;;OAKG;IACH,oBAAoB,cACP,MAAM,KAChB,QAAQ,gBAAgB,EAAE,CAAC,CAY5B;IAEF;;OAEG;IACH,UAAU,QAAa,QAAQ,OAAO,CAAC,CAOrC;IAEF;;OAEG;IACH,gBAAgB,cAAqB,MAAM,KAAG,QAAQ,OAAO,CAAC,CAa5D;IAEF;;OAEG;IACH,cAAc,cAAqB,MAAM,KAAG,QAAQ,WAAW,CAAC,CAO9D;IAEF;;OAEG;IACH,eAAe,QAAa,QAAQ,WAAW,EAAE,CAAC,CAMhD;IAEF;;OAEG;IACH,iBAAiB,gBAAuB,MAAM,KAAG,QAAQ,WAAW,CAAC,CAOnE;IAEF;;;OAGG;IACH,iBAAiB,wBACM,WAAW,KAC/B,QAAQ,WAAW,CAAC,CAOrB;IAEF;;OAEG;IACH,iBAAiB,kBAAyB,MAAM,KAAG,QAAQ,WAAW,CAAC,CAOrE;IAEF;;;;OAIG;IACH,+BAA+B,2CACW,oCAAoC,KAC3E,QAAQ,uCAAuC,CAAC,CAKjD;CACH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TokenRenewalMethod } from '../common/enums';
|
|
3
|
+
import { UserAuthConfig, UserServiceConfig } from '../common/types';
|
|
4
|
+
import { UserServiceClient } from '../UserServiceClient/UserServiceClient';
|
|
5
|
+
export declare const UserServiceContext: React.Context<UserServiceClient | null>;
|
|
6
|
+
export interface UserServiceProviderProps {
|
|
7
|
+
/**
|
|
8
|
+
* Configuration values for the user service auth API
|
|
9
|
+
*/
|
|
10
|
+
userAuthConfig: UserAuthConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Configuration values for the user service API
|
|
13
|
+
*/
|
|
14
|
+
userServiceConfig: UserServiceConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Token renewal method to use. Tokens can be renewed pre-emptively or on demand. Default token renewal method is on demand.
|
|
17
|
+
*/
|
|
18
|
+
tokenRenewalMethod?: TokenRenewalMethod;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Provides the User Service Client that can be retrieved using the `useUserService` hook
|
|
22
|
+
*/
|
|
23
|
+
export declare const UserServiceProvider: React.FC<UserServiceProviderProps>;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves the User Service Client
|
|
26
|
+
*/
|
|
27
|
+
export declare const useUserService: () => UserServiceClient;
|
|
28
|
+
//# sourceMappingURL=UserServiceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserServiceProvider.d.ts","sourceRoot":"","sources":["../../src/UserServiceProvider/UserServiceProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,eAAO,MAAM,kBAAkB,yCAAgD,CAAC;AAEhF,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,cAAc,EAAE,cAAc,CAAC;IAE/B;;OAEG;IACH,iBAAiB,EAAE,iBAAiB,CAAC;IAErC;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AACD;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAiBlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,QAAO,iBAUjC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type assertion function that throws an error if provided parameter is not an instance of an Error, and asserts value to an Error type if no error is thrown.
|
|
3
|
+
* This is a copy of assertError() in @axinom/service-common to avoid dependencies.
|
|
4
|
+
*/
|
|
5
|
+
export declare const assertError: (error: unknown) => asserts error is Error;
|
|
6
|
+
//# sourceMappingURL=assertError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertError.d.ts","sourceRoot":"","sources":["../../src/common/assertError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,KAAK,IAAI,KAM9D,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum TokenRenewalMethod {
|
|
2
|
+
/**
|
|
3
|
+
* The token is continuously renewed just before expiry.
|
|
4
|
+
* A `TokenChangedCallback` can be registered using `addTokenChangedHandler` method to get notified when the token changes.
|
|
5
|
+
*/
|
|
6
|
+
PRE_EMPTIVE = 0,
|
|
7
|
+
/**
|
|
8
|
+
* The token is renewed only if needed upon calling `getToken` method.
|
|
9
|
+
*/
|
|
10
|
+
ON_DEMAND = 1
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/common/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC5B;;;OAGG;IACH,WAAW,IAAA;IAEX;;OAEG;IACH,SAAS,IAAA;CACV"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
/**
|
|
3
|
+
* Takes a GQL DocumentNode and a set of variables
|
|
4
|
+
* and compiles the body for a GQL request, stringifies and returns.
|
|
5
|
+
*
|
|
6
|
+
* @param gqlDocument
|
|
7
|
+
* @param variables
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare const stringifyGqlQuery: (gqlDocument: DocumentNode, variables?: Record<string, unknown> | undefined) => string;
|
|
11
|
+
//# sourceMappingURL=stringify-gql-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify-gql-query.d.ts","sourceRoot":"","sources":["../../src/common/stringify-gql-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGtF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,gBACf,YAAY,sDAExB,MAMF,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the user service auth API
|
|
3
|
+
*/
|
|
4
|
+
export interface UserAuthConfig {
|
|
5
|
+
userAuthBaseUrl: string;
|
|
6
|
+
tenantId: string;
|
|
7
|
+
environmentId: string;
|
|
8
|
+
applicationId: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for the user service API
|
|
12
|
+
*/
|
|
13
|
+
export interface UserServiceConfig {
|
|
14
|
+
userServiceBaseUrl: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents a User Token
|
|
18
|
+
*/
|
|
19
|
+
export interface UserToken {
|
|
20
|
+
tenantId: string;
|
|
21
|
+
environmentId: string;
|
|
22
|
+
applicationId: string;
|
|
23
|
+
userId: string;
|
|
24
|
+
profileId: string;
|
|
25
|
+
email: string | null;
|
|
26
|
+
name: string | null;
|
|
27
|
+
extensions?: unknown;
|
|
28
|
+
accessToken: string;
|
|
29
|
+
expiresInSeconds: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Represents a User Profile
|
|
33
|
+
*/
|
|
34
|
+
export interface UserProfile {
|
|
35
|
+
id: string;
|
|
36
|
+
displayName: string;
|
|
37
|
+
profilePictureUrl?: string;
|
|
38
|
+
profileData?: unknown;
|
|
39
|
+
defaultProfile: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface TokenResponse {
|
|
42
|
+
code: 'SUCCESS' | 'ERROR';
|
|
43
|
+
message?: string;
|
|
44
|
+
userToken?: UserToken;
|
|
45
|
+
userProfile?: UserProfile;
|
|
46
|
+
/**
|
|
47
|
+
* This will indicate the next automatic token renewal timestamp when the
|
|
48
|
+
* `PRE_EMPTIVE` token renewal method is configured on the `UserServiceProvider`.
|
|
49
|
+
*
|
|
50
|
+
* For `ON_DEMAND` token renewal method, this value can be dismissed.
|
|
51
|
+
*/
|
|
52
|
+
nextTokenRenewalAt?: Date;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Represents the information required to perform a ROPC Sign In flow.
|
|
56
|
+
*/
|
|
57
|
+
export interface ROPCSignInRequest {
|
|
58
|
+
email: string;
|
|
59
|
+
password: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Represents the response for the request to retrieve ROPC endpoints.
|
|
63
|
+
*/
|
|
64
|
+
export interface ROPCEndpointResponse {
|
|
65
|
+
code: 'SUCCESS' | 'ERROR';
|
|
66
|
+
managementEndpoint?: string;
|
|
67
|
+
authEndpoint?: string;
|
|
68
|
+
message?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Callback function to get notified when the token changes
|
|
72
|
+
*/
|
|
73
|
+
export declare type TokenChangedCallback = (token: TokenResponse | null) => void;
|
|
74
|
+
export interface ConsumerApplicationToken {
|
|
75
|
+
accessToken: string;
|
|
76
|
+
expiresInSeconds: number;
|
|
77
|
+
tokenType: string;
|
|
78
|
+
}
|
|
79
|
+
export interface AuthenticateConsumerApplicationResponse {
|
|
80
|
+
code: 'SUCCESS' | 'ERROR';
|
|
81
|
+
message?: string;
|
|
82
|
+
consumerApplicationToken?: ConsumerApplicationToken;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,IAAI,CAA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