@genesislcap/foundation-user 14.137.0
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/README.md +43 -0
- package/dist/dts/config.d.ts +53 -0
- package/dist/dts/config.d.ts.map +1 -0
- package/dist/dts/index.d.ts +5 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/index.federated.d.ts +1 -0
- package/dist/dts/index.federated.d.ts.map +1 -0
- package/dist/dts/logger.d.ts +5 -0
- package/dist/dts/logger.d.ts.map +1 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/types.d.ts +134 -0
- package/dist/dts/types.d.ts.map +1 -0
- package/dist/dts/user.d.ts +167 -0
- package/dist/dts/user.d.ts.map +1 -0
- package/dist/esm/config.js +57 -0
- package/dist/esm/index.federated.js +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/types.js +5 -0
- package/dist/esm/user.js +182 -0
- package/dist/foundation-user.api.json +3350 -0
- package/dist/foundation-user.d.ts +374 -0
- package/docs/.gitattributes +2 -0
- package/docs/api/foundation-user.defaultuser.actionhistory.md +13 -0
- package/docs/api/foundation-user.defaultuser.addauthenticationchangelistener.md +22 -0
- package/docs/api/foundation-user.defaultuser.clearactions.md +17 -0
- package/docs/api/foundation-user.defaultuser.clearpaths.md +17 -0
- package/docs/api/foundation-user.defaultuser.cleartrackinghistory.md +16 -0
- package/docs/api/foundation-user.defaultuser.details.md +12 -0
- package/docs/api/foundation-user.defaultuser.haspermission.md +22 -0
- package/docs/api/foundation-user.defaultuser.hasprofile.md +22 -0
- package/docs/api/foundation-user.defaultuser.isadmin.md +16 -0
- package/docs/api/foundation-user.defaultuser.isanonymous.md +12 -0
- package/docs/api/foundation-user.defaultuser.isauthenticated.md +12 -0
- package/docs/api/foundation-user.defaultuser.isbanned.md +16 -0
- package/docs/api/foundation-user.defaultuser.lastaction.md +17 -0
- package/docs/api/foundation-user.defaultuser.lastpath.md +19 -0
- package/docs/api/foundation-user.defaultuser.md +51 -0
- package/docs/api/foundation-user.defaultuser.pathhistory.md +13 -0
- package/docs/api/foundation-user.defaultuser.permission.md +12 -0
- package/docs/api/foundation-user.defaultuser.profile.md +12 -0
- package/docs/api/foundation-user.defaultuser.rawproperties.md +18 -0
- package/docs/api/foundation-user.defaultuser.set.md +22 -0
- package/docs/api/foundation-user.defaultuser.sourceref.md +12 -0
- package/docs/api/foundation-user.defaultuser.trackaction.md +24 -0
- package/docs/api/foundation-user.defaultuser.trackpath.md +17 -0
- package/docs/api/foundation-user.defaultuser.unset.md +16 -0
- package/docs/api/foundation-user.defaultuser.userkvs.md +14 -0
- package/docs/api/foundation-user.defaultuser.username.md +12 -0
- package/docs/api/foundation-user.defaultuserconfig.md +13 -0
- package/docs/api/foundation-user.getuser.md +30 -0
- package/docs/api/foundation-user.logger.md +12 -0
- package/docs/api/foundation-user.md +47 -0
- package/docs/api/foundation-user.setuserproperties.details.md +11 -0
- package/docs/api/foundation-user.setuserproperties.md +26 -0
- package/docs/api/foundation-user.setuserproperties.permission.md +11 -0
- package/docs/api/foundation-user.setuserproperties.profile.md +11 -0
- package/docs/api/foundation-user.setuserproperties.sourceref.md +11 -0
- package/docs/api/foundation-user.setuserproperties.userkvs.md +11 -0
- package/docs/api/foundation-user.setuserproperties.username.md +11 -0
- package/docs/api/foundation-user.user.addauthenticationchangelistener.md +33 -0
- package/docs/api/foundation-user.user.cleartrackinghistory.md +15 -0
- package/docs/api/foundation-user.user.details.md +11 -0
- package/docs/api/foundation-user.user.haspermission.md +22 -0
- package/docs/api/foundation-user.user.hasprofile.md +22 -0
- package/docs/api/foundation-user.user.isadmin.md +15 -0
- package/docs/api/foundation-user.user.isanonymous.md +11 -0
- package/docs/api/foundation-user.user.isauthenticated.md +11 -0
- package/docs/api/foundation-user.user.isbanned.md +15 -0
- package/docs/api/foundation-user.user.md +56 -0
- package/docs/api/foundation-user.user.permission.md +11 -0
- package/docs/api/foundation-user.user.profile.md +11 -0
- package/docs/api/foundation-user.user.rawproperties.md +18 -0
- package/docs/api/foundation-user.user.set.md +22 -0
- package/docs/api/foundation-user.user.sourceref.md +11 -0
- package/docs/api/foundation-user.user.unset.md +15 -0
- package/docs/api/foundation-user.user.userkvs.md +13 -0
- package/docs/api/foundation-user.user.username.md +11 -0
- package/docs/api/foundation-user.useractionhistory.actionhistory.md +13 -0
- package/docs/api/foundation-user.useractionhistory.clearactions.md +17 -0
- package/docs/api/foundation-user.useractionhistory.lastaction.md +17 -0
- package/docs/api/foundation-user.useractionhistory.md +32 -0
- package/docs/api/foundation-user.useractionhistory.trackaction.md +24 -0
- package/docs/api/foundation-user.userauthenticationchangeevent.md +18 -0
- package/docs/api/foundation-user.userauthenticationchangetype.md +13 -0
- package/docs/api/foundation-user.userconfig.md +28 -0
- package/docs/api/foundation-user.userconfig.setuser.md +29 -0
- package/docs/api/foundation-user.userconfig.trackactionexclusions.md +15 -0
- package/docs/api/foundation-user.userconfig.trackpathexclusions.md +15 -0
- package/docs/api/foundation-user.userconfig.unsetuser.md +24 -0
- package/docs/api/foundation-user.userdetailsproductproperty.md +20 -0
- package/docs/api/foundation-user.userdetailsproductproperty.name.md +11 -0
- package/docs/api/foundation-user.userdetailsproductproperty.version.md +11 -0
- package/docs/api/foundation-user.userdetailsproperty.daystopasswordexpiry.md +11 -0
- package/docs/api/foundation-user.userdetailsproperty.failedloginattempts.md +11 -0
- package/docs/api/foundation-user.userdetailsproperty.heartbeatintervalsecs.md +11 -0
- package/docs/api/foundation-user.userdetailsproperty.lastlogindatetime.md +11 -0
- package/docs/api/foundation-user.userdetailsproperty.md +25 -0
- package/docs/api/foundation-user.userdetailsproperty.product.md +11 -0
- package/docs/api/foundation-user.userdetailsproperty.rejectedloginattempts.md +11 -0
- package/docs/api/foundation-user.userdetailsproperty.system.md +11 -0
- package/docs/api/foundation-user.userdetailssystemproperty.date.md +11 -0
- package/docs/api/foundation-user.userdetailssystemproperty.md +19 -0
- package/docs/api/foundation-user.userkvsproperty.md +12 -0
- package/docs/api/foundation-user.userpathhistory.clearpaths.md +17 -0
- package/docs/api/foundation-user.userpathhistory.lastpath.md +19 -0
- package/docs/api/foundation-user.userpathhistory.md +32 -0
- package/docs/api/foundation-user.userpathhistory.pathhistory.md +13 -0
- package/docs/api/foundation-user.userpathhistory.trackpath.md +17 -0
- package/docs/api/foundation-user.userqueueproperties.md +22 -0
- package/docs/api/foundation-user.userqueueproperties.updatequeue.md +11 -0
- package/docs/api/foundation-user.userqueueproperties.zeromqproxyinboundport.md +11 -0
- package/docs/api/foundation-user.userqueueproperties.zeromqproxymodeenabled.md +11 -0
- package/docs/api/foundation-user.userqueueproperties.zeromqproxyoutboundport.md +11 -0
- package/docs/api/index.md +12 -0
- package/docs/api-report.md +277 -0
- package/license.txt +46 -0
- package/package.json +48 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { InterfaceSymbol } from '@microsoft/fast-foundation';
|
|
2
|
+
import { Listener } from '@genesislcap/foundation-utils';
|
|
3
|
+
import { Logger } from '@genesislcap/foundation-logger';
|
|
4
|
+
import { Observer } from '@genesislcap/foundation-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Default User implementation.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class DefaultUser implements User {
|
|
11
|
+
/** @internal */
|
|
12
|
+
protected config: UserConfig;
|
|
13
|
+
/** {@inheritDoc UserPathHistory.pathHistory} */
|
|
14
|
+
pathHistory: string[];
|
|
15
|
+
/** {@inheritDoc UserActionHistory.actionHistory} */
|
|
16
|
+
actionHistory: unknown[];
|
|
17
|
+
/** {@inheritDoc User.isAuthenticated} */
|
|
18
|
+
isAuthenticated: boolean;
|
|
19
|
+
/** {@inheritDoc User.userKVs} */
|
|
20
|
+
userKVs: {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
/** {@inheritDoc User.details} */
|
|
24
|
+
details: SetUserProperties['details'];
|
|
25
|
+
/** {@inheritDoc User.permission} */
|
|
26
|
+
permission: string[];
|
|
27
|
+
/** {@inheritDoc User.profile} */
|
|
28
|
+
profile: string[];
|
|
29
|
+
/** {@inheritDoc User.sourceRef} */
|
|
30
|
+
sourceRef: string;
|
|
31
|
+
/** {@inheritDoc User.userName} */
|
|
32
|
+
userName: string;
|
|
33
|
+
/** {@inheritDoc User.rawProperties} */
|
|
34
|
+
rawProperties: Partial<SetUserProperties>;
|
|
35
|
+
/** {@inheritDoc User.set} */
|
|
36
|
+
set(properties: Partial<SetUserProperties>): User;
|
|
37
|
+
/** {@inheritDoc User.unset} */
|
|
38
|
+
unset(): User;
|
|
39
|
+
/** @internal */
|
|
40
|
+
protected userNameChanged(): void;
|
|
41
|
+
/** {@inheritDoc User.username} */
|
|
42
|
+
get username(): string;
|
|
43
|
+
/** {@inheritDoc User.isAnonymous} */
|
|
44
|
+
get isAnonymous(): boolean;
|
|
45
|
+
/** {@inheritDoc User.isAdmin} */
|
|
46
|
+
isAdmin(): boolean;
|
|
47
|
+
/** {@inheritDoc User.isBanned} */
|
|
48
|
+
isBanned(): boolean;
|
|
49
|
+
/** {@inheritDoc User.hasPermission} */
|
|
50
|
+
hasPermission(permission: string | string[]): boolean;
|
|
51
|
+
/** {@inheritDoc User.hasProfile} */
|
|
52
|
+
hasProfile(profile: string | string[]): boolean;
|
|
53
|
+
/** {@inheritDoc UserPathHistory.trackPath} */
|
|
54
|
+
trackPath(): string;
|
|
55
|
+
/** {@inheritDoc UserPathHistory.clearPaths} */
|
|
56
|
+
clearPaths(): void;
|
|
57
|
+
/** {@inheritDoc UserPathHistory.lastPath} */
|
|
58
|
+
lastPath(): string;
|
|
59
|
+
/** {@inheritDoc UserActionHistory.trackAction} */
|
|
60
|
+
trackAction<TDetails = unknown>(details: TDetails): void;
|
|
61
|
+
/** {@inheritDoc UserActionHistory.clearActions} */
|
|
62
|
+
clearActions(): void;
|
|
63
|
+
/** {@inheritDoc UserActionHistory.lastAction} */
|
|
64
|
+
lastAction(): unknown;
|
|
65
|
+
/** {@inheritDoc User.clearTrackingHistory} */
|
|
66
|
+
clearTrackingHistory(): void;
|
|
67
|
+
/** @internal */
|
|
68
|
+
protected hasKey(keys: string[], key: string | string[]): boolean;
|
|
69
|
+
/** @internal */
|
|
70
|
+
protected authenticationChangeListeners: Observer<UserAuthenticationChangeEvent>;
|
|
71
|
+
/** {@inheritDoc User.addAuthenticationChangeListener} */
|
|
72
|
+
addAuthenticationChangeListener(listener: Listener<UserAuthenticationChangeEvent>): () => void;
|
|
73
|
+
/** @internal */
|
|
74
|
+
protected isAuthenticatedChanged(): void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Default UserConfig DI implementation.
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export declare const defaultUserConfig: UserConfig;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Gets User from the DI container.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { getUser, User } from '@genesislcap/foundation-user';
|
|
92
|
+
* ...
|
|
93
|
+
* private user: User = getUser();
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export declare function getUser(): User;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export declare const logger: Logger;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* SetUserProperties is a partial match of `LoginAck` from `@genesislcap/foundation-auth`.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
export declare interface SetUserProperties extends Partial<UserQueueProperties> {
|
|
111
|
+
readonly sourceRef: string;
|
|
112
|
+
readonly userName: string;
|
|
113
|
+
readonly userKVs: UserKVsProperty;
|
|
114
|
+
readonly details: UserDetailsProperty;
|
|
115
|
+
readonly permission: string[];
|
|
116
|
+
readonly profile: string[];
|
|
117
|
+
readonly [key: string]: any;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* User interface.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* The user singleton, which always exists in either an anonymous or authenticated mode.
|
|
125
|
+
*
|
|
126
|
+
* @privateRemarks
|
|
127
|
+
* Provides `username` and `userName` for backwards compatability.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* import { User } from '@genesislcap/foundation-user';
|
|
132
|
+
* ...
|
|
133
|
+
* @User private user: User
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export declare interface User extends UserPathHistory, UserActionHistory {
|
|
139
|
+
readonly isAuthenticated: boolean;
|
|
140
|
+
readonly isAnonymous: boolean;
|
|
141
|
+
readonly userKVs: {
|
|
142
|
+
[key: string]: any;
|
|
143
|
+
};
|
|
144
|
+
readonly details: SetUserProperties['details'];
|
|
145
|
+
readonly permission: string[];
|
|
146
|
+
readonly profile: string[];
|
|
147
|
+
readonly sourceRef: string;
|
|
148
|
+
readonly userName: string;
|
|
149
|
+
readonly username: string;
|
|
150
|
+
/**
|
|
151
|
+
* A structuredClone of the raw unmanaged properties used to set the user.
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* This offers developers an escape hatch to the raw properties. If you feel there's a gap in the User interface based
|
|
155
|
+
* on your application requirements, please raise a request for such properties to be moved onto the interface.
|
|
156
|
+
*/
|
|
157
|
+
readonly rawProperties: Partial<SetUserProperties>;
|
|
158
|
+
/**
|
|
159
|
+
* @param properties - The UserProperties used to populate the User.
|
|
160
|
+
*/
|
|
161
|
+
set(properties: Partial<SetUserProperties>): User;
|
|
162
|
+
unset(): User;
|
|
163
|
+
isAdmin(): boolean;
|
|
164
|
+
isBanned(): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* @param permission - A permission string or an array of permission strings to check.
|
|
167
|
+
*/
|
|
168
|
+
hasPermission(permission: string | string[]): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* @param profile - A profile string or an array of profile strings to check.
|
|
171
|
+
*/
|
|
172
|
+
hasProfile(profile: string | string[]): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import type { UserAuthenticationChangeEvent } from '@genesislcap/foundation-user';
|
|
177
|
+
* ...
|
|
178
|
+
* const unsubscribe = this.user.addAuthenticationChangeListener((event: UserAuthenticationChangeEvent) => {
|
|
179
|
+
* console.log('User authenticated?', event.detail);
|
|
180
|
+
* });
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* @param listener - A listener function.
|
|
184
|
+
*/
|
|
185
|
+
addAuthenticationChangeListener(listener: Listener<UserAuthenticationChangeEvent>): () => void;
|
|
186
|
+
clearTrackingHistory(): void;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* User DI key.
|
|
191
|
+
*
|
|
192
|
+
* @privateRemarks
|
|
193
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
194
|
+
*
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
export declare const User: InterfaceSymbol<User>;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* UserActionHistory.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* APIs to track a user's action history.
|
|
204
|
+
*
|
|
205
|
+
* @privateRemarks
|
|
206
|
+
* Integrate with foundation analytics? Users could then simply call `user.trackAction` and we could engage analytics.
|
|
207
|
+
* We should move analytics out of comms first.
|
|
208
|
+
*
|
|
209
|
+
* @public
|
|
210
|
+
*/
|
|
211
|
+
export declare interface UserActionHistory {
|
|
212
|
+
/**
|
|
213
|
+
* Array of actions that have been tracked.
|
|
214
|
+
*/
|
|
215
|
+
readonly actionHistory: unknown[];
|
|
216
|
+
/**
|
|
217
|
+
* Track an action.
|
|
218
|
+
*/
|
|
219
|
+
trackAction<TDetails = unknown>(details: TDetails): void;
|
|
220
|
+
/**
|
|
221
|
+
* Clears action history.
|
|
222
|
+
*/
|
|
223
|
+
clearActions(): void;
|
|
224
|
+
/**
|
|
225
|
+
* @returns The last stored action.
|
|
226
|
+
*/
|
|
227
|
+
lastAction(): unknown;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* UserAuthenticationChangeEvent.
|
|
232
|
+
*
|
|
233
|
+
* @remarks
|
|
234
|
+
* Detail will either be `true` or `false` to indicate authentication status.
|
|
235
|
+
*
|
|
236
|
+
* @public
|
|
237
|
+
*/
|
|
238
|
+
export declare type UserAuthenticationChangeEvent = CustomEvent<boolean>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* UserAuthenticationChangeType.
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
export declare const UserAuthenticationChangeType = "user-authentication-change";
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* UserConfig DI interface.
|
|
248
|
+
*
|
|
249
|
+
* @public
|
|
250
|
+
*/
|
|
251
|
+
export declare interface UserConfig {
|
|
252
|
+
/**
|
|
253
|
+
* Exclude certain actions from tracking.
|
|
254
|
+
*
|
|
255
|
+
* See {@link UserPathHistory}
|
|
256
|
+
*/
|
|
257
|
+
trackActionExclusions: unknown[];
|
|
258
|
+
/**
|
|
259
|
+
* Exclude certain paths from tracking.
|
|
260
|
+
*
|
|
261
|
+
* See {@link UserActionHistory}
|
|
262
|
+
*/
|
|
263
|
+
trackPathExclusions: string[];
|
|
264
|
+
/**
|
|
265
|
+
* User property setter.
|
|
266
|
+
*
|
|
267
|
+
* @remarks
|
|
268
|
+
* The user is typically set from the result of a LoginAck.
|
|
269
|
+
*/
|
|
270
|
+
setUser(user: WriteableUser, properties: Partial<SetUserProperties>): User;
|
|
271
|
+
/**
|
|
272
|
+
* User property un-setter.
|
|
273
|
+
*/
|
|
274
|
+
unsetUser(user: WriteableUser): User;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* UserConfig DI key.
|
|
279
|
+
*
|
|
280
|
+
* @internal
|
|
281
|
+
* @privateRemarks
|
|
282
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
283
|
+
*/
|
|
284
|
+
export declare const UserConfig: InterfaceSymbol<UserConfig>;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @public
|
|
288
|
+
*/
|
|
289
|
+
export declare interface UserDetailsProductProperty {
|
|
290
|
+
readonly name: string;
|
|
291
|
+
readonly version: string;
|
|
292
|
+
readonly [key: string]: any;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @public
|
|
297
|
+
*/
|
|
298
|
+
export declare interface UserDetailsProperty {
|
|
299
|
+
readonly system: UserDetailsSystemProperty;
|
|
300
|
+
readonly product: UserDetailsProductProperty[];
|
|
301
|
+
readonly heartbeatIntervalSecs: number;
|
|
302
|
+
readonly failedLoginAttempts: number;
|
|
303
|
+
readonly rejectedLoginAttempts: number;
|
|
304
|
+
readonly lastLoginDatetime: number;
|
|
305
|
+
readonly daysToPasswordExpiry: number;
|
|
306
|
+
readonly [key: string]: any;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* @public
|
|
311
|
+
*/
|
|
312
|
+
export declare interface UserDetailsSystemProperty {
|
|
313
|
+
readonly date: string;
|
|
314
|
+
readonly [key: string]: any;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* @public
|
|
319
|
+
*/
|
|
320
|
+
export declare interface UserKVsProperty {
|
|
321
|
+
readonly [key: string]: any;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* UserPathHistory.
|
|
326
|
+
*
|
|
327
|
+
* @remarks
|
|
328
|
+
* APIs to track a user's path history. Includes the pathname, search and hash only.
|
|
329
|
+
* This is not intended proxy or replace the History API.
|
|
330
|
+
*
|
|
331
|
+
* @privateRemarks
|
|
332
|
+
* Integrate with foundation analytics? Users could then simply call `user.trackPath` and we could engage analytics.
|
|
333
|
+
* We should move analytics out of comms first.
|
|
334
|
+
*
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
export declare interface UserPathHistory {
|
|
338
|
+
/**
|
|
339
|
+
* Array of paths that have been tracked.
|
|
340
|
+
*/
|
|
341
|
+
readonly pathHistory: string[];
|
|
342
|
+
/**
|
|
343
|
+
* Track current path.
|
|
344
|
+
*/
|
|
345
|
+
trackPath(): string;
|
|
346
|
+
/**
|
|
347
|
+
* Clears path history.
|
|
348
|
+
*/
|
|
349
|
+
clearPaths(): void;
|
|
350
|
+
/**
|
|
351
|
+
* May be used to return to a target path after authentication.
|
|
352
|
+
* @returns The last stored path.
|
|
353
|
+
*/
|
|
354
|
+
lastPath(): string | undefined;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @public
|
|
359
|
+
*/
|
|
360
|
+
export declare interface UserQueueProperties {
|
|
361
|
+
readonly updateQueue: string;
|
|
362
|
+
readonly zeroMqProxyModeEnabled: boolean;
|
|
363
|
+
readonly zeroMqProxyInboundPort: number;
|
|
364
|
+
readonly zeroMqProxyOutboundPort: number;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @internal
|
|
369
|
+
*/
|
|
370
|
+
declare type WriteableUser = {
|
|
371
|
+
-readonly [P in keyof User]: User[P];
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
export { }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [actionHistory](./foundation-user.defaultuser.actionhistory.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.actionHistory property
|
|
6
|
+
|
|
7
|
+
Array of actions that have been tracked.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
actionHistory: unknown[];
|
|
13
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [addAuthenticationChangeListener](./foundation-user.defaultuser.addauthenticationchangelistener.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.addAuthenticationChangeListener() method
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
addAuthenticationChangeListener(listener: Listener<UserAuthenticationChangeEvent>): () => void;
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Type | Description |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| listener | Listener<[UserAuthenticationChangeEvent](./foundation-user.userauthenticationchangeevent.md)<!-- -->> | A listener function. |
|
|
18
|
+
|
|
19
|
+
**Returns:**
|
|
20
|
+
|
|
21
|
+
() => void
|
|
22
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [clearActions](./foundation-user.defaultuser.clearactions.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.clearActions() method
|
|
6
|
+
|
|
7
|
+
Clears action history.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
clearActions(): void;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
void
|
|
17
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [clearPaths](./foundation-user.defaultuser.clearpaths.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.clearPaths() method
|
|
6
|
+
|
|
7
|
+
Clears path history.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
clearPaths(): void;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
void
|
|
17
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [clearTrackingHistory](./foundation-user.defaultuser.cleartrackinghistory.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.clearTrackingHistory() method
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
clearTrackingHistory(): void;
|
|
12
|
+
```
|
|
13
|
+
**Returns:**
|
|
14
|
+
|
|
15
|
+
void
|
|
16
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [details](./foundation-user.defaultuser.details.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.details property
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
details: SetUserProperties['details'];
|
|
12
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [hasPermission](./foundation-user.defaultuser.haspermission.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.hasPermission() method
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
hasPermission(permission: string | string[]): boolean;
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Type | Description |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| permission | string \| string\[\] | A permission string or an array of permission strings to check. |
|
|
18
|
+
|
|
19
|
+
**Returns:**
|
|
20
|
+
|
|
21
|
+
boolean
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [hasProfile](./foundation-user.defaultuser.hasprofile.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.hasProfile() method
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
hasProfile(profile: string | string[]): boolean;
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Type | Description |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| profile | string \| string\[\] | A profile string or an array of profile strings to check. |
|
|
18
|
+
|
|
19
|
+
**Returns:**
|
|
20
|
+
|
|
21
|
+
boolean
|
|
22
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [isAdmin](./foundation-user.defaultuser.isadmin.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.isAdmin() method
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
isAdmin(): boolean;
|
|
12
|
+
```
|
|
13
|
+
**Returns:**
|
|
14
|
+
|
|
15
|
+
boolean
|
|
16
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [isAnonymous](./foundation-user.defaultuser.isanonymous.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.isAnonymous property
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
get isAnonymous(): boolean;
|
|
12
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [isAuthenticated](./foundation-user.defaultuser.isauthenticated.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.isAuthenticated property
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
isAuthenticated: boolean;
|
|
12
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [isBanned](./foundation-user.defaultuser.isbanned.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.isBanned() method
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
isBanned(): boolean;
|
|
12
|
+
```
|
|
13
|
+
**Returns:**
|
|
14
|
+
|
|
15
|
+
boolean
|
|
16
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [lastAction](./foundation-user.defaultuser.lastaction.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.lastAction() method
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
lastAction(): unknown;
|
|
11
|
+
```
|
|
12
|
+
**Returns:**
|
|
13
|
+
|
|
14
|
+
unknown
|
|
15
|
+
|
|
16
|
+
The last stored action.
|
|
17
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md) > [lastPath](./foundation-user.defaultuser.lastpath.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser.lastPath() method
|
|
6
|
+
|
|
7
|
+
May be used to return to a target path after authentication.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
lastPath(): string;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
string
|
|
17
|
+
|
|
18
|
+
The last stored path.
|
|
19
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-user](./foundation-user.md) > [DefaultUser](./foundation-user.defaultuser.md)
|
|
4
|
+
|
|
5
|
+
## DefaultUser class
|
|
6
|
+
|
|
7
|
+
Default User implementation.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare class DefaultUser implements User
|
|
13
|
+
```
|
|
14
|
+
**Implements:** [User](./foundation-user.user.md)
|
|
15
|
+
|
|
16
|
+
## Properties
|
|
17
|
+
|
|
18
|
+
| Property | Modifiers | Type | Description |
|
|
19
|
+
| --- | --- | --- | --- |
|
|
20
|
+
| [actionHistory](./foundation-user.defaultuser.actionhistory.md) | | unknown\[\] | Array of actions that have been tracked. |
|
|
21
|
+
| [details](./foundation-user.defaultuser.details.md) | | [SetUserProperties](./foundation-user.setuserproperties.md)<!-- -->\['details'\] | |
|
|
22
|
+
| [isAnonymous](./foundation-user.defaultuser.isanonymous.md) | <code>readonly</code> | boolean | |
|
|
23
|
+
| [isAuthenticated](./foundation-user.defaultuser.isauthenticated.md) | | boolean | |
|
|
24
|
+
| [pathHistory](./foundation-user.defaultuser.pathhistory.md) | | string\[\] | Array of paths that have been tracked. |
|
|
25
|
+
| [permission](./foundation-user.defaultuser.permission.md) | | string\[\] | |
|
|
26
|
+
| [profile](./foundation-user.defaultuser.profile.md) | | string\[\] | |
|
|
27
|
+
| [rawProperties](./foundation-user.defaultuser.rawproperties.md) | | Partial<[SetUserProperties](./foundation-user.setuserproperties.md)<!-- -->> | A structuredClone of the raw unmanaged properties used to set the user. |
|
|
28
|
+
| [sourceRef](./foundation-user.defaultuser.sourceref.md) | | string | |
|
|
29
|
+
| [userKVs](./foundation-user.defaultuser.userkvs.md) | | { \[key: string\]: any; } | |
|
|
30
|
+
| [username](./foundation-user.defaultuser.username.md) | <code>readonly</code> | string | |
|
|
31
|
+
| [userName](./foundation-user.defaultuser.username.md) | | string | |
|
|
32
|
+
|
|
33
|
+
## Methods
|
|
34
|
+
|
|
35
|
+
| Method | Modifiers | Description |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| [addAuthenticationChangeListener(listener)](./foundation-user.defaultuser.addauthenticationchangelistener.md) | | |
|
|
38
|
+
| [clearActions()](./foundation-user.defaultuser.clearactions.md) | | Clears action history. |
|
|
39
|
+
| [clearPaths()](./foundation-user.defaultuser.clearpaths.md) | | Clears path history. |
|
|
40
|
+
| [clearTrackingHistory()](./foundation-user.defaultuser.cleartrackinghistory.md) | | |
|
|
41
|
+
| [hasPermission(permission)](./foundation-user.defaultuser.haspermission.md) | | |
|
|
42
|
+
| [hasProfile(profile)](./foundation-user.defaultuser.hasprofile.md) | | |
|
|
43
|
+
| [isAdmin()](./foundation-user.defaultuser.isadmin.md) | | |
|
|
44
|
+
| [isBanned()](./foundation-user.defaultuser.isbanned.md) | | |
|
|
45
|
+
| [lastAction()](./foundation-user.defaultuser.lastaction.md) | | |
|
|
46
|
+
| [lastPath()](./foundation-user.defaultuser.lastpath.md) | | May be used to return to a target path after authentication. |
|
|
47
|
+
| [set(properties)](./foundation-user.defaultuser.set.md) | | |
|
|
48
|
+
| [trackAction(details)](./foundation-user.defaultuser.trackaction.md) | | Track an action. |
|
|
49
|
+
| [trackPath()](./foundation-user.defaultuser.trackpath.md) | | Track current path. |
|
|
50
|
+
| [unset()](./foundation-user.defaultuser.unset.md) | | |
|
|
51
|
+
|