defineSource
function defineSource<C>(source: SourceExtension<C>): SourceExtension<C>;Validate and return a source definition unchanged.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type | Description |
|---|---|---|
C | Record<string, unknown> | The shape of the source’s typed ctx.config preferences. |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
source | SourceExtension<C> | The source to validate — its manifest fields plus sync. |
Returns
Section titled “Returns”The same object, with full inferred types preserved.
Throws
Section titled “Throws”If sync is missing, or the manifest half is invalid.
Example
Section titled “Example”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' }); },});