(value: unknown)
| 60 | } |
| 61 | |
| 62 | export function migrateLegacySessionStateKeys(value: unknown) { |
| 63 | if (!value || typeof value !== "object" || Array.isArray(value)) return value |
| 64 | const entries = Object.entries(value) |
| 65 | if (entries.every(([key]) => key.includes(separator))) return value |
| 66 | const scoped = Object.fromEntries(entries.filter(([key]) => key.includes(separator))) |
| 67 | for (const [key, item] of entries) { |
| 68 | if (key.includes(separator)) continue |
| 69 | const next = SessionStateKey.from(ServerScope.local, SessionRouteKey.fromLegacy(key)) |
| 70 | if (!(next in scoped)) scoped[next] = item |
| 71 | } |
| 72 | return scoped |
| 73 | } |
no test coverage detected