@arsedizioni/ars-utils 22.5.14 → 22.5.16
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/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +101 -26
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +5 -5
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +85 -25
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
- package/package.json +1 -1
- package/types/arsedizioni-ars-utils-clipper.common.d.ts +54 -10
- package/types/arsedizioni-ars-utils-evolution.common.d.ts +39 -11
|
@@ -201,6 +201,19 @@ interface ClipperUserInfo {
|
|
|
201
201
|
interface ClipperLoginResult extends LoginResult<ClipperUserInfo> {
|
|
202
202
|
settings?: ClipperChannelSettings[];
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Answer of `GET /session/status`: whether this browser holds a live session towards the Clipper API.
|
|
206
|
+
*
|
|
207
|
+
* This is the probe behind the link state. The auth cookie is HttpOnly and belongs to the API's
|
|
208
|
+
* host, so nothing here can read it, and its presence would prove nothing anyway — the session also
|
|
209
|
+
* lives server-side and may have been revoked or evicted. The endpoint never answers 401, which is
|
|
210
|
+
* what makes it safe to call with no session at all: a probe that failed with a status code would be
|
|
211
|
+
* reported by the interceptor as an expired session.
|
|
212
|
+
*/
|
|
213
|
+
interface ClipperSessionStatus {
|
|
214
|
+
/** True when the cookie this browser presented resolves to a live, validated session. */
|
|
215
|
+
connected: boolean;
|
|
216
|
+
}
|
|
204
217
|
interface ClipperLoginInfo {
|
|
205
218
|
context?: ClipperUserInfo;
|
|
206
219
|
channels?: ClipperChannelSettings[];
|
|
@@ -1005,12 +1018,22 @@ declare class ClipperLoginService {
|
|
|
1005
1018
|
/** Whether {@link initialize} has already run. */
|
|
1006
1019
|
private initialized;
|
|
1007
1020
|
/**
|
|
1008
|
-
*
|
|
1021
|
+
* Gets the signed-in account.
|
|
1022
|
+
* @returns The current {@link ClipperUserInfo}, or `undefined` when there is no session.
|
|
1023
|
+
*/
|
|
1024
|
+
get user(): ClipperUserInfo | undefined;
|
|
1025
|
+
/**
|
|
1026
|
+
* Establishes the session state at bootstrap by asking the API — the only party that can read the
|
|
1027
|
+
* HttpOnly cookie — whether this browser still holds one.
|
|
1009
1028
|
*
|
|
1010
1029
|
* Called by `ClipperService.initialize`, right after `ClipperCoreService.initialize`, so a
|
|
1011
|
-
* consumer gets the restore for free and never has to know this method exists.
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1030
|
+
* consumer gets the restore for free and never has to know this method exists.
|
|
1031
|
+
*
|
|
1032
|
+
* The probe now runs UNCONDITIONALLY, where it used to run only when a stored context existed.
|
|
1033
|
+
* The stored context is just a hint — "this browser signed in at some point" — and the cookie can
|
|
1034
|
+
* outlive it: local storage cleared while the month-long cookie stayed put made this library
|
|
1035
|
+
* declare "no link" with a perfectly valid session in the browser. The API is the only source of
|
|
1036
|
+
* truth on the matter, so it is asked every time.
|
|
1014
1037
|
*
|
|
1015
1038
|
* A host application that drives its own return from an external provider, or that starts on its
|
|
1016
1039
|
* own sign-in page, should call `core.setLoggedIn(false)` before bootstrapping rather than let
|
|
@@ -1019,12 +1042,17 @@ declare class ClipperLoginService {
|
|
|
1019
1042
|
*/
|
|
1020
1043
|
initialize(): void;
|
|
1021
1044
|
/**
|
|
1022
|
-
* Asks `/session/
|
|
1023
|
-
*
|
|
1045
|
+
* Asks `/session/status` whether this browser holds a live session, and hydrates the context
|
|
1046
|
+
* through {@link me} when it does.
|
|
1047
|
+
*
|
|
1048
|
+
* The probe is silent by construction: `/session/status` never answers 401, so a visitor who
|
|
1049
|
+
* never signed in — or a cookie whose session has died — comes back as `connected: false` with no
|
|
1050
|
+
* error broadcast and no dialog. Only then is the stale stored context cleared, so the `loggedIn`
|
|
1051
|
+
* signal tells the truth at every bootstrap.
|
|
1024
1052
|
*
|
|
1025
|
-
* Nothing is cleared on failure, and that is deliberate:
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1053
|
+
* Nothing is cleared on a transport failure, and that is deliberate: an unreachable API is not
|
|
1054
|
+
* proof of a dead session — the proxy may have answered 502, the device may be offline — and
|
|
1055
|
+
* clearing on any of those would sign the user out with a perfectly valid cookie.
|
|
1028
1056
|
* @returns void
|
|
1029
1057
|
*/
|
|
1030
1058
|
private restoreSession;
|
|
@@ -1057,6 +1085,15 @@ declare class ClipperLoginService {
|
|
|
1057
1085
|
* @returns An observable that emits once the logout has been processed.
|
|
1058
1086
|
*/
|
|
1059
1087
|
logout(): Observable<ApiResult<unknown>>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Asks the API whether this browser holds a live session, without ever failing with a 401: the
|
|
1090
|
+
* route is anonymous and answers `connected: false` to a caller with no session. This is the one
|
|
1091
|
+
* honest way to know the link state — the auth cookie is HttpOnly and belongs to the API's host,
|
|
1092
|
+
* so it cannot be read from here, and its presence would prove nothing anyway, since the session
|
|
1093
|
+
* also lives server-side and may have been revoked or evicted.
|
|
1094
|
+
* @returns An observable emitting the API result wrapping the session status.
|
|
1095
|
+
*/
|
|
1096
|
+
status(): Observable<ApiResult<ClipperSessionStatus>>;
|
|
1060
1097
|
/**
|
|
1061
1098
|
* Reads the current session from the server, which resolves it from the auth cookie claims
|
|
1062
1099
|
* without touching the database. Used to restore the state after a page refresh instead of
|
|
@@ -1125,6 +1162,8 @@ declare class ClipperService {
|
|
|
1125
1162
|
get flags(): ClipperServiceFlags;
|
|
1126
1163
|
/** @returns The current login context, or `undefined` if not authenticated. */
|
|
1127
1164
|
get loginInfo(): ClipperLoginInfo | undefined;
|
|
1165
|
+
/** @returns The signed-in account, or `undefined` when there is no session. */
|
|
1166
|
+
get user(): ClipperUserInfo | undefined;
|
|
1128
1167
|
/** @returns A read-only signal indicating whether the user is logged in. */
|
|
1129
1168
|
get loggedIn(): Signal<boolean>;
|
|
1130
1169
|
/** @returns A signal indicating whether a login is in progress. */
|
|
@@ -1199,6 +1238,11 @@ declare class ClipperCoreService {
|
|
|
1199
1238
|
* @returns The current login context, or `undefined` if not authenticated.
|
|
1200
1239
|
*/
|
|
1201
1240
|
get loginInfo(): ClipperLoginInfo | undefined;
|
|
1241
|
+
/**
|
|
1242
|
+
* Gets the signed-in account.
|
|
1243
|
+
* @returns The current {@link ClipperUserInfo}, or `undefined` when there is no session.
|
|
1244
|
+
*/
|
|
1245
|
+
get user(): ClipperUserInfo | undefined;
|
|
1202
1246
|
/**
|
|
1203
1247
|
* Seeded from the stored context, which is the only trace a session leaves on this device: the
|
|
1204
1248
|
* auth cookie is HttpOnly and unreadable from here. It means "there WAS a session", never "there
|
|
@@ -1287,4 +1331,4 @@ declare class ClipperCoreService {
|
|
|
1287
1331
|
}
|
|
1288
1332
|
|
|
1289
1333
|
export { ClipperAccountService, ClipperAuthors, ClipperCalendarSearchParams, ClipperCalendarState, ClipperCalendarStates, ClipperChannel, ClipperChannelSettings, ClipperChannels, ClipperCoreService, ClipperDashboard, ClipperDocumentChangeReasons, ClipperDocumentContainer, ClipperDocumentsService, ClipperExportDocumentsFormat, ClipperFacet, ClipperLoginService, ClipperMessages, ClipperModel, ClipperModels, ClipperModule, ClipperModuleGroup, ClipperModuleGroups, ClipperModules, ClipperQueryDocumentFlags, ClipperQueryReferencesMode, ClipperRegions, ClipperSearchCalendarSnapshotResult, ClipperSearchFacetsSnapshot, ClipperSearchParams, ClipperSearchResult, ClipperSearchUtils, ClipperSectorTypes, ClipperSectors, ClipperSelectionMode, ClipperService, ClipperServiceFlags, ClipperSort, ClipperSources, ClipperUtils, clipperAuthInterceptor };
|
|
1290
|
-
export type { ClipperAvailableChannel, ClipperChannelSettingsItem, ClipperDashboardItem, ClipperDashboardModelItem, ClipperDeleteWorkingDocumentsParams, ClipperDocumentAnchorInfo, ClipperDocumentInfo, ClipperDocumentNote, ClipperDocumentNoteTracking, ClipperDocumentRelevantChunkHit, ClipperDocumentRelevants, ClipperDocumentStructure, ClipperDocumentUpdateStateParams, ClipperExportDocumentsParams, ClipperLoginInfo, ClipperLoginResult, ClipperOTPInfo, ClipperReferencesSearchParams, ClipperSearchCalendarSnapshotMonth, ClipperSearchFacet, ClipperSearchFacetGroup, ClipperSearchFacetsResult, ClipperSearchFilter, ClipperSendDocumentsByEmailParams, ClipperTaxonomyParams, ClipperTopicInfo, ClipperUserChannelInfo, ClipperUserInfo, ClipperUserSearch, ClipperUserTrialInfo, ClipperUserWorkingDocument, EditedEventArgs, SectorInfo };
|
|
1334
|
+
export type { ClipperAvailableChannel, ClipperChannelSettingsItem, ClipperDashboardItem, ClipperDashboardModelItem, ClipperDeleteWorkingDocumentsParams, ClipperDocumentAnchorInfo, ClipperDocumentInfo, ClipperDocumentNote, ClipperDocumentNoteTracking, ClipperDocumentRelevantChunkHit, ClipperDocumentRelevants, ClipperDocumentStructure, ClipperDocumentUpdateStateParams, ClipperExportDocumentsParams, ClipperLoginInfo, ClipperLoginResult, ClipperOTPInfo, ClipperReferencesSearchParams, ClipperSearchCalendarSnapshotMonth, ClipperSearchFacet, ClipperSearchFacetGroup, ClipperSearchFacetsResult, ClipperSearchFilter, ClipperSendDocumentsByEmailParams, ClipperSessionStatus, ClipperTaxonomyParams, ClipperTopicInfo, ClipperUserChannelInfo, ClipperUserInfo, ClipperUserSearch, ClipperUserTrialInfo, ClipperUserWorkingDocument, EditedEventArgs, SectorInfo };
|
|
@@ -46,6 +46,20 @@ interface EvolutionLoginResult {
|
|
|
46
46
|
*/
|
|
47
47
|
requiresPasswordChange?: boolean;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Answer of `GET /session/status`: whether this browser holds a live session towards the Evolution
|
|
51
|
+
* API.
|
|
52
|
+
*
|
|
53
|
+
* This is the probe behind the link state. The auth cookie is HttpOnly and belongs to the API's
|
|
54
|
+
* host, so nothing here can read it, and its presence would prove nothing anyway — the session also
|
|
55
|
+
* lives server-side and may have been revoked or evicted. The endpoint never answers 401, which is
|
|
56
|
+
* what makes it safe to call with no session at all: a probe that failed with a status code would be
|
|
57
|
+
* reported by the interceptor as an expired session.
|
|
58
|
+
*/
|
|
59
|
+
interface EvolutionSessionStatus {
|
|
60
|
+
/** True when the cookie this browser presented resolves to a live, validated session. */
|
|
61
|
+
connected: boolean;
|
|
62
|
+
}
|
|
49
63
|
/**
|
|
50
64
|
* The session as this library holds it, persisted so a page refresh has something to validate.
|
|
51
65
|
*
|
|
@@ -957,8 +971,8 @@ declare class LoginService {
|
|
|
957
971
|
*/
|
|
958
972
|
clear(): void;
|
|
959
973
|
/**
|
|
960
|
-
* Initialises the service with the back-end URI and optional feature flags, and
|
|
961
|
-
*
|
|
974
|
+
* Initialises the service with the back-end URI and optional feature flags, and asks the API — the
|
|
975
|
+
* only party that can read the HttpOnly cookie — whether this browser still holds a session.
|
|
962
976
|
*
|
|
963
977
|
* Must be called once during application bootstrap, before any other method. What it used to do
|
|
964
978
|
* on a refresh was announce `LOGIN_COMPLETED` on the strength of a value in local storage; the
|
|
@@ -1009,6 +1023,15 @@ declare class LoginService {
|
|
|
1009
1023
|
* @returns An observable that emits the `ApiResult<EvolutionLoginResult>`.
|
|
1010
1024
|
*/
|
|
1011
1025
|
confirmIdentity(code: string, email?: string): Observable<ApiResult<EvolutionLoginResult>>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Asks the API whether this browser holds a live session, without ever failing with a 401: the
|
|
1028
|
+
* route is anonymous and answers `connected: false` to a caller with no session. This is the one
|
|
1029
|
+
* honest way to know the link state -- the auth cookie is HttpOnly and belongs to the API's host,
|
|
1030
|
+
* so it cannot be read from here, and its presence would prove nothing anyway, since the session
|
|
1031
|
+
* also lives server-side and may have been revoked or evicted.
|
|
1032
|
+
* @returns An observable that emits the `ApiResult<EvolutionSessionStatus>`.
|
|
1033
|
+
*/
|
|
1034
|
+
status(): Observable<ApiResult<EvolutionSessionStatus>>;
|
|
1012
1035
|
/**
|
|
1013
1036
|
* Reads the current session from the server, which resolves it from the auth cookie's claims.
|
|
1014
1037
|
* Used to restore the state after a page refresh instead of trusting what local storage holds.
|
|
@@ -1020,13 +1043,17 @@ declare class LoginService {
|
|
|
1020
1043
|
*/
|
|
1021
1044
|
me(): Observable<ApiResult<EvolutionLoginResult>>;
|
|
1022
1045
|
/**
|
|
1023
|
-
* Asks `/session/
|
|
1024
|
-
*
|
|
1046
|
+
* Asks `/session/status` whether this browser holds a live session, and hydrates the context
|
|
1047
|
+
* through {@link me} when it does.
|
|
1048
|
+
*
|
|
1049
|
+
* The probe is silent by construction: `/session/status` never answers 401, so a visitor who
|
|
1050
|
+
* never signed in -- or a cookie whose session has died -- comes back as `connected: false` with
|
|
1051
|
+
* no error broadcast and no dialog. Only then is the stale stored context cleared, so the
|
|
1052
|
+
* `loggedIn` signal tells the truth at every bootstrap.
|
|
1025
1053
|
*
|
|
1026
|
-
* Nothing is cleared on failure, and that is deliberate:
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
* A genuine 401 is a different matter and the interceptor has already reported it.
|
|
1054
|
+
* Nothing is cleared on a transport failure, and that is deliberate: an unreachable API is not
|
|
1055
|
+
* proof of a dead session -- the proxy may have answered 502, the device may be offline -- and
|
|
1056
|
+
* clearing on any of those would sign the user out with a perfectly valid cookie.
|
|
1030
1057
|
* @returns void
|
|
1031
1058
|
*/
|
|
1032
1059
|
private restoreSession;
|
|
@@ -1239,8 +1266,9 @@ declare class EvolutionService {
|
|
|
1239
1266
|
get user(): EvolutionUserInfo | undefined;
|
|
1240
1267
|
/**
|
|
1241
1268
|
* `true` when this browser has a session the API has accepted. It starts from the stored context
|
|
1242
|
-
* and is
|
|
1243
|
-
*
|
|
1269
|
+
* and is settled -- raised or cleared -- by the silent `/session/status` probe {@link initialize}
|
|
1270
|
+
* makes, which is the one honest way to read a state that lives in an HttpOnly cookie plus a
|
|
1271
|
+
* server-side lease. This signal IS the link state: bind it, do not poll it.
|
|
1244
1272
|
*/
|
|
1245
1273
|
get loggedIn(): Signal<boolean>;
|
|
1246
1274
|
/** `true` while an authentication is in flight. */
|
|
@@ -1262,4 +1290,4 @@ declare class EvolutionService {
|
|
|
1262
1290
|
}
|
|
1263
1291
|
|
|
1264
1292
|
export { AccountService, ComplianceService, ERPComplianceActivityState, ERPComplianceLawOrigin, ERPComplianceLawState, ERPComplianceLawsSelectionType, ERPComplianceNotificationLimit, ERPComplianceProfileFlags, ERPComplianceProfileRole, ERPComplianceRegisterNotificationType, ERPComplianceRegisterSiteImportOptions, ERPComplianceScope, ERPExportFormat, ERPExportPart, ERPExportSource, ERPExportType, ERPModule, ERPPlace, ERPPlacePermission, ERPRecurrenceFrequencyType, EVOLUTION_ACTIVE_ACCOUNT_KEY, EvolutionComplianceActivityStates, EvolutionComplianceContextInfo, EvolutionComplianceLawChangeStates, EvolutionComplianceLawOrigins, EvolutionComplianceLawStates, EvolutionComplianceNotificationLimits, EvolutionComplianceNotifications, EvolutionComplianceObligationAuthorities, EvolutionComplianceObligationTypes, EvolutionComplianceProfileFlags, EvolutionComplianceProfileRoles, EvolutionComplianceScopes, EvolutionMessages, EvolutionRecurrenceFrequencyTypes, EvolutionService, EvolutionServiceFlags, LoginService, evolutionAuthInterceptor };
|
|
1265
|
-
export type { ComplianceRegisterUsersResultModel, EvolutionChangeContextModel, EvolutionChangeContextResultModel, EvolutionComplianceActivitiesAddParams, EvolutionComplianceActivity, EvolutionComplianceLaswExportParams, EvolutionComplianceLaw, EvolutionComplianceLawDocumentInfo, EvolutionComplianceLawReference, EvolutionComplianceLawsAddParams, EvolutionComplianceRegister, EvolutionComplianceRegisterProfile, EvolutionComplianceRegisterSite, EvolutionContextInfo, EvolutionExportModel, EvolutionLicenceModuleInfo, EvolutionLoginInfo, EvolutionLoginResult, EvolutionPermission, EvolutionPlacePermission, EvolutionPlaceable, EvolutionQueryRegisterProfilesModel, EvolutionRecoverPasswordModel, EvolutionRegisterProfileSiteInfo, EvolutionRegisterProfileUserInfo, EvolutionResetPasswordModel, EvolutionUpdateUserSettingsModel, EvolutionUserInfo, EvolutionUserLink, EvolutionUserModuleInfo };
|
|
1293
|
+
export type { ComplianceRegisterUsersResultModel, EvolutionChangeContextModel, EvolutionChangeContextResultModel, EvolutionComplianceActivitiesAddParams, EvolutionComplianceActivity, EvolutionComplianceLaswExportParams, EvolutionComplianceLaw, EvolutionComplianceLawDocumentInfo, EvolutionComplianceLawReference, EvolutionComplianceLawsAddParams, EvolutionComplianceRegister, EvolutionComplianceRegisterProfile, EvolutionComplianceRegisterSite, EvolutionContextInfo, EvolutionExportModel, EvolutionLicenceModuleInfo, EvolutionLoginInfo, EvolutionLoginResult, EvolutionPermission, EvolutionPlacePermission, EvolutionPlaceable, EvolutionQueryRegisterProfilesModel, EvolutionRecoverPasswordModel, EvolutionRegisterProfileSiteInfo, EvolutionRegisterProfileUserInfo, EvolutionResetPasswordModel, EvolutionSessionStatus, EvolutionUpdateUserSettingsModel, EvolutionUserInfo, EvolutionUserLink, EvolutionUserModuleInfo };
|