Skip to content

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

Package listing

@kody/figma

src/index.ts

45 lines · 1.2 KB · TypeScript
import {
	patSetupUrl,
	oauthConnectUrl,
	DEFAULT_OAUTH_SCOPES,
	FIGMA_CALLBACK_URL,
	FIGMA_REQUIRED_HOST,
	FIGMA_SCOPES,
} from './setup.ts'

/**
 * Describe the Figma package, auth lanes, and export surface.
 * @example
 * import figma from 'kody:@kody/figma'
 * const overview = await figma()
 */
export default async function figmaOverview() {
	return {
		name: 'Figma',
		auth: {
			oauth: {
				defaultIntegration: 'figma',
				connectUrl: oauthConnectUrl('figma'),
				callbackUrl: FIGMA_CALLBACK_URL,
				scopes: FIGMA_SCOPES,
				defaultScopes: [...DEFAULT_OAUTH_SCOPES],
				scopeSeparator: ' ',
				requiredHost: FIGMA_REQUIRED_HOST,
			},
			pat: {
				defaultSecret: 'figmaPat',
				setupUrl: patSetupUrl('figmaPat'),
				requiredHost: FIGMA_REQUIRED_HOST,
			},
		},
		safety: 'Comment and other write mutations require confirm: true and support dryRun: true.',
		exports: {
			setup: ['accounts', 'smoke-test', 'viewer'],
			files: ['get-file', 'get-file-nodes', 'get-file-meta'],
			comments: ['list-comments', 'create-comment', 'delete-comment'],
			library: ['list-file-components', 'list-file-styles'],
			images: ['get-images', 'get-image-fills'],
			advanced: ['request'],
		},
	}
}