@pierre/storage 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -9,10 +9,15 @@ import type {
9
9
  ListBranchesResponseRaw,
10
10
  ListCommitsResponseRaw,
11
11
  ListFilesResponseRaw,
12
+ ListReposResponseRaw,
13
+ NoteReadResponseRaw,
14
+ NoteWriteResponseRaw,
12
15
  RawBranchInfo as SchemaRawBranchInfo,
13
16
  RawCommitInfo as SchemaRawCommitInfo,
14
17
  RawFileDiff as SchemaRawFileDiff,
15
18
  RawFilteredFile as SchemaRawFilteredFile,
19
+ RawRepoBaseInfo as SchemaRawRepoBaseInfo,
20
+ RawRepoInfo as SchemaRawRepoInfo,
16
21
  } from './schemas';
17
22
 
18
23
  export interface OverrideableGitStorageOptions {
@@ -31,7 +36,7 @@ export interface GitStorageOptions extends OverrideableGitStorageOptions {
31
36
  export type ValidAPIVersion = 1;
32
37
 
33
38
  export interface GetRemoteURLOptions {
34
- permissions?: ('git:write' | 'git:read' | 'repo:write')[];
39
+ permissions?: ('git:write' | 'git:read' | 'repo:write' | 'org:read')[];
35
40
  ttl?: number;
36
41
  }
37
42
 
@@ -45,6 +50,10 @@ export interface Repo {
45
50
  listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
46
51
  listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
47
52
  listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
53
+ getNote(options: GetNoteOptions): Promise<GetNoteResult>;
54
+ createNote(options: CreateNoteOptions): Promise<NoteWriteResult>;
55
+ appendNote(options: AppendNoteOptions): Promise<NoteWriteResult>;
56
+ deleteNote(options: DeleteNoteOptions): Promise<NoteWriteResult>;
48
57
  getBranchDiff(options: GetBranchDiffOptions): Promise<GetBranchDiffResult>;
49
58
  getCommitDiff(options: GetCommitDiffOptions): Promise<GetCommitDiffResult>;
50
59
  grep(options: GrepOptions): Promise<GrepResult>;
@@ -74,7 +83,7 @@ export interface FindOneOptions {
74
83
 
75
84
  export type SupportedRepoProvider = 'github';
76
85
 
77
- export interface BaseRepo {
86
+ export interface GitHubBaseRepo {
78
87
  /**
79
88
  * @default github
80
89
  */
@@ -84,6 +93,45 @@ export interface BaseRepo {
84
93
  defaultBranch?: string;
85
94
  }
86
95
 
96
+ export interface ForkBaseRepo {
97
+ id: string;
98
+ ref?: string;
99
+ sha?: string;
100
+ }
101
+
102
+ export type BaseRepo = GitHubBaseRepo | ForkBaseRepo;
103
+
104
+ export interface ListReposOptions extends GitStorageInvocationOptions {
105
+ cursor?: string;
106
+ limit?: number;
107
+ }
108
+
109
+ export type RawRepoBaseInfo = SchemaRawRepoBaseInfo;
110
+
111
+ export interface RepoBaseInfo {
112
+ provider: string;
113
+ owner: string;
114
+ name: string;
115
+ }
116
+
117
+ export type RawRepoInfo = SchemaRawRepoInfo;
118
+
119
+ export interface RepoInfo {
120
+ repoId: string;
121
+ url: string;
122
+ defaultBranch: string;
123
+ createdAt: string;
124
+ baseRepo?: RepoBaseInfo;
125
+ }
126
+
127
+ export type ListReposResponse = ListReposResponseRaw;
128
+
129
+ export interface ListReposResult {
130
+ repos: RepoInfo[];
131
+ nextCursor?: string;
132
+ hasMore: boolean;
133
+ }
134
+
87
135
  export interface CreateRepoOptions extends GitStorageInvocationOptions {
88
136
  id?: string;
89
137
  baseRepo?: BaseRepo;
@@ -192,6 +240,52 @@ export interface ListCommitsResult {
192
240
  hasMore: boolean;
193
241
  }
194
242
 
243
+ // Git notes API types
244
+ export interface GetNoteOptions extends GitStorageInvocationOptions {
245
+ sha: string;
246
+ }
247
+
248
+ export type GetNoteResponse = NoteReadResponseRaw;
249
+
250
+ export interface GetNoteResult {
251
+ sha: string;
252
+ note: string;
253
+ refSha: string;
254
+ }
255
+
256
+ interface NoteWriteBaseOptions extends GitStorageInvocationOptions {
257
+ sha: string;
258
+ note: string;
259
+ expectedRefSha?: string;
260
+ author?: CommitSignature;
261
+ }
262
+
263
+ export type CreateNoteOptions = NoteWriteBaseOptions;
264
+
265
+ export type AppendNoteOptions = NoteWriteBaseOptions;
266
+
267
+ export interface DeleteNoteOptions extends GitStorageInvocationOptions {
268
+ sha: string;
269
+ expectedRefSha?: string;
270
+ author?: CommitSignature;
271
+ }
272
+
273
+ export interface NoteWriteResultPayload {
274
+ success: boolean;
275
+ status: string;
276
+ message?: string;
277
+ }
278
+
279
+ export type NoteWriteResponse = NoteWriteResponseRaw;
280
+
281
+ export interface NoteWriteResult {
282
+ sha: string;
283
+ targetRef: string;
284
+ baseCommit?: string;
285
+ newRefSha: string;
286
+ result: NoteWriteResultPayload;
287
+ }
288
+
195
289
  // Branch Diff API types
196
290
  export interface GetBranchDiffOptions extends GitStorageInvocationOptions {
197
291
  branch: string;