@pierre/storage 0.9.2 → 1.0.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/README.md +77 -43
- package/dist/index.cjs +148 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +148 -43
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/commit-pack.ts +103 -99
- package/src/commit.ts +373 -365
- package/src/diff-commit.ts +272 -259
- package/src/errors.ts +34 -34
- package/src/fetch.ts +146 -141
- package/src/index.ts +1400 -1249
- package/src/schemas.ts +120 -114
- package/src/stream-utils.ts +225 -208
- package/src/types.ts +378 -354
- package/src/util.ts +41 -34
- package/src/version.ts +1 -1
- package/src/webhook.ts +244 -239
package/src/types.ts
CHANGED
|
@@ -1,263 +1,272 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type definitions for Pierre Git Storage SDK
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
4
|
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
CreateBranchResponseRaw,
|
|
6
|
+
GetBranchDiffResponseRaw,
|
|
7
|
+
GetCommitDiffResponseRaw,
|
|
8
|
+
ListBranchesResponseRaw,
|
|
9
|
+
ListCommitsResponseRaw,
|
|
10
|
+
ListFilesResponseRaw,
|
|
11
|
+
ListReposResponseRaw,
|
|
12
|
+
NoteReadResponseRaw,
|
|
13
|
+
NoteWriteResponseRaw,
|
|
14
|
+
RawBranchInfo as SchemaRawBranchInfo,
|
|
15
|
+
RawCommitInfo as SchemaRawCommitInfo,
|
|
16
|
+
RawFileDiff as SchemaRawFileDiff,
|
|
17
|
+
RawFilteredFile as SchemaRawFilteredFile,
|
|
18
|
+
RawRepoBaseInfo as SchemaRawRepoBaseInfo,
|
|
19
|
+
RawRepoInfo as SchemaRawRepoInfo,
|
|
21
20
|
} from './schemas';
|
|
22
21
|
|
|
23
22
|
export interface OverrideableGitStorageOptions {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
apiBaseUrl?: string;
|
|
24
|
+
storageBaseUrl?: string;
|
|
25
|
+
apiVersion?: ValidAPIVersion;
|
|
26
|
+
defaultTTL?: number;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export interface GitStorageOptions extends OverrideableGitStorageOptions {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
key: string;
|
|
31
|
+
name: string;
|
|
32
|
+
defaultTTL?: number;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
export type ValidAPIVersion = 1;
|
|
37
36
|
|
|
38
37
|
export interface GetRemoteURLOptions {
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
permissions?: ('git:write' | 'git:read' | 'repo:write' | 'org:read')[];
|
|
39
|
+
ttl?: number;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
export interface Repo {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
id: string;
|
|
44
|
+
defaultBranch: string;
|
|
45
|
+
getRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
46
|
+
getEphemeralRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
47
|
+
|
|
48
|
+
getFileStream(options: GetFileOptions): Promise<Response>;
|
|
49
|
+
getArchiveStream(options?: ArchiveOptions): Promise<Response>;
|
|
50
|
+
listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
|
|
51
|
+
listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
|
|
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>;
|
|
57
|
+
getBranchDiff(options: GetBranchDiffOptions): Promise<GetBranchDiffResult>;
|
|
58
|
+
getCommitDiff(options: GetCommitDiffOptions): Promise<GetCommitDiffResult>;
|
|
59
|
+
grep(options: GrepOptions): Promise<GrepResult>;
|
|
60
|
+
pullUpstream(options?: PullUpstreamOptions): Promise<void>;
|
|
61
|
+
restoreCommit(options: RestoreCommitOptions): Promise<RestoreCommitResult>;
|
|
62
|
+
createBranch(options: CreateBranchOptions): Promise<CreateBranchResult>;
|
|
63
|
+
createCommit(options: CreateCommitOptions): CommitBuilder;
|
|
64
|
+
createCommitFromDiff(
|
|
65
|
+
options: CreateCommitFromDiffOptions
|
|
66
|
+
): Promise<CommitResult>;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
export type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
68
70
|
type SimplePath = string;
|
|
69
71
|
type ComplexPath = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
path: string;
|
|
73
|
+
params?: Record<string, string | string[]>;
|
|
74
|
+
body?: Record<string, any>;
|
|
73
75
|
};
|
|
74
76
|
export type ValidPath = SimplePath | ComplexPath;
|
|
75
77
|
|
|
76
78
|
interface GitStorageInvocationOptions {
|
|
77
|
-
|
|
79
|
+
ttl?: number;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
export interface FindOneOptions {
|
|
81
|
-
|
|
83
|
+
id: string;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
export type SupportedRepoProvider = 'github';
|
|
85
87
|
|
|
86
88
|
export interface GitHubBaseRepo {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
/**
|
|
90
|
+
* @default github
|
|
91
|
+
*/
|
|
92
|
+
provider?: SupportedRepoProvider;
|
|
93
|
+
owner: string;
|
|
94
|
+
name: string;
|
|
95
|
+
defaultBranch?: string;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
export interface ForkBaseRepo {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
id: string;
|
|
100
|
+
ref?: string;
|
|
101
|
+
sha?: string;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
export type BaseRepo = GitHubBaseRepo | ForkBaseRepo;
|
|
103
105
|
|
|
104
106
|
export interface ListReposOptions extends GitStorageInvocationOptions {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
cursor?: string;
|
|
108
|
+
limit?: number;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
export type RawRepoBaseInfo = SchemaRawRepoBaseInfo;
|
|
110
112
|
|
|
111
113
|
export interface RepoBaseInfo {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
provider: string;
|
|
115
|
+
owner: string;
|
|
116
|
+
name: string;
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
export type RawRepoInfo = SchemaRawRepoInfo;
|
|
118
120
|
|
|
119
121
|
export interface RepoInfo {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
repoId: string;
|
|
123
|
+
url: string;
|
|
124
|
+
defaultBranch: string;
|
|
125
|
+
createdAt: string;
|
|
126
|
+
baseRepo?: RepoBaseInfo;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
export type ListReposResponse = ListReposResponseRaw;
|
|
128
130
|
|
|
129
131
|
export interface ListReposResult {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
repos: RepoInfo[];
|
|
133
|
+
nextCursor?: string;
|
|
134
|
+
hasMore: boolean;
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
export interface CreateRepoOptions extends GitStorageInvocationOptions {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
id?: string;
|
|
139
|
+
baseRepo?: BaseRepo;
|
|
140
|
+
defaultBranch?: string;
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
export interface DeleteRepoOptions extends GitStorageInvocationOptions {
|
|
142
|
-
|
|
144
|
+
id: string;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
export interface DeleteRepoResult {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
repoId: string;
|
|
149
|
+
message: string;
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
// Get File API types
|
|
151
153
|
export interface GetFileOptions extends GitStorageInvocationOptions {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
path: string;
|
|
155
|
+
ref?: string;
|
|
156
|
+
ephemeral?: boolean;
|
|
157
|
+
ephemeralBase?: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ArchiveOptions extends GitStorageInvocationOptions {
|
|
161
|
+
ref?: string;
|
|
162
|
+
includeGlobs?: string[];
|
|
163
|
+
excludeGlobs?: string[];
|
|
164
|
+
archivePrefix?: string;
|
|
156
165
|
}
|
|
157
166
|
|
|
158
167
|
export interface PullUpstreamOptions extends GitStorageInvocationOptions {
|
|
159
|
-
|
|
168
|
+
ref?: string;
|
|
160
169
|
}
|
|
161
170
|
|
|
162
171
|
// List Files API types
|
|
163
172
|
export interface ListFilesOptions extends GitStorageInvocationOptions {
|
|
164
|
-
|
|
165
|
-
|
|
173
|
+
ref?: string;
|
|
174
|
+
ephemeral?: boolean;
|
|
166
175
|
}
|
|
167
176
|
|
|
168
177
|
export type ListFilesResponse = ListFilesResponseRaw;
|
|
169
178
|
|
|
170
179
|
export interface ListFilesResult {
|
|
171
|
-
|
|
172
|
-
|
|
180
|
+
paths: string[];
|
|
181
|
+
ref: string;
|
|
173
182
|
}
|
|
174
183
|
|
|
175
184
|
// List Branches API types
|
|
176
185
|
export interface ListBranchesOptions extends GitStorageInvocationOptions {
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
cursor?: string;
|
|
187
|
+
limit?: number;
|
|
179
188
|
}
|
|
180
189
|
|
|
181
190
|
export type RawBranchInfo = SchemaRawBranchInfo;
|
|
182
191
|
|
|
183
192
|
export interface BranchInfo {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
193
|
+
cursor: string;
|
|
194
|
+
name: string;
|
|
195
|
+
headSha: string;
|
|
196
|
+
createdAt: string;
|
|
188
197
|
}
|
|
189
198
|
|
|
190
199
|
export type ListBranchesResponse = ListBranchesResponseRaw;
|
|
191
200
|
|
|
192
201
|
export interface ListBranchesResult {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
branches: BranchInfo[];
|
|
203
|
+
nextCursor?: string;
|
|
204
|
+
hasMore: boolean;
|
|
196
205
|
}
|
|
197
206
|
|
|
198
207
|
// Create Branch API types
|
|
199
208
|
export interface CreateBranchOptions extends GitStorageInvocationOptions {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
209
|
+
baseBranch: string;
|
|
210
|
+
targetBranch: string;
|
|
211
|
+
baseIsEphemeral?: boolean;
|
|
212
|
+
targetIsEphemeral?: boolean;
|
|
204
213
|
}
|
|
205
214
|
|
|
206
215
|
export type CreateBranchResponse = CreateBranchResponseRaw;
|
|
207
216
|
|
|
208
217
|
export interface CreateBranchResult {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
218
|
+
message: string;
|
|
219
|
+
targetBranch: string;
|
|
220
|
+
targetIsEphemeral: boolean;
|
|
221
|
+
commitSha?: string;
|
|
213
222
|
}
|
|
214
223
|
|
|
215
224
|
// List Commits API types
|
|
216
225
|
export interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
226
|
+
branch?: string;
|
|
227
|
+
cursor?: string;
|
|
228
|
+
limit?: number;
|
|
220
229
|
}
|
|
221
230
|
|
|
222
231
|
export type RawCommitInfo = SchemaRawCommitInfo;
|
|
223
232
|
|
|
224
233
|
export interface CommitInfo {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
sha: string;
|
|
235
|
+
message: string;
|
|
236
|
+
authorName: string;
|
|
237
|
+
authorEmail: string;
|
|
238
|
+
committerName: string;
|
|
239
|
+
committerEmail: string;
|
|
240
|
+
date: Date;
|
|
241
|
+
rawDate: string;
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
export type ListCommitsResponse = ListCommitsResponseRaw;
|
|
236
245
|
|
|
237
246
|
export interface ListCommitsResult {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
247
|
+
commits: CommitInfo[];
|
|
248
|
+
nextCursor?: string;
|
|
249
|
+
hasMore: boolean;
|
|
241
250
|
}
|
|
242
251
|
|
|
243
252
|
// Git notes API types
|
|
244
253
|
export interface GetNoteOptions extends GitStorageInvocationOptions {
|
|
245
|
-
|
|
254
|
+
sha: string;
|
|
246
255
|
}
|
|
247
256
|
|
|
248
257
|
export type GetNoteResponse = NoteReadResponseRaw;
|
|
249
258
|
|
|
250
259
|
export interface GetNoteResult {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
260
|
+
sha: string;
|
|
261
|
+
note: string;
|
|
262
|
+
refSha: string;
|
|
254
263
|
}
|
|
255
264
|
|
|
256
265
|
interface NoteWriteBaseOptions extends GitStorageInvocationOptions {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
266
|
+
sha: string;
|
|
267
|
+
note: string;
|
|
268
|
+
expectedRefSha?: string;
|
|
269
|
+
author?: CommitSignature;
|
|
261
270
|
}
|
|
262
271
|
|
|
263
272
|
export type CreateNoteOptions = NoteWriteBaseOptions;
|
|
@@ -265,126 +274,130 @@ export type CreateNoteOptions = NoteWriteBaseOptions;
|
|
|
265
274
|
export type AppendNoteOptions = NoteWriteBaseOptions;
|
|
266
275
|
|
|
267
276
|
export interface DeleteNoteOptions extends GitStorageInvocationOptions {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
sha: string;
|
|
278
|
+
expectedRefSha?: string;
|
|
279
|
+
author?: CommitSignature;
|
|
271
280
|
}
|
|
272
281
|
|
|
273
282
|
export interface NoteWriteResultPayload {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
283
|
+
success: boolean;
|
|
284
|
+
status: string;
|
|
285
|
+
message?: string;
|
|
277
286
|
}
|
|
278
287
|
|
|
279
288
|
export type NoteWriteResponse = NoteWriteResponseRaw;
|
|
280
289
|
|
|
281
290
|
export interface NoteWriteResult {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
291
|
+
sha: string;
|
|
292
|
+
targetRef: string;
|
|
293
|
+
baseCommit?: string;
|
|
294
|
+
newRefSha: string;
|
|
295
|
+
result: NoteWriteResultPayload;
|
|
287
296
|
}
|
|
288
297
|
|
|
289
298
|
// Branch Diff API types
|
|
290
299
|
export interface GetBranchDiffOptions extends GitStorageInvocationOptions {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
300
|
+
branch: string;
|
|
301
|
+
base?: string;
|
|
302
|
+
ephemeral?: boolean;
|
|
303
|
+
ephemeralBase?: boolean;
|
|
304
|
+
/** Optional paths to filter the diff to specific files */
|
|
305
|
+
paths?: string[];
|
|
297
306
|
}
|
|
298
307
|
|
|
299
308
|
export type GetBranchDiffResponse = GetBranchDiffResponseRaw;
|
|
300
309
|
|
|
301
310
|
export interface GetBranchDiffResult {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
branch: string;
|
|
312
|
+
base: string;
|
|
313
|
+
stats: DiffStats;
|
|
314
|
+
files: FileDiff[];
|
|
315
|
+
filteredFiles: FilteredFile[];
|
|
307
316
|
}
|
|
308
317
|
|
|
309
318
|
// Commit Diff API types
|
|
310
319
|
export interface GetCommitDiffOptions extends GitStorageInvocationOptions {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
320
|
+
sha: string;
|
|
321
|
+
baseSha?: string;
|
|
322
|
+
/** Optional paths to filter the diff to specific files */
|
|
323
|
+
paths?: string[];
|
|
315
324
|
}
|
|
316
325
|
|
|
317
326
|
export type GetCommitDiffResponse = GetCommitDiffResponseRaw;
|
|
318
327
|
|
|
319
328
|
export interface GetCommitDiffResult {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
329
|
+
sha: string;
|
|
330
|
+
stats: DiffStats;
|
|
331
|
+
files: FileDiff[];
|
|
332
|
+
filteredFiles: FilteredFile[];
|
|
324
333
|
}
|
|
325
334
|
|
|
326
335
|
// Grep API types
|
|
327
336
|
export interface GrepOptions extends GitStorageInvocationOptions {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
337
|
+
ref?: string;
|
|
338
|
+
/**
|
|
339
|
+
* @deprecated Use ref instead.
|
|
340
|
+
*/
|
|
341
|
+
rev?: string;
|
|
342
|
+
paths?: string[];
|
|
343
|
+
query: {
|
|
344
|
+
pattern: string;
|
|
345
|
+
/**
|
|
346
|
+
* Default is case-sensitive.
|
|
347
|
+
* When omitted, the server default is used.
|
|
348
|
+
*/
|
|
349
|
+
caseSensitive?: boolean;
|
|
350
|
+
};
|
|
351
|
+
fileFilters?: {
|
|
352
|
+
includeGlobs?: string[];
|
|
353
|
+
excludeGlobs?: string[];
|
|
354
|
+
extensionFilters?: string[];
|
|
355
|
+
};
|
|
356
|
+
context?: {
|
|
357
|
+
before?: number;
|
|
358
|
+
after?: number;
|
|
359
|
+
};
|
|
360
|
+
limits?: {
|
|
361
|
+
maxLines?: number;
|
|
362
|
+
maxMatchesPerFile?: number;
|
|
363
|
+
};
|
|
364
|
+
pagination?: {
|
|
365
|
+
cursor?: string;
|
|
366
|
+
limit?: number;
|
|
367
|
+
};
|
|
355
368
|
}
|
|
356
369
|
|
|
357
370
|
export interface GrepLine {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
371
|
+
lineNumber: number;
|
|
372
|
+
text: string;
|
|
373
|
+
type: string;
|
|
361
374
|
}
|
|
362
375
|
|
|
363
376
|
export interface GrepFileMatch {
|
|
364
|
-
|
|
365
|
-
|
|
377
|
+
path: string;
|
|
378
|
+
lines: GrepLine[];
|
|
366
379
|
}
|
|
367
380
|
|
|
368
381
|
export interface GrepResult {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
382
|
+
query: {
|
|
383
|
+
pattern: string;
|
|
384
|
+
caseSensitive: boolean;
|
|
385
|
+
};
|
|
386
|
+
repo: {
|
|
387
|
+
ref: string;
|
|
388
|
+
commit: string;
|
|
389
|
+
};
|
|
390
|
+
matches: GrepFileMatch[];
|
|
391
|
+
nextCursor?: string;
|
|
392
|
+
hasMore: boolean;
|
|
380
393
|
}
|
|
381
394
|
|
|
382
395
|
// Shared diff types
|
|
383
396
|
export interface DiffStats {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
397
|
+
files: number;
|
|
398
|
+
additions: number;
|
|
399
|
+
deletions: number;
|
|
400
|
+
changes: number;
|
|
388
401
|
}
|
|
389
402
|
|
|
390
403
|
export type RawFileDiff = SchemaRawFileDiff;
|
|
@@ -392,243 +405,254 @@ export type RawFileDiff = SchemaRawFileDiff;
|
|
|
392
405
|
export type RawFilteredFile = SchemaRawFilteredFile;
|
|
393
406
|
|
|
394
407
|
export type DiffFileState =
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
408
|
+
| 'added'
|
|
409
|
+
| 'modified'
|
|
410
|
+
| 'deleted'
|
|
411
|
+
| 'renamed'
|
|
412
|
+
| 'copied'
|
|
413
|
+
| 'type_changed'
|
|
414
|
+
| 'unmerged'
|
|
415
|
+
| 'unknown';
|
|
403
416
|
|
|
404
417
|
export interface DiffFileBase {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
418
|
+
path: string;
|
|
419
|
+
state: DiffFileState;
|
|
420
|
+
rawState: string;
|
|
421
|
+
oldPath?: string;
|
|
422
|
+
bytes: number;
|
|
423
|
+
isEof: boolean;
|
|
411
424
|
}
|
|
412
425
|
|
|
413
426
|
export interface FileDiff extends DiffFileBase {
|
|
414
|
-
|
|
427
|
+
raw: string;
|
|
415
428
|
}
|
|
416
429
|
|
|
417
430
|
export interface FilteredFile extends DiffFileBase {}
|
|
418
431
|
|
|
419
432
|
interface CreateCommitBaseOptions extends GitStorageInvocationOptions {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
433
|
+
commitMessage: string;
|
|
434
|
+
expectedHeadSha?: string;
|
|
435
|
+
baseBranch?: string;
|
|
436
|
+
ephemeral?: boolean;
|
|
437
|
+
ephemeralBase?: boolean;
|
|
438
|
+
author: CommitSignature;
|
|
439
|
+
committer?: CommitSignature;
|
|
440
|
+
signal?: AbortSignal;
|
|
428
441
|
}
|
|
429
442
|
|
|
430
443
|
export interface CreateCommitBranchOptions extends CreateCommitBaseOptions {
|
|
431
|
-
|
|
432
|
-
|
|
444
|
+
targetBranch: string;
|
|
445
|
+
targetRef?: never;
|
|
433
446
|
}
|
|
434
447
|
|
|
435
448
|
/**
|
|
436
449
|
* @deprecated Use {@link CreateCommitBranchOptions} instead.
|
|
437
450
|
*/
|
|
438
451
|
export interface LegacyCreateCommitOptions extends CreateCommitBaseOptions {
|
|
439
|
-
|
|
440
|
-
|
|
452
|
+
targetBranch?: never;
|
|
453
|
+
targetRef: string;
|
|
441
454
|
}
|
|
442
455
|
|
|
443
|
-
export type CreateCommitOptions =
|
|
456
|
+
export type CreateCommitOptions =
|
|
457
|
+
| CreateCommitBranchOptions
|
|
458
|
+
| LegacyCreateCommitOptions;
|
|
444
459
|
|
|
445
460
|
export interface CommitSignature {
|
|
446
|
-
|
|
447
|
-
|
|
461
|
+
name: string;
|
|
462
|
+
email: string;
|
|
448
463
|
}
|
|
449
464
|
|
|
450
465
|
export interface ReadableStreamReaderLike<T> {
|
|
451
|
-
|
|
452
|
-
|
|
466
|
+
read(): Promise<{ value?: T; done: boolean }>;
|
|
467
|
+
releaseLock?(): void;
|
|
453
468
|
}
|
|
454
469
|
|
|
455
470
|
export interface ReadableStreamLike<T> {
|
|
456
|
-
|
|
471
|
+
getReader(): ReadableStreamReaderLike<T>;
|
|
457
472
|
}
|
|
458
473
|
|
|
459
474
|
export interface BlobLike {
|
|
460
|
-
|
|
475
|
+
stream(): unknown;
|
|
461
476
|
}
|
|
462
477
|
|
|
463
478
|
export interface FileLike extends BlobLike {
|
|
464
|
-
|
|
465
|
-
|
|
479
|
+
name: string;
|
|
480
|
+
lastModified?: number;
|
|
466
481
|
}
|
|
467
482
|
|
|
468
483
|
export type GitFileMode = '100644' | '100755' | '120000' | '160000';
|
|
469
484
|
|
|
470
485
|
export type TextEncoding =
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
486
|
+
| 'ascii'
|
|
487
|
+
| 'utf8'
|
|
488
|
+
| 'utf-8'
|
|
489
|
+
| 'utf16le'
|
|
490
|
+
| 'utf-16le'
|
|
491
|
+
| 'ucs2'
|
|
492
|
+
| 'ucs-2'
|
|
493
|
+
| 'base64'
|
|
494
|
+
| 'base64url'
|
|
495
|
+
| 'latin1'
|
|
496
|
+
| 'binary'
|
|
497
|
+
| 'hex';
|
|
483
498
|
|
|
484
499
|
export type CommitFileSource =
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
500
|
+
| string
|
|
501
|
+
| Uint8Array
|
|
502
|
+
| ArrayBuffer
|
|
503
|
+
| BlobLike
|
|
504
|
+
| FileLike
|
|
505
|
+
| ReadableStreamLike<Uint8Array | ArrayBuffer | ArrayBufferView | string>
|
|
506
|
+
| AsyncIterable<Uint8Array | ArrayBuffer | ArrayBufferView | string>
|
|
507
|
+
| Iterable<Uint8Array | ArrayBuffer | ArrayBufferView | string>;
|
|
493
508
|
|
|
494
509
|
export interface CommitFileOptions {
|
|
495
|
-
|
|
510
|
+
mode?: GitFileMode;
|
|
496
511
|
}
|
|
497
512
|
|
|
498
513
|
export interface CommitTextFileOptions extends CommitFileOptions {
|
|
499
|
-
|
|
514
|
+
encoding?: TextEncoding;
|
|
500
515
|
}
|
|
501
516
|
|
|
502
517
|
export interface CommitBuilder {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
518
|
+
addFile(
|
|
519
|
+
path: string,
|
|
520
|
+
source: CommitFileSource,
|
|
521
|
+
options?: CommitFileOptions
|
|
522
|
+
): CommitBuilder;
|
|
523
|
+
addFileFromString(
|
|
524
|
+
path: string,
|
|
525
|
+
contents: string,
|
|
526
|
+
options?: CommitTextFileOptions
|
|
527
|
+
): CommitBuilder;
|
|
528
|
+
deletePath(path: string): CommitBuilder;
|
|
529
|
+
send(): Promise<CommitResult>;
|
|
507
530
|
}
|
|
508
531
|
|
|
509
532
|
export type DiffSource = CommitFileSource;
|
|
510
533
|
|
|
511
|
-
export interface CreateCommitFromDiffOptions
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
534
|
+
export interface CreateCommitFromDiffOptions
|
|
535
|
+
extends GitStorageInvocationOptions {
|
|
536
|
+
targetBranch: string;
|
|
537
|
+
commitMessage: string;
|
|
538
|
+
diff: DiffSource;
|
|
539
|
+
expectedHeadSha?: string;
|
|
540
|
+
baseBranch?: string;
|
|
541
|
+
ephemeral?: boolean;
|
|
542
|
+
ephemeralBase?: boolean;
|
|
543
|
+
author: CommitSignature;
|
|
544
|
+
committer?: CommitSignature;
|
|
545
|
+
signal?: AbortSignal;
|
|
522
546
|
}
|
|
523
547
|
|
|
524
548
|
export interface RefUpdate {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
549
|
+
branch: string;
|
|
550
|
+
oldSha: string;
|
|
551
|
+
newSha: string;
|
|
528
552
|
}
|
|
529
553
|
|
|
530
554
|
export type RefUpdateReason =
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
555
|
+
| 'precondition_failed'
|
|
556
|
+
| 'conflict'
|
|
557
|
+
| 'not_found'
|
|
558
|
+
| 'invalid'
|
|
559
|
+
| 'timeout'
|
|
560
|
+
| 'unauthorized'
|
|
561
|
+
| 'forbidden'
|
|
562
|
+
| 'unavailable'
|
|
563
|
+
| 'internal'
|
|
564
|
+
| 'failed'
|
|
565
|
+
| 'unknown';
|
|
542
566
|
|
|
543
567
|
export interface CommitResult {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
568
|
+
commitSha: string;
|
|
569
|
+
treeSha: string;
|
|
570
|
+
targetBranch: string;
|
|
571
|
+
packBytes: number;
|
|
572
|
+
blobCount: number;
|
|
573
|
+
refUpdate: RefUpdate;
|
|
550
574
|
}
|
|
551
575
|
|
|
552
576
|
export interface RestoreCommitOptions extends GitStorageInvocationOptions {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
577
|
+
targetBranch: string;
|
|
578
|
+
targetCommitSha: string;
|
|
579
|
+
commitMessage?: string;
|
|
580
|
+
expectedHeadSha?: string;
|
|
581
|
+
author: CommitSignature;
|
|
582
|
+
committer?: CommitSignature;
|
|
559
583
|
}
|
|
560
584
|
|
|
561
585
|
export interface RestoreCommitResult {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
586
|
+
commitSha: string;
|
|
587
|
+
treeSha: string;
|
|
588
|
+
targetBranch: string;
|
|
589
|
+
packBytes: number;
|
|
590
|
+
refUpdate: RefUpdate;
|
|
567
591
|
}
|
|
568
592
|
|
|
569
593
|
// Webhook types
|
|
570
594
|
export interface WebhookValidationOptions {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Maximum age of webhook in seconds (default: 300 seconds / 5 minutes)
|
|
597
|
+
* Set to 0 to disable timestamp validation
|
|
598
|
+
*/
|
|
599
|
+
maxAgeSeconds?: number;
|
|
576
600
|
}
|
|
577
601
|
|
|
578
602
|
export interface WebhookValidationResult {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
603
|
+
/**
|
|
604
|
+
* Whether the webhook signature and timestamp are valid
|
|
605
|
+
*/
|
|
606
|
+
valid: boolean;
|
|
607
|
+
/**
|
|
608
|
+
* Error message if validation failed
|
|
609
|
+
*/
|
|
610
|
+
error?: string;
|
|
611
|
+
/**
|
|
612
|
+
* The parsed webhook event type (e.g., "push")
|
|
613
|
+
*/
|
|
614
|
+
eventType?: string;
|
|
615
|
+
/**
|
|
616
|
+
* The timestamp from the signature (Unix seconds)
|
|
617
|
+
*/
|
|
618
|
+
timestamp?: number;
|
|
595
619
|
}
|
|
596
620
|
|
|
597
621
|
// Webhook event payloads
|
|
598
622
|
export interface RawWebhookPushEvent {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
623
|
+
repository: {
|
|
624
|
+
id: string;
|
|
625
|
+
url: string;
|
|
626
|
+
};
|
|
627
|
+
ref: string;
|
|
628
|
+
before: string;
|
|
629
|
+
after: string;
|
|
630
|
+
customer_id: string;
|
|
631
|
+
pushed_at: string; // RFC3339 timestamp
|
|
608
632
|
}
|
|
609
633
|
|
|
610
634
|
export interface WebhookPushEvent {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
635
|
+
type: 'push';
|
|
636
|
+
repository: {
|
|
637
|
+
id: string;
|
|
638
|
+
url: string;
|
|
639
|
+
};
|
|
640
|
+
ref: string;
|
|
641
|
+
before: string;
|
|
642
|
+
after: string;
|
|
643
|
+
customerId: string;
|
|
644
|
+
pushedAt: Date;
|
|
645
|
+
rawPushedAt: string;
|
|
622
646
|
}
|
|
623
647
|
|
|
624
648
|
export interface WebhookUnknownEvent {
|
|
625
|
-
|
|
626
|
-
|
|
649
|
+
type: string;
|
|
650
|
+
raw: unknown;
|
|
627
651
|
}
|
|
628
652
|
|
|
629
653
|
export type WebhookEventPayload = WebhookPushEvent | WebhookUnknownEvent;
|
|
630
654
|
|
|
631
655
|
export interface ParsedWebhookSignature {
|
|
632
|
-
|
|
633
|
-
|
|
656
|
+
timestamp: string;
|
|
657
|
+
signature: string;
|
|
634
658
|
}
|