Files
supabase/packages/common/marketplace-client.ts
Raminder Singh e33331fa92 feat: use the new timestamp published at and built by columns (#46552)
This PR starts using the new `built_by`, `published_in_marketplace_at`,
and `published_in_catalog_at` columns in preparation for removing the
old deprecated fields `publish_marketplace`, `publish_dashboard`.

- [x] Test dashboard changes in preview.
- [x] Test www changes in preview.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Updated marketplace integration identification to use publication
status instead of publish flags for more accurate filtering and display.
* Corrected the developer attribution field displayed for technology
partner integrations to reflect accurate authorship information.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-03 14:57:38 +05:30

65 lines
1.7 KiB
TypeScript

import { createClient } from '@supabase/supabase-js'
import { MergeDeep } from 'type-fest'
import type { Database as DatabaseGenerated } from './marketplace.types'
export type Category = {
id: string
name: string
slug: string
description: string
}
export type Database = MergeDeep<
DatabaseGenerated,
{
public: {
Views: {
listings: {
Row: {
// add a type for the JSON structure
categories: Category[]
// These all come from non-nullable columns but all view columns are inferred as nullable.
// See https://github.com/orgs/supabase/discussions/14151
featured: boolean
partner_name: string
built_by: string
slug: string
title: string
description: string
content: string
website_url: string
documentation_url: string
listing_logo: string
}
}
}
}
}
>
export type Listing = Database['public']['Views']['listings']['Row']
export const createMarketplaceClient = () => {
const API_URL = process.env.NEXT_PUBLIC_MARKETPLACE_API_URL || ''
const PUBLISHABLE_KEY = process.env.NEXT_PUBLIC_MARKETPLACE_PUBLISHABLE_KEY || ''
return createClient<Database>(API_URL, PUBLISHABLE_KEY, {
auth: {
persistSession: false,
autoRefreshToken: false,
detectSessionInUrl: false,
storage: {
getItem: (_key: string) => null,
setItem: (_key: string, _value: string) => {},
removeItem: (_key: string) => {},
},
},
})
}
export const fullImageUrl = (imagePath: string) => {
const API_URL = process.env.NEXT_PUBLIC_MARKETPLACE_API_URL || ''
return `${API_URL}${imagePath}`
}