Skip to content

src/index.ts

48 lines · 1.5 KB · TypeScript
Raw
/**
 * Describe the Origin package, required Origin App setup, and export map.
 *
 * Use this when you need setup guidance before calling repos, pulls, or request.
 *
 * @returns Package name, auth secret/storage, and export purposes.
 * @example
 * import describeOriginPackage from 'kody:@kentcdodds/origin'
 * const info = await describeOriginPackage()
 * // => { name: '@kentcdodds/origin', kodyId: 'origin', auth: { secret: 'originAppPrivateKey', ... }, exports: [...] }
 */
export default async function describeOriginPackage() {
	return {
		name: '@kentcdodds/origin',
		kodyId: 'origin',
		auth: {
			secret: 'originAppPrivateKey',
			storage: ['originAppId', 'originInstallationId'],
			algorithm: 'EdDSA',
			docs: 'coding_guide_get({ guide: "provider_origin" })',
		},
		exports: [
			{ name: '.', purpose: 'Describe this package and required setup.' },
			{
				name: './rate-limit',
				purpose: 'Zero-cost Origin rate-limit smoke test (app JWT).',
			},
			{
				name: './auth',
				purpose: 'Sign an app JWT and mint an installation token (no token value).',
			},
			{
				name: './installations',
				purpose: 'List app installations and installation-visible repos.',
			},
			{ name: './repos', purpose: 'List or get Origin repositories.' },
			{ name: './pulls', purpose: 'List or get Origin pull requests.' },
			{
				name: './request',
				purpose: 'Raw authenticated request to any /v1/origin path.',
			},
			{
				name: './migrate-from-values',
				purpose: 'Copy leftover originAppId / originInstallationId values into package storage.',
			},
		],
	}
}