repositoryProjectPathConfig.ts 844 B

1234567891011121314151617181920212223242526272829303132
  1. import type {
  2. Integration,
  3. Project,
  4. Repository,
  5. RepositoryProjectPathConfig as RepositoryProjectPathConfigType,
  6. } from 'sentry/types';
  7. interface RepositoryProjectPathConfigArgs
  8. extends Partial<RepositoryProjectPathConfigType> {
  9. integration: Pick<Integration, 'id' | 'provider'>;
  10. project: Pick<Project, 'id' | 'slug'>;
  11. repo: Pick<Repository, 'id' | 'name'>;
  12. }
  13. export function RepositoryProjectPathConfig(
  14. params: RepositoryProjectPathConfigArgs
  15. ): RepositoryProjectPathConfigType {
  16. const {project, repo, integration, ...rest} = params;
  17. return {
  18. id: '2',
  19. projectId: project.id,
  20. projectSlug: project.slug,
  21. repoId: repo.id,
  22. repoName: repo.name,
  23. integrationId: integration.id,
  24. provider: integration.provider,
  25. stackRoot: '',
  26. sourceRoot: '',
  27. defaultBranch: 'master',
  28. ...rest,
  29. };
  30. }