@brendanbank/atrium-host-types 0.17.0 → 0.18.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 CHANGED
@@ -32,8 +32,8 @@ your `.npmrc`, delete it — npmjs.org is the default registry.
32
32
 
33
33
  ## Versioning
34
34
 
35
- The package version tracks atrium's image version. Pin `^0.17` for
36
- "compatible with atrium 0.17.x"; bump together with the atrium image
35
+ The package version tracks atrium's image version. Pin `^0.18` for
36
+ "compatible with atrium 0.18.x"; bump together with the atrium image
37
37
  to pick up new registry slots. New slots land as **optional** members
38
38
  on `AtriumRegistry` first so a host that hasn't bumped yet still
39
39
  type-checks.
package/dist/index.d.ts CHANGED
@@ -44,6 +44,33 @@ export interface AdminUserRow {
44
44
  role_ids: number[];
45
45
  roles: string[];
46
46
  }
47
+ /** Detail payload of the ``atrium:userchange`` window CustomEvent
48
+ * atrium dispatches whenever the signed-in user identity changes —
49
+ * login, logout, logout-all, impersonation start/stop, same-tab
50
+ * re-login as a different user. ``previous`` and ``current`` are user
51
+ * ids; ``null`` means signed out (or, for ``previous``, transitioning
52
+ * out of the signed-out state). ``nonce`` is a monotonic per-event
53
+ * counter. The event does NOT fire on first identity observation
54
+ * after a page load (the user has not changed).
55
+ *
56
+ * Available since atrium 0.18. The canonical use is host bundles
57
+ * clearing their own QueryClient cache when the user changes — atrium
58
+ * clears its own cache via ``qc.clear()`` on logout, but a host bundle
59
+ * runs a separate QueryClient (by design — see
60
+ * ``@brendanbank/atrium-host-bundle-utils/react``) and needs an
61
+ * external signal:
62
+ *
63
+ * ```ts
64
+ * window.addEventListener('atrium:userchange', () => {
65
+ * hostQueryClient.clear();
66
+ * });
67
+ * ```
68
+ */
69
+ export interface AtriumUserChangeDetail {
70
+ previous: number | null;
71
+ current: number | null;
72
+ nonce: number;
73
+ }
47
74
  /** A single notification row as the SPA sees it. `kind` is host-defined;
48
75
  * `payload` is opaque JSON. `read_at` is null until the user clears the
49
76
  * bell; `created_at` is the server-side timestamp. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brendanbank/atrium-host-types",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "TypeScript declarations for the atrium host-extension contract: AtriumRegistry, UserContext, AdminUserRow, AtriumNotification, AtriumEvent. Source-of-truth shapes a host bundle types against, kept in sync with atrium's published image major.minor.",
5
5
  "license": "BSD-2-Clause",
6
6
  "type": "module",