Home / Function/ updateTimestampsWithLastCommitDate() — supabase Function Reference

updateTimestampsWithLastCommitDate() — supabase Function Reference

Architecture documentation for the updateTimestampsWithLastCommitDate() function in last-changed.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  77b76736_2d89_a5d1_7e2a_c8558785ff1e["updateTimestampsWithLastCommitDate()"]
  c4ba6037_4ea4_e34c_3bed_9d9cf63274e8["updateTimestamps()"]
  c4ba6037_4ea4_e34c_3bed_9d9cf63274e8 -->|calls| 77b76736_2d89_a5d1_7e2a_c8558785ff1e
  141368a9_8f24_1698_ef6b_96859cfb64fa["getContentDirParentPage()"]
  77b76736_2d89_a5d1_7e2a_c8558785ff1e -->|calls| 141368a9_8f24_1698_ef6b_96859cfb64fa
  1ba60220_a575_c24f_fe49_f47078e3f7a2["getGitUpdatedAt()"]
  77b76736_2d89_a5d1_7e2a_c8558785ff1e -->|calls| 1ba60220_a575_c24f_fe49_f47078e3f7a2
  style 77b76736_2d89_a5d1_7e2a_c8558785ff1e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/scripts/last-changed.ts lines 211–247

async function updateTimestampsWithLastCommitDate(
  filePath: string,
  section: SectionWithChecksum,
  timestamp: Date,
  ctx: Ctx
) {
  const parentPage = getContentDirParentPage(filePath)

  try {
    const updatedAt = await getGitUpdatedAt(filePath, ctx)

    const { error } = await ctx.supabase
      .from('last_changed')
      .upsert(
        {
          parent_page: parentPage,
          heading: section.heading,
          checksum: section.checksum,
          last_updated: updatedAt,
          last_checked: timestamp,
        },
        {
          onConflict: 'parent_page,heading',
        }
      )
      .lt('last_checked', timestamp)
    if (error) {
      throw Error(error.message ?? 'Failed to upsert')
    }
    ctx.stats.sectionsUpdated++
  } catch (err) {
    console.error(
      `Failed to update timestamp with last commit date for section ${parentPage}:${section.heading}:\n${err}`
    )
    ctx.stats.sectionsErrored++
  }
}

Subdomains

Called By

Frequently Asked Questions

What does updateTimestampsWithLastCommitDate() do?
updateTimestampsWithLastCommitDate() is a function in the supabase codebase.
What does updateTimestampsWithLastCommitDate() call?
updateTimestampsWithLastCommitDate() calls 2 function(s): getContentDirParentPage, getGitUpdatedAt.
What calls updateTimestampsWithLastCommitDate()?
updateTimestampsWithLastCommitDate() is called by 1 function(s): updateTimestamps.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free