Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/airtable

src/index.ts

45 lines · 1.2 KB · TypeScript
import {
	patSetupUrl,
	oauthConnectUrl,
	DEFAULT_OAUTH_SCOPES,
	AIRTABLE_CALLBACK_URL,
	AIRTABLE_REQUIRED_HOST,
	AIRTABLE_SCOPES,
} from './setup.ts'

/**
 * Describe the Airtable package, auth lanes, and export surface.
 * @example
 * import airtable from 'kody:@kody/airtable'
 * const overview = await airtable()
 */
export default async function airtableOverview() {
	return {
		name: 'Airtable',
		auth: {
			oauth: {
				defaultIntegration: 'airtable',
				connectUrl: oauthConnectUrl('airtable'),
				callbackUrl: AIRTABLE_CALLBACK_URL,
				scopes: AIRTABLE_SCOPES,
				defaultScopes: [...DEFAULT_OAUTH_SCOPES],
				scopeSeparator: ' ',
				requiredHost: AIRTABLE_REQUIRED_HOST,
			},
			pat: {
				defaultSecret: 'airtablePat',
				setupUrl: patSetupUrl('airtablePat'),
				requiredHost: AIRTABLE_REQUIRED_HOST,
			},
		},
		safety: 'Mutating operations require confirm: true and support dryRun: true.',
		exports: {
			setup: ['accounts', 'smoke-test', 'viewer'],
			bases: ['list-bases', 'get-base'],
			tables: ['list-tables', 'get-table'],
			records: ['list-records', 'get-record', 'create-record', 'update-record', 'delete-record'],
			comments: ['list-comments', 'create-comment'],
			advanced: ['request'],
		},
	}
}