@ai-matrx/data 0.17.0 → 0.17.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.1
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/data/v0.17.0..npm/data/v0.17.1 -- apps/shared/data`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.17.0 — 2026-09-20
4
10
 
5
11
  ### The proxy's identity resolve is local, bounded, and never a logout (`./next`)
package/README.md CHANGED
@@ -118,12 +118,33 @@ export const supabaseNext = createNextSupabase<Database>({
118
118
  | Proxy / middleware | `await supabaseNext.middlewareSession({ host, requestCookies, createResponse, createRedirect })` |
119
119
 
120
120
  `middlewareSession` is the whole auth pass in one call and returns
121
- `{ user, client, response, redirect(url) }`. It owns: legacy-key migration (absent-only,
122
- so a live session is never overwritten), the "nothing may run between `createServerClient`
123
- and `getUser()`" rule made structural, persisting a migrated session under the current
124
- key, clearing the superseded key at the scope this host issued it on, no-store response
125
- headers on any cookie-bearing response, and cookie carry-over onto redirects. Dropping any
126
- one of those logs users out at random — which is how each was found.
121
+ `{ user, client, response, redirect(url), splitCookieJar, ambiguousAuthCookies,
122
+ authUnavailable }`. It owns: legacy-key migration (absent-only, so a live session is never
123
+ overwritten), the "nothing may run between `createServerClient` and the identity resolve"
124
+ rule made structural, persisting a migrated session under the current key, clearing the
125
+ superseded key at the scope this host issued it on, no-store response headers on any
126
+ cookie-bearing response, and cookie carry-over onto redirects. Dropping any one of those
127
+ logs users out at random — which is how each was found.
128
+
129
+ **The identity resolve is `getClaims()`, never `getUser()`, and it is BOUNDED.**
130
+ `getUser()` sends a request to the Auth server for every JWT; `getClaims()` verifies the
131
+ access token against the project's JWKS with WebCrypto — locally, usually with no network
132
+ call, and just as trusted, because the signature is checked. It needs an **asymmetric**
133
+ signing key on the project (ECC/RSA); with a symmetric secret it degrades to a
134
+ `getUser()`-shaped request per call, still correct but with none of the saving. A 2.5s
135
+ budget (`AbortSignal.timeout` on `/auth/v1/` calls only) means a stalled auth server costs
136
+ one request its identity instead of costing the page its response — on Vercel, where Next
137
+ 16 forces this pass into a Node Lambda with a hard task cap, the unbounded version returned
138
+ `504 MIDDLEWARE_INVOCATION_TIMEOUT` to real people.
139
+
140
+ 🚨 **`authUnavailable` is the consumer's obligation.** It means the authority could not be
141
+ REACHED, which is NOT "signed out": `user` is `null`, but no auth cookie was written,
142
+ expired or healed and the superseded key was not cleared. **Read it before treating
143
+ `user === null` as signed out** — a host that bounces to `/login` on a null user must skip
144
+ that bounce when the flag is set, or a 2.5s network blink signs people out mid-session.
145
+ A call site needing `created_at`, `identities`, `last_sign_in_at`, `factors` or
146
+ `*_confirmed_at` must keep `getUser()` elsewhere: the JWT carries none of them.
147
+ Full contract: `common-docs/systems/platform/proxy-identity/FEATURE.md`.
127
148
 
128
149
  **No `next/*` import lives in the package.** `cookies()` and `NextResponse` arrive through
129
150
  structural seams (`createResponse: () => NextResponse.next({ request })`), so `/next`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/data",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "The opinionated AI Matrx data layer: the /db tier's hard-won Supabase primitives — optimistic concurrency, complete-list reads, JSONB merge, session-retry, the domain-wide auth cookie, realtime channel hygiene — the /net resilience trio, and the /files lane: the Matrx file-communication client (durable-ref resolution, the mx_files_session bootstrap, authenticated blob fetch, uploads, the public-link door).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",