@pylonsync/sync 0.4.0 → 0.4.2
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/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/session-resolver.ts +2 -1
- package/src/types.ts +4 -0
package/dist/types.d.ts
CHANGED
|
@@ -27,6 +27,10 @@ export interface ResolvedSession {
|
|
|
27
27
|
tenantId: string | null;
|
|
28
28
|
isAdmin: boolean;
|
|
29
29
|
roles: string[];
|
|
30
|
+
/** Provider profile picture (OAuth `picture` claim), refreshed each
|
|
31
|
+
* login. `null` for password/magic-link users — render an initials
|
|
32
|
+
* fallback. Absent on servers older than 0.4.2. */
|
|
33
|
+
avatarUrl?: string | null;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
32
36
|
* Per-op result on /api/sync/push. Formal shape:
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2348,12 +2348,14 @@ export class SyncEngine {
|
|
|
2348
2348
|
tenant_id?: string | null;
|
|
2349
2349
|
is_admin?: boolean;
|
|
2350
2350
|
roles?: string[];
|
|
2351
|
+
avatar_url?: string | null;
|
|
2351
2352
|
};
|
|
2352
2353
|
return {
|
|
2353
2354
|
userId: raw.user_id ?? null,
|
|
2354
2355
|
tenantId: raw.tenant_id ?? null,
|
|
2355
2356
|
isAdmin: raw.is_admin ?? false,
|
|
2356
2357
|
roles: raw.roles ?? [],
|
|
2358
|
+
avatarUrl: raw.avatar_url ?? null,
|
|
2357
2359
|
};
|
|
2358
2360
|
} catch {
|
|
2359
2361
|
// Swallow — /api/auth/me errors are transient and the next pull
|
package/src/session-resolver.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface TokenTransition {
|
|
|
43
43
|
|
|
44
44
|
const EMPTY_SESSION: ResolvedSession = {
|
|
45
45
|
userId: null,
|
|
46
|
+
avatarUrl: null,
|
|
46
47
|
tenantId: null,
|
|
47
48
|
isAdmin: false,
|
|
48
49
|
roles: [],
|
|
@@ -138,5 +139,5 @@ export class SessionResolver {
|
|
|
138
139
|
* order doesn't trip the equality check. */
|
|
139
140
|
export function sessionSignature(s: ResolvedSession): string {
|
|
140
141
|
const roles = (s.roles ?? []).slice().sort().join(",");
|
|
141
|
-
return `${s.userId ?? ""}|${s.tenantId ?? ""}|${s.isAdmin ? "1" : "0"}|${roles}`;
|
|
142
|
+
return `${s.userId ?? ""}|${s.tenantId ?? ""}|${s.isAdmin ? "1" : "0"}|${roles}|${s.avatarUrl ?? ""}`;
|
|
142
143
|
}
|
package/src/types.ts
CHANGED
|
@@ -35,6 +35,10 @@ export interface ResolvedSession {
|
|
|
35
35
|
tenantId: string | null;
|
|
36
36
|
isAdmin: boolean;
|
|
37
37
|
roles: string[];
|
|
38
|
+
/** Provider profile picture (OAuth `picture` claim), refreshed each
|
|
39
|
+
* login. `null` for password/magic-link users — render an initials
|
|
40
|
+
* fallback. Absent on servers older than 0.4.2. */
|
|
41
|
+
avatarUrl?: string | null;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
/**
|