@masterteam/delegations 0.0.56 → 0.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/delegations",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -1328,13 +1328,21 @@ declare class StartDelegationSession {
1328
1328
  constructor(delegation: DelegationRow);
1329
1329
  }
1330
1330
  /**
1331
- * Re-mint the session the user was in before they reloaded the page. Dispatched
1332
- * by the state itself from the persisted delegation id — never a token.
1331
+ * Re-mint the session the user was in before they reloaded the page, from the
1332
+ * persisted delegation id — never a token.
1333
+ *
1334
+ * Pass `delegation` when the row is already in hand; otherwise the state loads
1335
+ * the candidates itself, so a host can await this action **before** the
1336
+ * authenticated shell mounts and boot straight into delegated mode instead of
1337
+ * loading everything twice.
1338
+ *
1339
+ * Completes quietly when there is nothing to resume or the delegation is no
1340
+ * longer startable — the user simply stays themselves.
1333
1341
  */
1334
1342
  declare class ResumeDelegationSession {
1335
- delegation: DelegationRow;
1343
+ delegation: DelegationRow | null;
1336
1344
  static readonly type = "[DelegationSession] Resume";
1337
- constructor(delegation: DelegationRow);
1345
+ constructor(delegation?: DelegationRow | null);
1338
1346
  }
1339
1347
  /** End the current delegated session. Client-local only (doc 05). */
1340
1348
  declare class EndDelegationSession {
@@ -1376,12 +1384,13 @@ declare class DelegationSessionState {
1376
1384
  static getErrors(state: DelegationSessionStateModel): Record<string, string | null | undefined>;
1377
1385
  loadCandidates(ctx: StateContext<DelegationSessionStateModel>, { page, pageSize, append }: LoadDelegationCandidates): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
1378
1386
  /**
1379
- * Re-mints the delegated session the user was in before they reloaded.
1387
+ * Fallback resume for hosts that do not await {@link ResumeDelegationSession}
1388
+ * before mounting their authenticated shell: pick the session back up as soon
1389
+ * as the candidates arrive.
1380
1390
  *
1381
- * The token itself was never persisted (doc 05); only the delegation id was,
1382
- * so this is a full `POST .../session` and the backend re-authorizes from
1383
- * scratch. Attempted at most once per page load — a delegation that has since
1384
- * expired or been revoked must not retry on every candidate refresh.
1391
+ * Prefer the awaited path resuming after the shell has already loaded means
1392
+ * every actor-scoped read runs twice, once as the real user and again under
1393
+ * delegated authority.
1385
1394
  */
1386
1395
  private tryResume;
1387
1396
  resume(ctx: StateContext<DelegationSessionStateModel>, { delegation }: ResumeDelegationSession): rxjs.Observable<void>;
@@ -1398,6 +1407,7 @@ declare class DelegationSessionState {
1398
1407
  declare class DelegationSessionFacade {
1399
1408
  private readonly store;
1400
1409
  private readonly promptReceipts;
1410
+ private readonly resumeStore;
1401
1411
  private endInFlight;
1402
1412
  readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
1403
1413
  readonly candidates: _angular_core.Signal<DelegationRow[]>;
@@ -1420,6 +1430,19 @@ declare class DelegationSessionFacade {
1420
1430
  loadCandidates(page?: number, pageSize?: number, append?: boolean): Observable<void>;
1421
1431
  loadMoreCandidates(): Observable<void>;
1422
1432
  claimPromptCandidates(candidates: DelegationRow[]): Promise<DelegationRow[]>;
1433
+ /**
1434
+ * True when a previous session is waiting to be re-minted after a reload.
1435
+ * Synchronous (a `localStorage` read), so a route guard can check it without
1436
+ * paying for a round-trip on the overwhelmingly common no-delegation boot.
1437
+ */
1438
+ hasPendingResume(): boolean;
1439
+ /**
1440
+ * Re-mints the delegated session the user reloaded out of, and completes when
1441
+ * delegated mode is in force (or when there is nothing to resume). Await this
1442
+ * **before** mounting the authenticated shell so its reads run once, already
1443
+ * delegated.
1444
+ */
1445
+ resumeSession(): Observable<void>;
1423
1446
  startSession(delegation: DelegationRow): Observable<void>;
1424
1447
  switchSession(delegation: DelegationRow): Observable<void>;
1425
1448
  endSession(reason?: DelegationSessionInvalidationReason): Observable<unknown>;