Line data Source code
1 : /// The names that links of older app versions use.
2 : ///
3 : /// Links live outside of the storage and are never rewritten, they are read under every name they
4 : /// ever had. The sessions the links point to are migrated by the session migration.
5 :
6 : /// The query parameter that carried the URL of a hosted session before notebooks were called sessions
7 1 : export const LEGACY_SESSION_QUERY_PARAMETER = 'notebook';
8 : /// The name of the session metadata of a hosted session before notebooks were called sessions
9 1 : export const LEGACY_SESSION_FILE = 'dashql-notebook.json';
10 :
11 : /// Bring the app event of a link to the current names. Links of older versions embed the session
12 : /// ZIP as `notebook` instead of `session`.
13 1 : export function migrateAppEventData(data: unknown): unknown {
14 1 : if (data == null || typeof data !== 'object' || Array.isArray(data) || !('notebook' in data) || 'session' in data) {
15 1 : return data;
16 : }
17 1 : const { notebook, ...rest } = data as Record<string, unknown>;
18 1 : return { ...rest, session: notebook };
19 1 : }
|