-
Notifications
You must be signed in to change notification settings - Fork 254
Expand file tree
/
Copy pathtypes.ts
More file actions
67 lines (57 loc) · 2.14 KB
/
types.ts
File metadata and controls
67 lines (57 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { IdentityProviderConfig, Settings as SettingsSchema } from "@sourcebot/schemas/v3/index.type";
import { z } from "zod";
export type ConfigSettings = Required<SettingsSchema>;
// Structure of the `metadata` field in the `Repo` table.
//
// @WARNING: If you modify this schema, please make sure it is backwards
// compatible with any prior versions of the schema!!
// @NOTE: If you move this schema, please update the comment in schema.prisma
// to point to the new location.
export const repoMetadataSchema = z.object({
/**
* A set of key-value pairs that will be used as git config
* variables when cloning the repo.
* @see: https://git-scm.com/docs/git-clone#Documentation/git-clone.txt-code--configcodecodeltkeygtltvaluegtcode
*/
gitConfig: z.record(z.string(), z.string()).optional(),
/**
* A list of branches to index. Glob patterns are supported.
*/
branches: z.array(z.string()).optional(),
/**
* A list of tags to index. Glob patterns are supported.
*/
tags: z.array(z.string()).optional(),
/**
* A list of revisions that were indexed for the repo.
*/
indexedRevisions: z.array(z.string()).optional(),
/**
* Code host specific metadata, keyed by code host type.
*/
codeHostMetadata: z.object({
bitbucketCloud: z.object({
workspace: z.string(),
repoSlug: z.string(),
}).optional(),
bitbucketServer: z.object({
projectKey: z.string(),
repoSlug: z.string(),
}).optional(),
gitlab: z.object({
topics: z.array(z.string()),
}).optional(),
github: z.object({
topics: z.array(z.string()),
}).optional(),
}).optional(),
});
export type RepoMetadata = z.infer<typeof repoMetadataSchema>;
export const repoIndexingJobMetadataSchema = z.object({
/**
* A list of revisions that were indexed for the repo.
*/
indexedRevisions: z.array(z.string()).optional(),
});
export type RepoIndexingJobMetadata = z.infer<typeof repoIndexingJobMetadataSchema>;
export type IdentityProviderType = IdentityProviderConfig['provider'];