UNPKG

@datalayer/core

Version:
24 lines (23 loc) 795 B
/* * Copyright (c) 2023-2025 Datalayer, Inc. * Distributed under the terms of the Modified BSD License. */ import { asUser } from './User'; import { asRuntimeSnapshot } from './RuntimeSnapshot'; export const asPage = (s) => { return { id: s.uid, type: 'page', variant: s.variant_s, name: s.name_t, description: s.description_t, theme: s.theme_s, nbformat: s.nbformat_s ? JSON.parse(s.nbformat_s) : undefined, screenCapture: s.screen_capture_s, tags: (s.tags_ss ?? []), creator: s.creator ? asUser(s.creator) : undefined, creatorId: s.creator_uid, kernelSnapshot: s.kernel_snapshot ? asRuntimeSnapshot(s.kernel_snapshot) : undefined, kernelSnapshotId: s.kernel_snapshot_uid, }; };