Skip to content

defineSource

function defineSource<C>(source: SourceExtension<C>): SourceExtension<C>;

Validate and return a source definition unchanged.

Type ParameterDefault typeDescription
CRecord<string, unknown>The shape of the source’s typed ctx.config preferences.
ParameterTypeDescription
sourceSourceExtension<C>The source to validate — its manifest fields plus sync.

SourceExtension<C>

The same object, with full inferred types preserved.

If sync is missing, or the manifest half is invalid.

export default defineSource({
id: 'hex-blog',
name: 'Hex Blog',
description: 'Data science and analytics engineering posts',
icon: '',
version: '0.1.0',
author: 'Hollyburn Analytics Inc.',
kind: 'scheduled-sync',
transport: 'scrape',
cursor: 'idSet',
ingest: 'append',
runsIn: 'cloud',
schedule: 'weekly',
status: 'implemented',
needsBrowser: false,
egress: ['hex.tech'],
async sync(ctx) {
return scrapeListing(ctx, { listingUrl: 'https://hex.tech/blog' });
},
});