@cellarnode/auth 0.9.0 → 0.11.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/dist/auth-guard.d.ts +10 -1
- package/dist/auth-guard.d.ts.map +1 -1
- package/dist/auth-guard.js +11 -0
- package/dist/auth-guard.js.map +1 -1
- package/dist/auth-store.d.ts.map +1 -1
- package/dist/auth-store.js +129 -81
- package/dist/auth-store.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +29 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -3
package/dist/auth-guard.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import type { AuthUser, UserType } from "./types.js";
|
|
1
|
+
import type { AuthUser, SessionClaims, UserType } from "./types.js";
|
|
2
2
|
export declare function validateUserType(user: AuthUser, expected: UserType): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* True if the user/session holds the given entitlement (CEL-599 / Epic A).
|
|
5
|
+
*
|
|
6
|
+
* Accepts an `AuthUser` (from `getMe` / `/auth/me`, where `entitlements` may be
|
|
7
|
+
* absent on older backends) OR a `SessionClaims`-shaped object. Null-safe —
|
|
8
|
+
* returns false for a missing source or a source with no entitlements. Mirrors
|
|
9
|
+
* the `validateUserType` guard shape.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasEntitlement(source: AuthUser | SessionClaims | null | undefined, entitlement: string): boolean;
|
|
3
12
|
//# sourceMappingURL=auth-guard.d.ts.map
|
package/dist/auth-guard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-guard.d.ts","sourceRoot":"","sources":["../src/auth-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-guard.d.ts","sourceRoot":"","sources":["../src/auth-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEpE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5E;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,IAAI,GAAG,SAAS,EACnD,WAAW,EAAE,MAAM,GAClB,OAAO,CAET"}
|
package/dist/auth-guard.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
export function validateUserType(user, expected) {
|
|
2
2
|
return user.userType === expected;
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* True if the user/session holds the given entitlement (CEL-599 / Epic A).
|
|
6
|
+
*
|
|
7
|
+
* Accepts an `AuthUser` (from `getMe` / `/auth/me`, where `entitlements` may be
|
|
8
|
+
* absent on older backends) OR a `SessionClaims`-shaped object. Null-safe —
|
|
9
|
+
* returns false for a missing source or a source with no entitlements. Mirrors
|
|
10
|
+
* the `validateUserType` guard shape.
|
|
11
|
+
*/
|
|
12
|
+
export function hasEntitlement(source, entitlement) {
|
|
13
|
+
return source?.entitlements?.includes(entitlement) ?? false;
|
|
14
|
+
}
|
|
4
15
|
//# sourceMappingURL=auth-guard.js.map
|
package/dist/auth-guard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-guard.js","sourceRoot":"","sources":["../src/auth-guard.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,IAAc,EAAE,QAAkB;IACjE,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACpC,CAAC"}
|
|
1
|
+
{"version":3,"file":"auth-guard.js","sourceRoot":"","sources":["../src/auth-guard.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,IAAc,EAAE,QAAkB;IACjE,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAmD,EACnD,WAAmB;IAEnB,OAAO,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC;AAC9D,CAAC"}
|
package/dist/auth-store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,SAAS,EACT,eAAe,EAKhB,MAAM,YAAY,CAAC;AAuCpB,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAsRlE"}
|
package/dist/auth-store.js
CHANGED
|
@@ -1,67 +1,42 @@
|
|
|
1
|
-
import { decodeJwt } from "jose";
|
|
2
1
|
import { extractAccessToken } from "./extract-token.js";
|
|
3
|
-
const VALID_USER_TYPES = new Set([
|
|
4
|
-
"importer",
|
|
5
|
-
"producer",
|
|
6
|
-
"distributor",
|
|
7
|
-
"admin",
|
|
8
|
-
]);
|
|
9
2
|
/**
|
|
10
|
-
*
|
|
3
|
+
* Map a `/auth/me` AuthUser onto the minimal cached identity.
|
|
11
4
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* informational only (used for clientId / orgId / userType lookups in the
|
|
16
|
-
* UI layer).
|
|
5
|
+
* `AuthUser.id` is the userId. `entitlements` is optional on the wire (older
|
|
6
|
+
* backends omit it) → defaults to `[]`. The element filter guards against a
|
|
7
|
+
* malformed array carrying non-string entries.
|
|
17
8
|
*/
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
payload = decodeJwt(token);
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const userId = payload.userId;
|
|
27
|
-
const email = payload.email;
|
|
28
|
-
const sessionId = payload.sessionId;
|
|
29
|
-
const orgIdRaw = payload.orgId;
|
|
30
|
-
const rolesRaw = payload.roles;
|
|
31
|
-
const userTypeRaw = payload.userType;
|
|
32
|
-
if (typeof userId !== "string" || userId.length === 0)
|
|
33
|
-
return null;
|
|
34
|
-
if (typeof email !== "string")
|
|
35
|
-
return null;
|
|
36
|
-
if (typeof sessionId !== "string" || sessionId.length === 0)
|
|
37
|
-
return null;
|
|
38
|
-
const orgId = orgIdRaw === null || orgIdRaw === undefined
|
|
39
|
-
? null
|
|
40
|
-
: typeof orgIdRaw === "string"
|
|
41
|
-
? orgIdRaw
|
|
42
|
-
: null;
|
|
43
|
-
const roles = Array.isArray(rolesRaw)
|
|
44
|
-
? rolesRaw.filter((r) => typeof r === "string")
|
|
9
|
+
function toIdentity(user) {
|
|
10
|
+
const entitlements = Array.isArray(user.entitlements)
|
|
11
|
+
? user.entitlements.filter((e) => typeof e === "string")
|
|
45
12
|
: [];
|
|
46
|
-
if (typeof userTypeRaw !== "string")
|
|
47
|
-
return null;
|
|
48
|
-
if (!VALID_USER_TYPES.has(userTypeRaw))
|
|
49
|
-
return null;
|
|
50
13
|
return {
|
|
51
|
-
userId,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
sessionId,
|
|
56
|
-
userType: userTypeRaw,
|
|
14
|
+
userId: user.id,
|
|
15
|
+
orgId: user.orgId ?? null,
|
|
16
|
+
userType: user.userType,
|
|
17
|
+
entitlements,
|
|
57
18
|
};
|
|
58
19
|
}
|
|
59
20
|
export function createAuthStore(config) {
|
|
60
21
|
const { baseUrl, refreshPath = "/auth/refresh", refreshBuffer = 60 } = config;
|
|
61
22
|
let accessToken = null;
|
|
62
|
-
let
|
|
23
|
+
let identity = null;
|
|
63
24
|
let refreshTimer = null;
|
|
64
25
|
let refreshPromise = null;
|
|
26
|
+
// Tracks the orgId observed at the last emitted state so `onOrgChange` only
|
|
27
|
+
// fires on an actual transition. `hasEmittedOrgId` disambiguates the two
|
|
28
|
+
// meanings `previousOrgId === null` would otherwise carry — "no org emitted
|
|
29
|
+
// yet" vs "the current org is admin/null". Without it, the FIRST admin
|
|
30
|
+
// identity (orgId null) and an admin login right after `clearToken()` would
|
|
31
|
+
// skip `onOrgChange(null)`. Both are reset on logout so a subsequent login
|
|
32
|
+
// re-fires `onOrgChange` even into the same org.
|
|
33
|
+
let previousOrgId = null;
|
|
34
|
+
let hasEmittedOrgId = false;
|
|
35
|
+
// Monotonic generation counter. Bumped on every token change (set / clear /
|
|
36
|
+
// refresh). An in-flight `/auth/me` resolution only commits if its captured
|
|
37
|
+
// generation still matches — this discards stale identity results when the
|
|
38
|
+
// token changed again before the previous fetch resolved.
|
|
39
|
+
let tokenGeneration = 0;
|
|
65
40
|
const orgChangeListeners = new Set();
|
|
66
41
|
const accessTokenSetListeners = new Set();
|
|
67
42
|
const logoutListeners = new Set();
|
|
@@ -105,28 +80,104 @@ export function createAuthStore(config) {
|
|
|
105
80
|
}, delay);
|
|
106
81
|
}
|
|
107
82
|
/**
|
|
108
|
-
*
|
|
83
|
+
* Fetch `/auth/me` with the bearer token and return the parsed identity, or
|
|
84
|
+
* null on any failure (network error, non-2xx, malformed body).
|
|
109
85
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
86
|
+
* Tolerant by design — mirrors how `performRefresh` swallows errors. A failed
|
|
87
|
+
* `/auth/me` must NOT throw out of `setAccessToken` / `performRefresh`; the
|
|
88
|
+
* caller treats null identity as "logged in but identity unknown" and the
|
|
89
|
+
* getters fall back to null/[].
|
|
90
|
+
*/
|
|
91
|
+
async function fetchIdentity(token) {
|
|
92
|
+
try {
|
|
93
|
+
const res = await fetch(`${baseUrl}/auth/me`, {
|
|
94
|
+
method: "GET",
|
|
95
|
+
credentials: "include",
|
|
96
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
97
|
+
});
|
|
98
|
+
if (!res.ok)
|
|
99
|
+
return null;
|
|
100
|
+
const user = (await res.json());
|
|
101
|
+
if (!user || typeof user.id !== "string" || user.id.length === 0) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return toIdentity(user);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Commit a freshly-resolved identity and emit the dependent events.
|
|
116
112
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
113
|
+
* EVENT ORDERING (CRITICAL — consumer realtime hooks depend on it):
|
|
114
|
+
* identity is async, so on a token change the sequence is:
|
|
115
|
+
* 1. set token (synchronous, in `setAccessToken` / `performRefresh`)
|
|
116
|
+
* 2. kick off `fetchIdentity(token)` (async)
|
|
117
|
+
* 3. ON RESOLVE → here:
|
|
118
|
+
* a. cache identity FIRST (so getters return real values)
|
|
119
|
+
* b. emit `onAccessTokenSet(token)` (consumer hooks re-read getOrgId()
|
|
120
|
+
* inside this handler — identity must already be cached)
|
|
121
|
+
* c. emit `onOrgChange(orgId)` IF orgId actually changed vs the last
|
|
122
|
+
* emitted state
|
|
123
|
+
*
|
|
124
|
+
* The `generation` guard discards this commit if the token changed again
|
|
125
|
+
* (set/clear/refresh) while this `/auth/me` was in flight.
|
|
120
126
|
*/
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const nextOrgId = claims?.orgId ?? null;
|
|
126
|
-
if (nextOrgId !== previousOrgId) {
|
|
127
|
-
emitOrgChange(nextOrgId);
|
|
127
|
+
function commitIdentity(generation, token, nextIdentity) {
|
|
128
|
+
if (generation !== tokenGeneration) {
|
|
129
|
+
// A newer token change superseded this fetch — drop the stale result.
|
|
130
|
+
return;
|
|
128
131
|
}
|
|
132
|
+
identity = nextIdentity;
|
|
133
|
+
const nextOrgId = nextIdentity?.orgId ?? null;
|
|
134
|
+
// (b) Token-set first — handlers read getOrgId()/getUserId() and must see
|
|
135
|
+
// the just-cached identity.
|
|
129
136
|
emitAccessTokenSet(token);
|
|
137
|
+
// (c) Org-change on the first emission OR an actual transition. The
|
|
138
|
+
// `!hasEmittedOrgId` guard ensures the first identity (incl. an admin
|
|
139
|
+
// orgId of null) always fires once.
|
|
140
|
+
if (!hasEmittedOrgId || nextOrgId !== previousOrgId) {
|
|
141
|
+
hasEmittedOrgId = true;
|
|
142
|
+
previousOrgId = nextOrgId;
|
|
143
|
+
emitOrgChange(nextOrgId);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Apply a new access token, kicking off async identity resolution.
|
|
148
|
+
*
|
|
149
|
+
* The token is committed synchronously (so `getAccessToken()` is immediately
|
|
150
|
+
* correct); identity + `onAccessTokenSet` + `onOrgChange` settle only after
|
|
151
|
+
* `/auth/me` resolves (see `commitIdentity`).
|
|
152
|
+
*/
|
|
153
|
+
function applyToken(token) {
|
|
154
|
+
tokenGeneration += 1;
|
|
155
|
+
const generation = tokenGeneration;
|
|
156
|
+
accessToken = token;
|
|
157
|
+
// Clear the prior session's identity synchronously so the getters return
|
|
158
|
+
// the documented null/[] defaults until the fresh /auth/me resolves —
|
|
159
|
+
// otherwise a token switch (e.g. logging in as a different user) would leak
|
|
160
|
+
// the previous session's userId/orgId/entitlements until the new fetch
|
|
161
|
+
// lands. The realtime consumer hooks read the getters on events (not by
|
|
162
|
+
// polling), so this introduces no flicker: a same-user refresh re-commits
|
|
163
|
+
// the same orgId without firing `onOrgChange`.
|
|
164
|
+
identity = null;
|
|
165
|
+
void fetchIdentity(token).then((next) => commitIdentity(generation, token, next));
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Clear all token + identity state synchronously and reset org tracking.
|
|
169
|
+
*
|
|
170
|
+
* `onAccessTokenSet(null)` fires synchronously (no `/auth/me` round-trip on
|
|
171
|
+
* logout). `previousOrgId` is reset so a subsequent login re-fires
|
|
172
|
+
* `onOrgChange` even when the user logs back into the same org.
|
|
173
|
+
*/
|
|
174
|
+
function clearToken() {
|
|
175
|
+
tokenGeneration += 1; // invalidate any in-flight /auth/me
|
|
176
|
+
accessToken = null;
|
|
177
|
+
identity = null;
|
|
178
|
+
previousOrgId = null;
|
|
179
|
+
hasEmittedOrgId = false;
|
|
180
|
+
emitAccessTokenSet(null);
|
|
130
181
|
}
|
|
131
182
|
async function performRefresh() {
|
|
132
183
|
try {
|
|
@@ -136,7 +187,7 @@ export function createAuthStore(config) {
|
|
|
136
187
|
headers: { "Content-Type": "application/json" },
|
|
137
188
|
});
|
|
138
189
|
if (!res.ok) {
|
|
139
|
-
|
|
190
|
+
clearToken();
|
|
140
191
|
return null;
|
|
141
192
|
}
|
|
142
193
|
const json = (await res.json());
|
|
@@ -149,7 +200,7 @@ export function createAuthStore(config) {
|
|
|
149
200
|
return token;
|
|
150
201
|
}
|
|
151
202
|
catch {
|
|
152
|
-
|
|
203
|
+
clearToken();
|
|
153
204
|
return null;
|
|
154
205
|
}
|
|
155
206
|
}
|
|
@@ -165,7 +216,7 @@ export function createAuthStore(config) {
|
|
|
165
216
|
scheduleRefresh(expiresIn);
|
|
166
217
|
},
|
|
167
218
|
clearAccessToken() {
|
|
168
|
-
|
|
219
|
+
clearToken();
|
|
169
220
|
if (refreshTimer) {
|
|
170
221
|
clearTimeout(refreshTimer);
|
|
171
222
|
refreshTimer = null;
|
|
@@ -184,21 +235,18 @@ export function createAuthStore(config) {
|
|
|
184
235
|
});
|
|
185
236
|
return refreshPromise;
|
|
186
237
|
},
|
|
187
|
-
getSessionClaims() {
|
|
188
|
-
// Return a defensive copy so external callers cannot mutate the
|
|
189
|
-
// internal claims object (e.g. push to roles, reassign userType).
|
|
190
|
-
return claims
|
|
191
|
-
? { ...claims, roles: [...claims.roles] }
|
|
192
|
-
: null;
|
|
193
|
-
},
|
|
194
238
|
getUserId() {
|
|
195
|
-
return
|
|
239
|
+
return identity?.userId ?? null;
|
|
196
240
|
},
|
|
197
241
|
getOrgId() {
|
|
198
|
-
return
|
|
242
|
+
return identity?.orgId ?? null;
|
|
199
243
|
},
|
|
200
244
|
getUserType() {
|
|
201
|
-
return
|
|
245
|
+
return identity?.userType ?? null;
|
|
246
|
+
},
|
|
247
|
+
getEntitlements() {
|
|
248
|
+
// Defensive copy; [] when logged out or identity unresolved.
|
|
249
|
+
return identity ? [...identity.entitlements] : [];
|
|
202
250
|
},
|
|
203
251
|
onOrgChange(listener) {
|
|
204
252
|
orgChangeListeners.add(listener);
|
package/dist/auth-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAmBxD;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,IAAc;IAChC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;QACnD,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;QACrE,CAAC,CAAC,EAAE,CAAC;IACP,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,EAAE;QACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI;QACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,YAAY;KACb,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAuB;IACrD,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,eAAe,EAAE,aAAa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export { createAuthClient } from "./auth-client.js";
|
|
3
3
|
export { createAuthApi } from "./auth-api.js";
|
|
4
|
-
export { validateUserType } from "./auth-guard.js";
|
|
4
|
+
export { validateUserType, hasEntitlement } from "./auth-guard.js";
|
|
5
5
|
export { extractAccessToken } from "./extract-token.js";
|
|
6
6
|
export { AuthError, type AuthUser, type AuthStore, type AuthStoreConfig, type AuthClient, type AuthClientConfig, type AuthApi, type RegisterInput, type RequestOtpResponse, type VerifyOtpResponse, type AuthErrorResponse, type UserType, type DashboardLink, type SessionClaims, type SessionUserType, type OrgChangeListener, type AccessTokenSetListener, type LogoutListener, } from "./types.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EACL,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createAuthStore } from "./auth-store.js";
|
|
2
2
|
export { createAuthClient } from "./auth-client.js";
|
|
3
3
|
export { createAuthApi } from "./auth-api.js";
|
|
4
|
-
export { validateUserType } from "./auth-guard.js";
|
|
4
|
+
export { validateUserType, hasEntitlement } from "./auth-guard.js";
|
|
5
5
|
export { extractAccessToken } from "./extract-token.js";
|
|
6
6
|
export { AuthError, } from "./types.js";
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EACL,SAAS,GAkBV,MAAM,YAAY,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export interface AuthUser {
|
|
|
6
6
|
userType: "importer" | "producer" | "admin";
|
|
7
7
|
orgId: string | null;
|
|
8
8
|
roles: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Per-user entitlements (CEL-599 / Epic A). Optional on the `/auth/me` wire
|
|
11
|
+
* shape: present once the backend's `/auth/me` mapper returns it, absent for
|
|
12
|
+
* older backends. Consumers should read it as `user.entitlements ?? []`, or
|
|
13
|
+
* prefer `authStore.getEntitlements()` (decoded from the JWT, always present).
|
|
14
|
+
*/
|
|
15
|
+
entitlements?: string[];
|
|
9
16
|
createdAt: string;
|
|
10
17
|
}
|
|
11
18
|
export interface RegisterInput {
|
|
@@ -64,6 +71,13 @@ export interface SessionClaims {
|
|
|
64
71
|
roles: string[];
|
|
65
72
|
sessionId: string;
|
|
66
73
|
userType: SessionUserType;
|
|
74
|
+
/**
|
|
75
|
+
* Per-user entitlements carried in the JWT (CEL-599 / Epic A) — e.g.
|
|
76
|
+
* `"producer-dashboard"`, `"importer-dashboard"`, `"elabel"`. Always an array
|
|
77
|
+
* on the decoded claims (empty if the token predates entitlements or the user
|
|
78
|
+
* holds none); the backend mints them from the `user_entitlements` table.
|
|
79
|
+
*/
|
|
80
|
+
entitlements: string[];
|
|
67
81
|
}
|
|
68
82
|
export type OrgChangeListener = (orgId: string | null) => void;
|
|
69
83
|
export type AccessTokenSetListener = (token: string | null) => void;
|
|
@@ -74,14 +88,24 @@ export interface AuthStore {
|
|
|
74
88
|
setAccessToken(token: string, expiresIn: number): void;
|
|
75
89
|
clearAccessToken(): void;
|
|
76
90
|
ensureAccessToken(forceRefresh?: boolean): Promise<string | null>;
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
/**
|
|
92
|
+
* userId of the current session, or null.
|
|
93
|
+
*
|
|
94
|
+
* CEL-622 — sourced from `GET /auth/me` (the public access token is an opaque
|
|
95
|
+
* encrypted JWE and cannot be decoded client-side). Resolves asynchronously
|
|
96
|
+
* after a token is set/refreshed; reads null until `/auth/me` settles.
|
|
97
|
+
*/
|
|
80
98
|
getUserId(): string | null;
|
|
81
|
-
/** orgId
|
|
99
|
+
/** orgId of the current session, or null. Admin returns null. Sourced from `/auth/me`. */
|
|
82
100
|
getOrgId(): string | null;
|
|
83
|
-
/** userType
|
|
101
|
+
/** userType of the current session, or null. Sourced from `/auth/me`. */
|
|
84
102
|
getUserType(): SessionUserType | null;
|
|
103
|
+
/**
|
|
104
|
+
* Per-user entitlements for the current session (CEL-599). Always an array —
|
|
105
|
+
* empty when logged out or when `/auth/me` carries none. Sourced from
|
|
106
|
+
* `/auth/me` (CEL-622), so it reflects the authoritative server-side state.
|
|
107
|
+
*/
|
|
108
|
+
getEntitlements(): string[];
|
|
85
109
|
/** Subscribe to orgId change events. Returns unsubscribe. */
|
|
86
110
|
onOrgChange(listener: OrgChangeListener): () => void;
|
|
87
111
|
/** Subscribe to access-token (re-)set events. Fires after the token is set. Returns unsubscribe. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IAC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
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0CA,MAAM,OAAO,SAAU,SAAQ,KAAK;IAEhB;IACA;IAEA;IAJlB,YACkB,MAAc,EACd,IAAY,EAC5B,OAAe,EACC,iBAA0B;QAE1C,KAAK,CAAC,OAAO,CAAC,CAAC;QALC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,sBAAiB,GAAjB,iBAAiB,CAAS;QAG1C,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cellarnode/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Shared OTP-based authentication — token store, API client, React UI components for CellarNode dashboards.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,8 +42,7 @@
|
|
|
42
42
|
"typecheck": "tsc --noEmit"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"clsx": "^2.1.0"
|
|
46
|
-
"jose": "^6.2.3"
|
|
45
|
+
"clsx": "^2.1.0"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
48
|
"@react-three/fiber": ">=8.0.0",
|