@pierre/storage 0.0.11 → 0.1.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/dist/index.d.cts CHANGED
@@ -1,10 +1,422 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const listFilesResponseSchema: z.ZodObject<{
4
+ paths: z.ZodArray<z.ZodString, "many">;
5
+ ref: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ ref: string;
8
+ paths: string[];
9
+ }, {
10
+ ref: string;
11
+ paths: string[];
12
+ }>;
13
+ declare const branchInfoSchema: z.ZodObject<{
14
+ cursor: z.ZodString;
15
+ name: z.ZodString;
16
+ head_sha: z.ZodString;
17
+ created_at: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ cursor: string;
20
+ name: string;
21
+ head_sha: string;
22
+ created_at: string;
23
+ }, {
24
+ cursor: string;
25
+ name: string;
26
+ head_sha: string;
27
+ created_at: string;
28
+ }>;
29
+ declare const listBranchesResponseSchema: z.ZodObject<{
30
+ branches: z.ZodArray<z.ZodObject<{
31
+ cursor: z.ZodString;
32
+ name: z.ZodString;
33
+ head_sha: z.ZodString;
34
+ created_at: z.ZodString;
35
+ }, "strip", z.ZodTypeAny, {
36
+ cursor: string;
37
+ name: string;
38
+ head_sha: string;
39
+ created_at: string;
40
+ }, {
41
+ cursor: string;
42
+ name: string;
43
+ head_sha: string;
44
+ created_at: string;
45
+ }>, "many">;
46
+ next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ has_more: z.ZodBoolean;
48
+ }, "strip", z.ZodTypeAny, {
49
+ branches: {
50
+ cursor: string;
51
+ name: string;
52
+ head_sha: string;
53
+ created_at: string;
54
+ }[];
55
+ has_more: boolean;
56
+ next_cursor?: string | null | undefined;
57
+ }, {
58
+ branches: {
59
+ cursor: string;
60
+ name: string;
61
+ head_sha: string;
62
+ created_at: string;
63
+ }[];
64
+ has_more: boolean;
65
+ next_cursor?: string | null | undefined;
66
+ }>;
67
+ declare const commitInfoRawSchema: z.ZodObject<{
68
+ sha: z.ZodString;
69
+ message: z.ZodString;
70
+ author_name: z.ZodString;
71
+ author_email: z.ZodString;
72
+ committer_name: z.ZodString;
73
+ committer_email: z.ZodString;
74
+ date: z.ZodString;
75
+ }, "strip", z.ZodTypeAny, {
76
+ message: string;
77
+ date: string;
78
+ sha: string;
79
+ author_name: string;
80
+ author_email: string;
81
+ committer_name: string;
82
+ committer_email: string;
83
+ }, {
84
+ message: string;
85
+ date: string;
86
+ sha: string;
87
+ author_name: string;
88
+ author_email: string;
89
+ committer_name: string;
90
+ committer_email: string;
91
+ }>;
92
+ declare const listCommitsResponseSchema: z.ZodObject<{
93
+ commits: z.ZodArray<z.ZodObject<{
94
+ sha: z.ZodString;
95
+ message: z.ZodString;
96
+ author_name: z.ZodString;
97
+ author_email: z.ZodString;
98
+ committer_name: z.ZodString;
99
+ committer_email: z.ZodString;
100
+ date: z.ZodString;
101
+ }, "strip", z.ZodTypeAny, {
102
+ message: string;
103
+ date: string;
104
+ sha: string;
105
+ author_name: string;
106
+ author_email: string;
107
+ committer_name: string;
108
+ committer_email: string;
109
+ }, {
110
+ message: string;
111
+ date: string;
112
+ sha: string;
113
+ author_name: string;
114
+ author_email: string;
115
+ committer_name: string;
116
+ committer_email: string;
117
+ }>, "many">;
118
+ next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
+ has_more: z.ZodBoolean;
120
+ }, "strip", z.ZodTypeAny, {
121
+ has_more: boolean;
122
+ commits: {
123
+ message: string;
124
+ date: string;
125
+ sha: string;
126
+ author_name: string;
127
+ author_email: string;
128
+ committer_name: string;
129
+ committer_email: string;
130
+ }[];
131
+ next_cursor?: string | null | undefined;
132
+ }, {
133
+ has_more: boolean;
134
+ commits: {
135
+ message: string;
136
+ date: string;
137
+ sha: string;
138
+ author_name: string;
139
+ author_email: string;
140
+ committer_name: string;
141
+ committer_email: string;
142
+ }[];
143
+ next_cursor?: string | null | undefined;
144
+ }>;
145
+ declare const diffFileRawSchema: z.ZodObject<{
146
+ path: z.ZodString;
147
+ state: z.ZodString;
148
+ old_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
+ raw: z.ZodString;
150
+ bytes: z.ZodNumber;
151
+ is_eof: z.ZodBoolean;
152
+ }, "strip", z.ZodTypeAny, {
153
+ path: string;
154
+ state: string;
155
+ raw: string;
156
+ bytes: number;
157
+ is_eof: boolean;
158
+ old_path?: string | null | undefined;
159
+ }, {
160
+ path: string;
161
+ state: string;
162
+ raw: string;
163
+ bytes: number;
164
+ is_eof: boolean;
165
+ old_path?: string | null | undefined;
166
+ }>;
167
+ declare const filteredFileRawSchema: z.ZodObject<{
168
+ path: z.ZodString;
169
+ state: z.ZodString;
170
+ old_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ bytes: z.ZodNumber;
172
+ is_eof: z.ZodBoolean;
173
+ }, "strip", z.ZodTypeAny, {
174
+ path: string;
175
+ state: string;
176
+ bytes: number;
177
+ is_eof: boolean;
178
+ old_path?: string | null | undefined;
179
+ }, {
180
+ path: string;
181
+ state: string;
182
+ bytes: number;
183
+ is_eof: boolean;
184
+ old_path?: string | null | undefined;
185
+ }>;
186
+ declare const branchDiffResponseSchema: z.ZodObject<{
187
+ branch: z.ZodString;
188
+ base: z.ZodString;
189
+ stats: z.ZodObject<{
190
+ files: z.ZodNumber;
191
+ additions: z.ZodNumber;
192
+ deletions: z.ZodNumber;
193
+ changes: z.ZodNumber;
194
+ }, "strip", z.ZodTypeAny, {
195
+ files: number;
196
+ additions: number;
197
+ deletions: number;
198
+ changes: number;
199
+ }, {
200
+ files: number;
201
+ additions: number;
202
+ deletions: number;
203
+ changes: number;
204
+ }>;
205
+ files: z.ZodArray<z.ZodObject<{
206
+ path: z.ZodString;
207
+ state: z.ZodString;
208
+ old_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
209
+ raw: z.ZodString;
210
+ bytes: z.ZodNumber;
211
+ is_eof: z.ZodBoolean;
212
+ }, "strip", z.ZodTypeAny, {
213
+ path: string;
214
+ state: string;
215
+ raw: string;
216
+ bytes: number;
217
+ is_eof: boolean;
218
+ old_path?: string | null | undefined;
219
+ }, {
220
+ path: string;
221
+ state: string;
222
+ raw: string;
223
+ bytes: number;
224
+ is_eof: boolean;
225
+ old_path?: string | null | undefined;
226
+ }>, "many">;
227
+ filtered_files: z.ZodArray<z.ZodObject<{
228
+ path: z.ZodString;
229
+ state: z.ZodString;
230
+ old_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
+ bytes: z.ZodNumber;
232
+ is_eof: z.ZodBoolean;
233
+ }, "strip", z.ZodTypeAny, {
234
+ path: string;
235
+ state: string;
236
+ bytes: number;
237
+ is_eof: boolean;
238
+ old_path?: string | null | undefined;
239
+ }, {
240
+ path: string;
241
+ state: string;
242
+ bytes: number;
243
+ is_eof: boolean;
244
+ old_path?: string | null | undefined;
245
+ }>, "many">;
246
+ }, "strip", z.ZodTypeAny, {
247
+ branch: string;
248
+ base: string;
249
+ files: {
250
+ path: string;
251
+ state: string;
252
+ raw: string;
253
+ bytes: number;
254
+ is_eof: boolean;
255
+ old_path?: string | null | undefined;
256
+ }[];
257
+ stats: {
258
+ files: number;
259
+ additions: number;
260
+ deletions: number;
261
+ changes: number;
262
+ };
263
+ filtered_files: {
264
+ path: string;
265
+ state: string;
266
+ bytes: number;
267
+ is_eof: boolean;
268
+ old_path?: string | null | undefined;
269
+ }[];
270
+ }, {
271
+ branch: string;
272
+ base: string;
273
+ files: {
274
+ path: string;
275
+ state: string;
276
+ raw: string;
277
+ bytes: number;
278
+ is_eof: boolean;
279
+ old_path?: string | null | undefined;
280
+ }[];
281
+ stats: {
282
+ files: number;
283
+ additions: number;
284
+ deletions: number;
285
+ changes: number;
286
+ };
287
+ filtered_files: {
288
+ path: string;
289
+ state: string;
290
+ bytes: number;
291
+ is_eof: boolean;
292
+ old_path?: string | null | undefined;
293
+ }[];
294
+ }>;
295
+ declare const commitDiffResponseSchema: z.ZodObject<{
296
+ sha: z.ZodString;
297
+ stats: z.ZodObject<{
298
+ files: z.ZodNumber;
299
+ additions: z.ZodNumber;
300
+ deletions: z.ZodNumber;
301
+ changes: z.ZodNumber;
302
+ }, "strip", z.ZodTypeAny, {
303
+ files: number;
304
+ additions: number;
305
+ deletions: number;
306
+ changes: number;
307
+ }, {
308
+ files: number;
309
+ additions: number;
310
+ deletions: number;
311
+ changes: number;
312
+ }>;
313
+ files: z.ZodArray<z.ZodObject<{
314
+ path: z.ZodString;
315
+ state: z.ZodString;
316
+ old_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
317
+ raw: z.ZodString;
318
+ bytes: z.ZodNumber;
319
+ is_eof: z.ZodBoolean;
320
+ }, "strip", z.ZodTypeAny, {
321
+ path: string;
322
+ state: string;
323
+ raw: string;
324
+ bytes: number;
325
+ is_eof: boolean;
326
+ old_path?: string | null | undefined;
327
+ }, {
328
+ path: string;
329
+ state: string;
330
+ raw: string;
331
+ bytes: number;
332
+ is_eof: boolean;
333
+ old_path?: string | null | undefined;
334
+ }>, "many">;
335
+ filtered_files: z.ZodArray<z.ZodObject<{
336
+ path: z.ZodString;
337
+ state: z.ZodString;
338
+ old_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
339
+ bytes: z.ZodNumber;
340
+ is_eof: z.ZodBoolean;
341
+ }, "strip", z.ZodTypeAny, {
342
+ path: string;
343
+ state: string;
344
+ bytes: number;
345
+ is_eof: boolean;
346
+ old_path?: string | null | undefined;
347
+ }, {
348
+ path: string;
349
+ state: string;
350
+ bytes: number;
351
+ is_eof: boolean;
352
+ old_path?: string | null | undefined;
353
+ }>, "many">;
354
+ }, "strip", z.ZodTypeAny, {
355
+ sha: string;
356
+ files: {
357
+ path: string;
358
+ state: string;
359
+ raw: string;
360
+ bytes: number;
361
+ is_eof: boolean;
362
+ old_path?: string | null | undefined;
363
+ }[];
364
+ stats: {
365
+ files: number;
366
+ additions: number;
367
+ deletions: number;
368
+ changes: number;
369
+ };
370
+ filtered_files: {
371
+ path: string;
372
+ state: string;
373
+ bytes: number;
374
+ is_eof: boolean;
375
+ old_path?: string | null | undefined;
376
+ }[];
377
+ }, {
378
+ sha: string;
379
+ files: {
380
+ path: string;
381
+ state: string;
382
+ raw: string;
383
+ bytes: number;
384
+ is_eof: boolean;
385
+ old_path?: string | null | undefined;
386
+ }[];
387
+ stats: {
388
+ files: number;
389
+ additions: number;
390
+ deletions: number;
391
+ changes: number;
392
+ };
393
+ filtered_files: {
394
+ path: string;
395
+ state: string;
396
+ bytes: number;
397
+ is_eof: boolean;
398
+ old_path?: string | null | undefined;
399
+ }[];
400
+ }>;
401
+ type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
402
+ type RawBranchInfo$1 = z.infer<typeof branchInfoSchema>;
403
+ type ListBranchesResponseRaw = z.infer<typeof listBranchesResponseSchema>;
404
+ type RawCommitInfo$1 = z.infer<typeof commitInfoRawSchema>;
405
+ type ListCommitsResponseRaw = z.infer<typeof listCommitsResponseSchema>;
406
+ type RawFileDiff$1 = z.infer<typeof diffFileRawSchema>;
407
+ type RawFilteredFile$1 = z.infer<typeof filteredFileRawSchema>;
408
+ type GetBranchDiffResponseRaw = z.infer<typeof branchDiffResponseSchema>;
409
+ type GetCommitDiffResponseRaw = z.infer<typeof commitDiffResponseSchema>;
410
+
1
411
  /**
2
412
  * Type definitions for Pierre Git Storage SDK
3
413
  */
414
+
4
415
  interface OverrideableGitStorageOptions {
5
416
  apiBaseUrl?: string;
6
417
  storageBaseUrl?: string;
7
418
  apiVersion?: ValidAPIVersion;
419
+ defaultTTL?: number;
8
420
  }
9
421
  interface GitStorageOptions extends OverrideableGitStorageOptions {
10
422
  key: string;
@@ -20,13 +432,13 @@ interface Repo {
20
432
  id: string;
21
433
  getRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
22
434
  getFileStream(options: GetFileOptions): Promise<Response>;
23
- listFiles(options?: ListFilesOptions): Promise<ListFilesResponse>;
24
- listBranches(options?: ListBranchesOptions): Promise<ListBranchesResponse>;
25
- listCommits(options?: ListCommitsOptions): Promise<ListCommitsResponse>;
26
- getBranchDiff(options: GetBranchDiffOptions): Promise<GetBranchDiffResponse>;
27
- getCommitDiff(options: GetCommitDiffOptions): Promise<GetCommitDiffResponse>;
28
- getCommit(options: GetCommitOptions): Promise<GetCommitResponse>;
435
+ listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
436
+ listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
437
+ listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
438
+ getBranchDiff(options: GetBranchDiffOptions): Promise<GetBranchDiffResult>;
439
+ getCommitDiff(options: GetCommitDiffOptions): Promise<GetCommitDiffResult>;
29
440
  pullUpstream(options: PullUpstreamOptions): Promise<void>;
441
+ resetCommit(options: ResetCommitOptions): Promise<ResetCommitResult>;
30
442
  createCommit(options: CreateCommitOptions): CommitBuilder;
31
443
  }
32
444
  type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
@@ -58,10 +470,6 @@ interface CreateRepoOptions extends GitStorageInvocationOptions {
58
470
  baseRepo?: BaseRepo;
59
471
  defaultBranch?: string;
60
472
  }
61
- interface CreateRepoResponse {
62
- repo_id: string;
63
- url: string;
64
- }
65
473
  interface GetFileOptions extends GitStorageInvocationOptions {
66
474
  path: string;
67
475
  ref?: string;
@@ -72,7 +480,8 @@ interface PullUpstreamOptions extends GitStorageInvocationOptions {
72
480
  interface ListFilesOptions extends GitStorageInvocationOptions {
73
481
  ref?: string;
74
482
  }
75
- interface ListFilesResponse {
483
+ type ListFilesResponse = ListFilesResponseRaw;
484
+ interface ListFilesResult {
76
485
  paths: string[];
77
486
  ref: string;
78
487
  }
@@ -80,55 +489,62 @@ interface ListBranchesOptions extends GitStorageInvocationOptions {
80
489
  cursor?: string;
81
490
  limit?: number;
82
491
  }
492
+ type RawBranchInfo = RawBranchInfo$1;
83
493
  interface BranchInfo {
84
494
  cursor: string;
85
495
  name: string;
86
- head_sha: string;
87
- created_at: string;
496
+ headSha: string;
497
+ createdAt: string;
88
498
  }
89
- interface ListBranchesResponse {
499
+ type ListBranchesResponse = ListBranchesResponseRaw;
500
+ interface ListBranchesResult {
90
501
  branches: BranchInfo[];
91
- next_cursor?: string;
92
- has_more: boolean;
502
+ nextCursor?: string;
503
+ hasMore: boolean;
93
504
  }
94
505
  interface ListCommitsOptions extends GitStorageInvocationOptions {
95
506
  branch?: string;
96
507
  cursor?: string;
97
508
  limit?: number;
98
509
  }
510
+ type RawCommitInfo = RawCommitInfo$1;
99
511
  interface CommitInfo {
100
512
  sha: string;
101
513
  message: string;
102
- author_name: string;
103
- author_email: string;
104
- committer_name: string;
105
- committer_email: string;
106
- date: string;
107
- }
108
- interface ListCommitsResponse {
514
+ authorName: string;
515
+ authorEmail: string;
516
+ committerName: string;
517
+ committerEmail: string;
518
+ date: Date;
519
+ rawDate: string;
520
+ }
521
+ type ListCommitsResponse = ListCommitsResponseRaw;
522
+ interface ListCommitsResult {
109
523
  commits: CommitInfo[];
110
- next_cursor?: string;
111
- has_more: boolean;
524
+ nextCursor?: string;
525
+ hasMore: boolean;
112
526
  }
113
527
  interface GetBranchDiffOptions extends GitStorageInvocationOptions {
114
528
  branch: string;
115
529
  base?: string;
116
530
  }
117
- interface GetBranchDiffResponse {
531
+ type GetBranchDiffResponse = GetBranchDiffResponseRaw;
532
+ interface GetBranchDiffResult {
118
533
  branch: string;
119
534
  base: string;
120
535
  stats: DiffStats;
121
536
  files: FileDiff[];
122
- filtered_files: FilteredFile[];
537
+ filteredFiles: FilteredFile[];
123
538
  }
124
539
  interface GetCommitDiffOptions extends GitStorageInvocationOptions {
125
540
  sha: string;
126
541
  }
127
- interface GetCommitDiffResponse {
542
+ type GetCommitDiffResponse = GetCommitDiffResponseRaw;
543
+ interface GetCommitDiffResult {
128
544
  sha: string;
129
545
  stats: DiffStats;
130
546
  files: FileDiff[];
131
- filtered_files: FilteredFile[];
547
+ filteredFiles: FilteredFile[];
132
548
  }
133
549
  interface DiffStats {
134
550
  files: number;
@@ -136,84 +552,94 @@ interface DiffStats {
136
552
  deletions: number;
137
553
  changes: number;
138
554
  }
139
- interface FileDiff {
555
+ type RawFileDiff = RawFileDiff$1;
556
+ type RawFilteredFile = RawFilteredFile$1;
557
+ type DiffFileState = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied' | 'type_changed' | 'unmerged' | 'unknown';
558
+ interface DiffFileBase {
140
559
  path: string;
141
- state: string;
142
- old_path?: string;
560
+ state: DiffFileState;
561
+ rawState: string;
562
+ oldPath?: string;
143
563
  bytes: number;
144
- is_eof: boolean;
145
- diff: string;
564
+ isEof: boolean;
146
565
  }
147
- interface FilteredFile {
148
- path: string;
149
- state: string;
150
- old_path?: string;
151
- bytes: number;
152
- is_eof: boolean;
566
+ interface FileDiff extends DiffFileBase {
567
+ raw: string;
153
568
  }
154
- interface GetCommitOptions extends GitStorageInvocationOptions {
155
- sha: string;
156
- }
157
- interface GetCommitResponse {
158
- sha: string;
159
- message: string;
160
- author: {
161
- name: string;
162
- email: string;
163
- };
164
- committer: {
165
- name: string;
166
- email: string;
167
- };
168
- date: string;
169
- stats: {
170
- additions: number;
171
- deletions: number;
172
- total: number;
173
- };
569
+ interface FilteredFile extends DiffFileBase {
174
570
  }
175
571
  interface CreateCommitOptions extends GitStorageInvocationOptions {
176
- targetRef: string;
572
+ targetBranch: string;
177
573
  commitMessage: string;
178
- baseRef?: string;
179
- author?: CommitSignature;
574
+ expectedHeadSha?: string;
575
+ author: CommitSignature;
180
576
  committer?: CommitSignature;
181
577
  signal?: AbortSignal;
182
578
  }
183
579
  interface CommitSignature {
184
580
  name: string;
185
581
  email: string;
186
- date?: string;
187
582
  }
188
- type CommitFileSource = string | Uint8Array | ArrayBuffer | AsyncIterable<Uint8Array | ArrayBuffer> | Iterable<Uint8Array | ArrayBuffer>;
583
+ interface ReadableStreamReaderLike<T> {
584
+ read(): Promise<{
585
+ value?: T;
586
+ done: boolean;
587
+ }>;
588
+ releaseLock?(): void;
589
+ }
590
+ interface ReadableStreamLike<T> {
591
+ getReader(): ReadableStreamReaderLike<T>;
592
+ }
593
+ interface BlobLike {
594
+ stream(): unknown;
595
+ }
596
+ interface FileLike extends BlobLike {
597
+ name: string;
598
+ lastModified?: number;
599
+ }
600
+ type GitFileMode = '100644' | '100755' | '120000' | '160000';
601
+ type TextEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'utf-16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
602
+ type CommitFileSource = string | Uint8Array | ArrayBuffer | BlobLike | FileLike | ReadableStreamLike<Uint8Array | ArrayBuffer | ArrayBufferView | string> | AsyncIterable<Uint8Array | ArrayBuffer | ArrayBufferView | string> | Iterable<Uint8Array | ArrayBuffer | ArrayBufferView | string>;
189
603
  interface CommitFileOptions {
190
- mode?: string;
604
+ mode?: GitFileMode;
191
605
  }
192
606
  interface CommitTextFileOptions extends CommitFileOptions {
193
- encoding?: 'utf8' | 'utf-8';
607
+ encoding?: TextEncoding;
194
608
  }
195
609
  interface CommitBuilder {
196
610
  addFile(path: string, source: CommitFileSource, options?: CommitFileOptions): CommitBuilder;
197
611
  addFileFromString(path: string, contents: string, options?: CommitTextFileOptions): CommitBuilder;
198
612
  deletePath(path: string): CommitBuilder;
199
- send(): Promise<CommitResponse>;
200
- }
201
- interface CommitResponse {
202
- commit: {
203
- commit_sha: string;
204
- tree_sha: string;
205
- target_ref: string;
206
- pack_bytes: number;
207
- blob_count: number;
208
- };
209
- result: {
210
- ref: string;
211
- old_sha: string;
212
- new_sha: string;
213
- success: boolean;
214
- status: string;
215
- message?: string;
216
- };
613
+ send(): Promise<CommitResult>;
614
+ }
615
+ interface RefUpdate {
616
+ branch: string;
617
+ oldSha: string;
618
+ newSha: string;
619
+ }
620
+ type RefUpdateReason = 'precondition_failed' | 'conflict' | 'not_found' | 'invalid' | 'timeout' | 'unauthorized' | 'forbidden' | 'unavailable' | 'internal' | 'failed' | 'unknown';
621
+ interface CommitResult {
622
+ commitSha: string;
623
+ treeSha: string;
624
+ targetBranch: string;
625
+ packBytes: number;
626
+ blobCount: number;
627
+ refUpdate: RefUpdate;
628
+ }
629
+ interface ResetCommitOptions extends GitStorageInvocationOptions {
630
+ targetBranch: string;
631
+ targetCommitSha: string;
632
+ commitMessage?: string;
633
+ expectedHeadSha?: string;
634
+ author: CommitSignature;
635
+ committer?: CommitSignature;
636
+ }
637
+ interface ResetCommitResult {
638
+ commitSha: string;
639
+ treeSha: string;
640
+ targetBranch: string;
641
+ packBytes: number;
642
+ refUpdate: RefUpdate;
217
643
  }
218
644
  interface WebhookValidationOptions {
219
645
  /**
@@ -240,7 +666,7 @@ interface WebhookValidationResult {
240
666
  */
241
667
  timestamp?: number;
242
668
  }
243
- interface WebhookPushEvent {
669
+ interface RawWebhookPushEvent {
244
670
  repository: {
245
671
  id: string;
246
672
  url: string;
@@ -251,12 +677,58 @@ interface WebhookPushEvent {
251
677
  customer_id: string;
252
678
  pushed_at: string;
253
679
  }
254
- type WebhookEventPayload = WebhookPushEvent;
680
+ interface WebhookPushEvent {
681
+ type: 'push';
682
+ repository: {
683
+ id: string;
684
+ url: string;
685
+ };
686
+ ref: string;
687
+ before: string;
688
+ after: string;
689
+ customerId: string;
690
+ pushedAt: Date;
691
+ rawPushedAt: string;
692
+ }
693
+ interface WebhookUnknownEvent {
694
+ type: string;
695
+ raw: unknown;
696
+ }
697
+ type WebhookEventPayload = WebhookPushEvent | WebhookUnknownEvent;
255
698
  interface ParsedWebhookSignature {
256
699
  timestamp: string;
257
700
  signature: string;
258
701
  }
259
702
 
703
+ interface RefUpdateErrorOptions {
704
+ status: string;
705
+ message?: string;
706
+ refUpdate?: Partial<RefUpdate>;
707
+ reason?: RefUpdateReason;
708
+ }
709
+ declare class RefUpdateError extends Error {
710
+ readonly status: string;
711
+ readonly reason: RefUpdateReason;
712
+ readonly refUpdate?: Partial<RefUpdate>;
713
+ constructor(message: string, options: RefUpdateErrorOptions);
714
+ }
715
+
716
+ declare class ApiError extends Error {
717
+ readonly status: number;
718
+ readonly statusText: string;
719
+ readonly method: ValidMethod;
720
+ readonly url: string;
721
+ readonly body?: unknown;
722
+ constructor(params: {
723
+ message: string;
724
+ status: number;
725
+ statusText: string;
726
+ method: ValidMethod;
727
+ url: string;
728
+ body?: unknown;
729
+ });
730
+ }
731
+
260
732
  /**
261
733
  * Webhook validation utilities for Pierre Git Storage
262
734
  */
@@ -358,4 +830,4 @@ declare class GitStorage {
358
830
  declare function createClient(options: GitStorageOptions): GitStorage;
359
831
  type StorageOptions = GitStorageOptions;
360
832
 
361
- export { type BaseRepo, type BranchInfo, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResponse, type CommitSignature, type CommitTextFileOptions, type CreateCommitOptions, type CreateRepoOptions, type CreateRepoResponse, type DiffStats, type FileDiff, type FilteredFile, type FindOneOptions, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitOptions, type GetCommitResponse, type GetFileOptions, type GetRemoteURLOptions, GitStorage, type GitStorageOptions, type ListBranchesOptions, type ListBranchesResponse, type ListCommitsOptions, type ListCommitsResponse, type ListFilesOptions, type ListFilesResponse, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PullUpstreamOptions, type Repo, type StorageOptions, type SupportedRepoProvider, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
833
+ export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateCommitOptions, type CreateRepoOptions, type DiffFileBase, type DiffFileState, type DiffStats, type FileDiff, type FileLike, type FilteredFile, type FindOneOptions, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetRemoteURLOptions, type GitFileMode, GitStorage, type GitStorageOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawFileDiff, type RawFilteredFile, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type ResetCommitOptions, type ResetCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };