@newheap/platform-common 1.4.0 → 2.0.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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as i20 from '@angular/common';
2
2
  import { KeyValue } from '@angular/common';
3
- import { HttpHeaders, HttpParams, HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpClient, HttpResponse } from '@angular/common/http';
3
+ import { HttpHeaders, HttpParams, HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpClient, HttpContextToken, HttpResponse } from '@angular/common/http';
4
4
  import * as i21 from '@ngx-translate/core';
5
5
  import { TranslateService, TranslateLoader } from '@ngx-translate/core';
6
6
  import * as rxjs from 'rxjs';
@@ -63,6 +63,11 @@ declare class AuthenticationNhCommonModuleConfig {
63
63
  additionalDivisionClaimPermissionTypes: string[];
64
64
  endpoints: EndpointsAuthenticationNhCommonModuleConfig;
65
65
  loginPath: string;
66
+ /**
67
+ * Ends the local session when the API answers 401 and the account endpoint confirms that the
68
+ * server no longer accepts the session, for example after a password change on another device.
69
+ */
70
+ endSessionRejectedByServer: boolean;
66
71
  constructor(init?: Partial<AuthenticationNhCommonModuleConfig>);
67
72
  }
68
73
  declare class UserNotificationNhCommonModuleConfig {
@@ -445,6 +450,8 @@ declare class AuthSessionExpirationInformation {
445
450
  isAuthenticated: boolean;
446
451
  expiresWithin15MinutesOrExpired: boolean;
447
452
  displayMinutesSecondsUntilExpiration: string;
453
+ /** The server rejected the session before it expired; it stays set until the next sign-in. */
454
+ rejectedByServer: boolean;
448
455
  constructor(init?: Partial<AuthSessionExpirationInformation>);
449
456
  }
450
457
  declare class RefreshTokenLoginAccountMutateModel {
@@ -1304,10 +1311,13 @@ declare class NhPasskeyClient {
1304
1311
  static ɵprov: i0.ɵɵInjectableDeclaration<NhPasskeyClient>;
1305
1312
  }
1306
1313
 
1314
+ /** Marks a request whose 401 must not start a server session check, such as the check itself. */
1315
+ declare const NH_SKIP_SERVER_SESSION_CHECK: HttpContextToken<boolean>;
1307
1316
  declare abstract class BaseNhAuthService<TAuthorization extends INhAuthorization> implements OnDestroy {
1308
1317
  protected static readonly pendingTwoFactorChallengeStorageKey = "nh-two-factor-challenge";
1309
1318
  protected static readonly externalTwoFactorChallengePrefix = "nh-two-factor=";
1310
1319
  protected static readonly rememberDeviceStorageKey = "nh-two-factor-device";
1320
+ protected static readonly serverSessionConfirmationMilliseconds = 30000;
1311
1321
  protected authorization: TAuthorization | undefined;
1312
1322
  protected pendingTwoFactorChallenge: NhTwoFactorChallenge | undefined;
1313
1323
  protected authSession: AuthenticationSessionCreateResponse | undefined;
@@ -1317,6 +1327,9 @@ declare abstract class BaseNhAuthService<TAuthorization extends INhAuthorization
1317
1327
  protected _sessionExpirationInformation: BehaviorSubject<AuthSessionExpirationInformation>;
1318
1328
  sessionExpirationInformationChanged: Observable<AuthSessionExpirationInformation>;
1319
1329
  protected intervalHandle: any;
1330
+ private serverSessionCheck;
1331
+ private serverSessionConfirmedAt;
1332
+ private sessionRejectedByServer;
1320
1333
  protected zone: NgZone;
1321
1334
  protected moduleConfig: NhCommonModuleConfig;
1322
1335
  protected httpClient: HttpClient;
@@ -1517,6 +1530,15 @@ declare abstract class BaseNhAuthService<TAuthorization extends INhAuthorization
1517
1530
  };
1518
1531
  protected languageParams(): HttpParams;
1519
1532
  reloadAuthorizationProfile(): Promise<TaskResult<TAuthorization>>;
1533
+ /**
1534
+ * Asks the account information endpoint whether the server still accepts the current session.
1535
+ * When the server answers 401, for example after a password change on another device, the local
1536
+ * session ends and the session expiration information reports `rejectedByServer`. Concurrent
1537
+ * checks share one request, and a confirmed session is not checked again for 30 seconds.
1538
+ * @returns `false` only when there is no session or the server rejected it.
1539
+ */
1540
+ verifyServerSession(): Promise<boolean>;
1541
+ protected checkServerSession(): Promise<boolean>;
1520
1542
  logout(): Promise<TaskResult<void>>;
1521
1543
  authenticateRefreshToken(model: RefreshTokenLoginAccountMutateModel): Promise<TaskResult<TAuthorization>>;
1522
1544
  impersonate(model: ImpersonateAuthenticateModel): Promise<TaskResult<TAuthorization>>;
@@ -1563,6 +1585,23 @@ declare class NhDeduplicateGetRequestsInterceptor implements HttpInterceptor {
1563
1585
  static ɵprov: i0.ɵɵInjectableDeclaration<NhDeduplicateGetRequestsInterceptor>;
1564
1586
  }
1565
1587
 
1588
+ /**
1589
+ * Ends a session that the NewHeap API no longer accepts. A 401 from the API while the browser
1590
+ * still holds a session asks the auth service to check that session with the server. Only a 401
1591
+ * from the account endpoint ends it, so an endpoint that answers 401 for another reason never
1592
+ * signs the user out. The original error still reaches the caller.
1593
+ */
1594
+ declare class NhSessionRejectionInterceptor implements HttpInterceptor {
1595
+ private moduleConfig;
1596
+ private authService;
1597
+ constructor(moduleConfig: NhCommonModuleConfig, authService: NhAuthService);
1598
+ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
1599
+ private appliesTo;
1600
+ private isUnder;
1601
+ static ɵfac: i0.ɵɵFactoryDeclaration<NhSessionRejectionInterceptor, never>;
1602
+ static ɵprov: i0.ɵɵInjectableDeclaration<NhSessionRejectionInterceptor>;
1603
+ }
1604
+
1566
1605
  declare abstract class AbstractValueAccessor implements ControlValueAccessor {
1567
1606
  _value: any;
1568
1607
  get value(): any;
@@ -3033,5 +3072,5 @@ declare class NhTranslateBrowserLoader implements TranslateLoader {
3033
3072
  }
3034
3073
  declare function nhTranslateBrowserLoaderFactory(httpClient: HttpClient, transferState: TransferState): NhTranslateBrowserLoader;
3035
3074
 
3036
- export { AbstractValueAccessor, AspMvcFormServerSideFormValidator, AuthSessionExpirationInformation, AuthenticateModel, AuthenticationNhCommonModuleConfig, AuthenticationSessionCreateResponse, BackgroundOperationsNhCommonModuleConfig, BaseNhAuthService, CheckAuthenticateSessionModel, Claim, ClaimAuthenticateSessionAccountMutateModel, ClaimAuthenticateSessionAccountViewModel, ClaimTypes, CollectionHttpRequestOptions, CollectionHttpResponse, DefaultMultiSelectSettings, DefaultMultiSelectTexts, EndpointsAuthenticationNhCommonModuleConfig, FilterRequestOptions, FormError, FormValidationResult, HttpDownloadRequestOptions, HttpRequestOptions, HttpRequestOptionsArrayBuffer, HttpRequestOptionsText, ImpersonateAuthenticateModel, IsAllPermissionsGrantedPipe, IsAuthenticatedPipe, IsClaimGrantedPipe, IsDefined, IsGrantedRolePipe, IsOneActiveDivisionPermissionGrantedGuard, IsOneActiveDivisionPermissionGrantedPipe, IsOneActiveDivisionRoleGrantedGuard, IsOneActiveDivisionRoleGrantedPipe, IsOneClaimGrantedPipe, IsOneDivisionPermissionGrantedPipe, IsOneDivisionRoleGrantedPipe, IsOnePermissionGrantedPipe, IsOneRoleGrantedPipe, JsonLdDataChanged, ListSortDirection, MakeProvider, MutationType, NH_ERROR_HANDLERS, NH_ROUTER_LANGUAGE_CHANGE_METHOD, NH_ROUTER_ROOT_ROUTES, NhAccountInformationResponse, NhAngularUtil, NhApiService, NhApiUtil, NhAppService, NhAsyncLock, NhAuthService, NhAuthenticationStep, NhAuthenticationStepStatuses, NhAuthenticatorSetup, NhAuthorization, NhBackgroundOperationAdministrationCollectionHttpRequestOptions, NhBackgroundOperationAdministrationService, NhBackgroundOperationCollectionHttpRequestOptions, NhBackgroundOperationLiveUpdateService, NhBackgroundOperationProgressComponent, NhBackgroundOperationService, NhBackgroundOperationStore, NhBaseApiService, NhBooleanToStringPipe, NhBreadCrumb, NhBreadCrumbItem, NhButtonDebounceDirective, NhCanCancelNavigationGuard, NhCollectionBaseComponent, NhCollectionTypeBaseComponent, NhCommonConfig, NhCommonConfigChanged, NhCommonModule, NhCommonModuleConfig, NhConfigCommonService, NhContextMenu, NhContextMenuItem, NhContextMenuService, NhContextMenuServiceConfig, NhCookieService, NhDatePipe, NhDateTimePipe, NhDateUtcPipe, NhDebounceDirective, NhDeduplicateGetRequestsInterceptor, NhDivision, NhDivisionRole, NhDivisionUser, NhEncodeHttpParamsInterceptor, NhEncodingUtil, NhErrorComponent, NhErrorHandlerService, NhFormDropDownComponent, NhFormDropDownNhCommonModuleConfig, NhFormDropDownSettings, NhFormErrorMessageComponent, NhFormHelper, NhHeadService, NhHttpNhCommonModuleConfig, NhHttpUtil, NhInternetConnectionService, NhIsAllPermissionsGrantedGuard, NhIsAuthenticatedGuard, NhIsOneClaimGrantedGuard, NhIsOnePermissionGrantedGuard, NhIsOneRoleGrantedGuard, NhJsonLdComponent, NhJsonLdData, NhJsonLdDataItem, NhJsonLdService, NhLoaderComponent, NhMetaService, NhModalComponent, NhModalComponentClosed, NhModalComponentImpl, NhModalComponentRef, NhModalConfirmComponent, NhModalContentDirective, NhModalLoadingComponent, NhModalMutateBaseComponent, NhModalMutateBaseTypeComponent, NhModalOptions, NhModalService, NhMutateBaseComponent, NhMutateBaseTypeComponent, NhMutex, NhPageBaseComponent, NhPageService, NhPageSettings, NhPageSizeComponent, NhPageTypeBaseComponent, NhPasskey, NhPasskeyClient, NhPasskeyOptions, NhRegisterRoute, NhRequestScopedServerHttpInterceptorService, NhRoute, NhRouteInfo, NhRouteNavigationItem, NhRouterLinkDirective, NhRouterService, NhRouterSetupService, NhSearchInputComponent, NhServerHttpInterceptor, NhServerService, NhServerSideFormValidationService, NhSitemap, NhSitemapEntry, NhSitemapEntryItem, NhStringUtil, NhTaskResultFormValidationService, NhTitleService, NhToHeadDirective, NhTranslateBrowserLoader, NhTranslationNhCommonModuleConfig, NhTwoFactorChallenge, NhTwoFactorChange, NhTwoFactorEmailCodeSent, NhTwoFactorEnrollmentResult, NhTwoFactorFailureCodes, NhTwoFactorMethods, NhTwoFactorReauthentication, NhTwoFactorStatus, NhTwoFactorVerifyModel, NhTypedPageBaseComponent, NhTypedPageTypeBaseComponent, NhUrlEncodePipe, NhUser, NhUserNotification, NhUserNotificationCollectionHttpRequestOptions, NhUserNotificationData, NhUserNotificationMessage, NhUserNotificationOverview, NhUserNotificationService, NhUserNotificationState, NhUserNotificationsAbstractComponent, OrderByRequestOptions, PreConnectUrlItem, PreLoadUrlItem, REVIEW_AGGREGATE_RATING_KEY, REVIEW_KEY, RefreshTokenLoginAccountMutateModel, RevertImpersonateAuthenticateModel, SafeHtmlPipe, SafeResourceUrlPipe, SafeUrlPipe, SearchableCollectionHttpRequestOptions, SimpleCollectionHttpRequestOptions, SimpleCollectionHttpResponse, TaskResult, TaskResultItem, TypedNhPageSettings, UserNotificationNhCommonModuleConfig, enumIntValuesToArray, enumKeysToArray, enumStringValuesToArray, enumValuesToArray, getEmptyGuid, getRandomIdentifier, groupBy, languageToCultureMap, nameof, nhBackgroundOperationStatusName, nhBackgroundOperationStepStatusName, nhBackgroundOperationTranslationSegment, nhTranslateBrowserLoaderFactory, nhUserNotificationSeverityName, uppercaseFirst };
3075
+ export { AbstractValueAccessor, AspMvcFormServerSideFormValidator, AuthSessionExpirationInformation, AuthenticateModel, AuthenticationNhCommonModuleConfig, AuthenticationSessionCreateResponse, BackgroundOperationsNhCommonModuleConfig, BaseNhAuthService, CheckAuthenticateSessionModel, Claim, ClaimAuthenticateSessionAccountMutateModel, ClaimAuthenticateSessionAccountViewModel, ClaimTypes, CollectionHttpRequestOptions, CollectionHttpResponse, DefaultMultiSelectSettings, DefaultMultiSelectTexts, EndpointsAuthenticationNhCommonModuleConfig, FilterRequestOptions, FormError, FormValidationResult, HttpDownloadRequestOptions, HttpRequestOptions, HttpRequestOptionsArrayBuffer, HttpRequestOptionsText, ImpersonateAuthenticateModel, IsAllPermissionsGrantedPipe, IsAuthenticatedPipe, IsClaimGrantedPipe, IsDefined, IsGrantedRolePipe, IsOneActiveDivisionPermissionGrantedGuard, IsOneActiveDivisionPermissionGrantedPipe, IsOneActiveDivisionRoleGrantedGuard, IsOneActiveDivisionRoleGrantedPipe, IsOneClaimGrantedPipe, IsOneDivisionPermissionGrantedPipe, IsOneDivisionRoleGrantedPipe, IsOnePermissionGrantedPipe, IsOneRoleGrantedPipe, JsonLdDataChanged, ListSortDirection, MakeProvider, MutationType, NH_ERROR_HANDLERS, NH_ROUTER_LANGUAGE_CHANGE_METHOD, NH_ROUTER_ROOT_ROUTES, NH_SKIP_SERVER_SESSION_CHECK, NhAccountInformationResponse, NhAngularUtil, NhApiService, NhApiUtil, NhAppService, NhAsyncLock, NhAuthService, NhAuthenticationStep, NhAuthenticationStepStatuses, NhAuthenticatorSetup, NhAuthorization, NhBackgroundOperationAdministrationCollectionHttpRequestOptions, NhBackgroundOperationAdministrationService, NhBackgroundOperationCollectionHttpRequestOptions, NhBackgroundOperationLiveUpdateService, NhBackgroundOperationProgressComponent, NhBackgroundOperationService, NhBackgroundOperationStore, NhBaseApiService, NhBooleanToStringPipe, NhBreadCrumb, NhBreadCrumbItem, NhButtonDebounceDirective, NhCanCancelNavigationGuard, NhCollectionBaseComponent, NhCollectionTypeBaseComponent, NhCommonConfig, NhCommonConfigChanged, NhCommonModule, NhCommonModuleConfig, NhConfigCommonService, NhContextMenu, NhContextMenuItem, NhContextMenuService, NhContextMenuServiceConfig, NhCookieService, NhDatePipe, NhDateTimePipe, NhDateUtcPipe, NhDebounceDirective, NhDeduplicateGetRequestsInterceptor, NhDivision, NhDivisionRole, NhDivisionUser, NhEncodeHttpParamsInterceptor, NhEncodingUtil, NhErrorComponent, NhErrorHandlerService, NhFormDropDownComponent, NhFormDropDownNhCommonModuleConfig, NhFormDropDownSettings, NhFormErrorMessageComponent, NhFormHelper, NhHeadService, NhHttpNhCommonModuleConfig, NhHttpUtil, NhInternetConnectionService, NhIsAllPermissionsGrantedGuard, NhIsAuthenticatedGuard, NhIsOneClaimGrantedGuard, NhIsOnePermissionGrantedGuard, NhIsOneRoleGrantedGuard, NhJsonLdComponent, NhJsonLdData, NhJsonLdDataItem, NhJsonLdService, NhLoaderComponent, NhMetaService, NhModalComponent, NhModalComponentClosed, NhModalComponentImpl, NhModalComponentRef, NhModalConfirmComponent, NhModalContentDirective, NhModalLoadingComponent, NhModalMutateBaseComponent, NhModalMutateBaseTypeComponent, NhModalOptions, NhModalService, NhMutateBaseComponent, NhMutateBaseTypeComponent, NhMutex, NhPageBaseComponent, NhPageService, NhPageSettings, NhPageSizeComponent, NhPageTypeBaseComponent, NhPasskey, NhPasskeyClient, NhPasskeyOptions, NhRegisterRoute, NhRequestScopedServerHttpInterceptorService, NhRoute, NhRouteInfo, NhRouteNavigationItem, NhRouterLinkDirective, NhRouterService, NhRouterSetupService, NhSearchInputComponent, NhServerHttpInterceptor, NhServerService, NhServerSideFormValidationService, NhSessionRejectionInterceptor, NhSitemap, NhSitemapEntry, NhSitemapEntryItem, NhStringUtil, NhTaskResultFormValidationService, NhTitleService, NhToHeadDirective, NhTranslateBrowserLoader, NhTranslationNhCommonModuleConfig, NhTwoFactorChallenge, NhTwoFactorChange, NhTwoFactorEmailCodeSent, NhTwoFactorEnrollmentResult, NhTwoFactorFailureCodes, NhTwoFactorMethods, NhTwoFactorReauthentication, NhTwoFactorStatus, NhTwoFactorVerifyModel, NhTypedPageBaseComponent, NhTypedPageTypeBaseComponent, NhUrlEncodePipe, NhUser, NhUserNotification, NhUserNotificationCollectionHttpRequestOptions, NhUserNotificationData, NhUserNotificationMessage, NhUserNotificationOverview, NhUserNotificationService, NhUserNotificationState, NhUserNotificationsAbstractComponent, OrderByRequestOptions, PreConnectUrlItem, PreLoadUrlItem, REVIEW_AGGREGATE_RATING_KEY, REVIEW_KEY, RefreshTokenLoginAccountMutateModel, RevertImpersonateAuthenticateModel, SafeHtmlPipe, SafeResourceUrlPipe, SafeUrlPipe, SearchableCollectionHttpRequestOptions, SimpleCollectionHttpRequestOptions, SimpleCollectionHttpResponse, TaskResult, TaskResultItem, TypedNhPageSettings, UserNotificationNhCommonModuleConfig, enumIntValuesToArray, enumKeysToArray, enumStringValuesToArray, enumValuesToArray, getEmptyGuid, getRandomIdentifier, groupBy, languageToCultureMap, nameof, nhBackgroundOperationStatusName, nhBackgroundOperationStepStatusName, nhBackgroundOperationTranslationSegment, nhTranslateBrowserLoaderFactory, nhUserNotificationSeverityName, uppercaseFirst };
3037
3076
  export type { AuthenticationFlow, ErrorResult, ICancelNavigationComponent, IClaimAuthenticateSessionAccountViewModel, ICollectionHttpRequestOptions, ICollectionHttpResponse, IFormError, IFormValidationResult, IHttpDownloadRequestOptions, IHttpRequestOptions, INhAccountInformationResponse, INhAuthorization, INhDivision, INhDivisionRole, INhDivisionUser, INhModalComponent, INhUser, ISearchableCollectionHttpRequestOptions, IServerSideFormValidationService, IServerSideFormValidator, ISimpleCollectionHttpRequestOptions, ISimpleCollectionHttpResponse, NhAuthenticationStepStatus, NhBackgroundOperation, NhBackgroundOperationAdministration, NhBackgroundOperationAggregationMode, NhBackgroundOperationAttempt, NhBackgroundOperationAttemptStatus, NhBackgroundOperationChanged, NhBackgroundOperationChild, NhBackgroundOperationConnectionState, NhBackgroundOperationEvent, NhBackgroundOperationEventType, NhBackgroundOperationMessageSeverity, NhBackgroundOperationStatus, NhBackgroundOperationStep, NhBackgroundOperationStepStatus, NhContextEventWithCoordinates, NhEnumDropDownItem, NhLoginResponse, NhRouterLink, NhTwoFactorMethod, NhUserNotificationSeverity, SuccessResult, TypedResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newheap/platform-common",
3
- "version": "1.4.0",
3
+ "version": "2.0.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.3.28",
6
6
  "@angular/core": "^20.3.28",
@@ -238,7 +238,8 @@ declare const NH_TWO_FACTOR_TRANSLATIONS: Readonly<Record<'en' | 'nl', Translati
238
238
  /**
239
239
  * Merges the bundled texts into `TranslateService` whenever the host loads or replaces a
240
240
  * language. Host loaders never lose these texts, and keys the host defines under
241
- * `nh-two-factor.` win over the bundle. Languages without a bundle receive the English texts.
241
+ * `nh-two-factor.` win over the bundle. A regional language such as `nl-NL` receives the texts
242
+ * of its base language; languages without a bundle receive the English texts.
242
243
  */
243
244
  declare class NhTwoFactorTranslationMerger {
244
245
  private readonly translate;