MCPcopy Index your code
hub / github.com/deepnote/deepnote / generateSnapshotFilename

Function generateSnapshotFilename

packages/convert/src/snapshot/split.ts:98–110  ·  view source on GitHub ↗
(params: GenerateSnapshotFilenameParams)

Source from the content-addressed store, hash-verified

96 * @returns Filename in format '{slug}_{projectId}[_{notebookId}]_{timestamp}.snapshot.deepnote'
97 */
98export function generateSnapshotFilename(params: GenerateSnapshotFilenameParams): string {
99 const { slug, projectId, notebookId, timestamp = 'latest' } = params
100 const safeSlug = sanitizeFilenameComponent(slug)
101 const safeProjectId = sanitizeFilenameComponent(projectId)
102 // Normalize to the parser-readable, '_'-free canonical timestamp form so the name round-trips. A raw
103 // ISO string (':' '.' 'Z') otherwise sanitizes to '_'-laden text that incorrectly parses the notebook id or
104 // fails to match entirely.
105 const safeTimestamp = sanitizeTimestampComponent(timestamp)
106 if (notebookId) {
107 return `${safeSlug}_${safeProjectId}_${encodeNotebookIdForFilename(notebookId)}_${safeTimestamp}.snapshot.deepnote`
108 }
109 return `${safeSlug}_${safeProjectId}_${safeTimestamp}.snapshot.deepnote`
110}
111
112/**
113 * Removes output-related fields from a block, returning a clean source block.

Callers 4

lookup.test.tsFile · 0.90
split.test.tsFile · 0.90
getSnapshotPathFunction · 0.90

Calls 3

Tested by

no test coverage detected