@pierre/storage 0.0.10 → 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/README.md +209 -46
- package/dist/index.cjs +1079 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +578 -62
- package/dist/index.d.ts +578 -62
- package/dist/index.js +1078 -51
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/commit.ts +649 -0
- package/src/errors.ts +50 -0
- package/src/fetch.ts +75 -5
- package/src/index.ts +408 -44
- package/src/schemas.ts +138 -0
- package/src/types.ts +211 -62
- package/src/util.ts +0 -18
- package/src/webhook.ts +75 -3
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,14 @@ 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<
|
|
24
|
-
listBranches(options?: ListBranchesOptions): Promise<
|
|
25
|
-
listCommits(options?: ListCommitsOptions): Promise<
|
|
26
|
-
getBranchDiff(options: GetBranchDiffOptions): Promise<
|
|
27
|
-
getCommitDiff(options: GetCommitDiffOptions): Promise<
|
|
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>;
|
|
442
|
+
createCommit(options: CreateCommitOptions): CommitBuilder;
|
|
30
443
|
}
|
|
31
444
|
type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
32
445
|
type SimplePath = string;
|
|
@@ -57,10 +470,6 @@ interface CreateRepoOptions extends GitStorageInvocationOptions {
|
|
|
57
470
|
baseRepo?: BaseRepo;
|
|
58
471
|
defaultBranch?: string;
|
|
59
472
|
}
|
|
60
|
-
interface CreateRepoResponse {
|
|
61
|
-
repo_id: string;
|
|
62
|
-
url: string;
|
|
63
|
-
}
|
|
64
473
|
interface GetFileOptions extends GitStorageInvocationOptions {
|
|
65
474
|
path: string;
|
|
66
475
|
ref?: string;
|
|
@@ -71,7 +480,8 @@ interface PullUpstreamOptions extends GitStorageInvocationOptions {
|
|
|
71
480
|
interface ListFilesOptions extends GitStorageInvocationOptions {
|
|
72
481
|
ref?: string;
|
|
73
482
|
}
|
|
74
|
-
|
|
483
|
+
type ListFilesResponse = ListFilesResponseRaw;
|
|
484
|
+
interface ListFilesResult {
|
|
75
485
|
paths: string[];
|
|
76
486
|
ref: string;
|
|
77
487
|
}
|
|
@@ -79,55 +489,62 @@ interface ListBranchesOptions extends GitStorageInvocationOptions {
|
|
|
79
489
|
cursor?: string;
|
|
80
490
|
limit?: number;
|
|
81
491
|
}
|
|
492
|
+
type RawBranchInfo = RawBranchInfo$1;
|
|
82
493
|
interface BranchInfo {
|
|
83
494
|
cursor: string;
|
|
84
495
|
name: string;
|
|
85
|
-
|
|
86
|
-
|
|
496
|
+
headSha: string;
|
|
497
|
+
createdAt: string;
|
|
87
498
|
}
|
|
88
|
-
|
|
499
|
+
type ListBranchesResponse = ListBranchesResponseRaw;
|
|
500
|
+
interface ListBranchesResult {
|
|
89
501
|
branches: BranchInfo[];
|
|
90
|
-
|
|
91
|
-
|
|
502
|
+
nextCursor?: string;
|
|
503
|
+
hasMore: boolean;
|
|
92
504
|
}
|
|
93
505
|
interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
94
506
|
branch?: string;
|
|
95
507
|
cursor?: string;
|
|
96
508
|
limit?: number;
|
|
97
509
|
}
|
|
510
|
+
type RawCommitInfo = RawCommitInfo$1;
|
|
98
511
|
interface CommitInfo {
|
|
99
512
|
sha: string;
|
|
100
513
|
message: string;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
date:
|
|
106
|
-
|
|
107
|
-
|
|
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 {
|
|
108
523
|
commits: CommitInfo[];
|
|
109
|
-
|
|
110
|
-
|
|
524
|
+
nextCursor?: string;
|
|
525
|
+
hasMore: boolean;
|
|
111
526
|
}
|
|
112
527
|
interface GetBranchDiffOptions extends GitStorageInvocationOptions {
|
|
113
528
|
branch: string;
|
|
114
529
|
base?: string;
|
|
115
530
|
}
|
|
116
|
-
|
|
531
|
+
type GetBranchDiffResponse = GetBranchDiffResponseRaw;
|
|
532
|
+
interface GetBranchDiffResult {
|
|
117
533
|
branch: string;
|
|
118
534
|
base: string;
|
|
119
535
|
stats: DiffStats;
|
|
120
536
|
files: FileDiff[];
|
|
121
|
-
|
|
537
|
+
filteredFiles: FilteredFile[];
|
|
122
538
|
}
|
|
123
539
|
interface GetCommitDiffOptions extends GitStorageInvocationOptions {
|
|
124
540
|
sha: string;
|
|
125
541
|
}
|
|
126
|
-
|
|
542
|
+
type GetCommitDiffResponse = GetCommitDiffResponseRaw;
|
|
543
|
+
interface GetCommitDiffResult {
|
|
127
544
|
sha: string;
|
|
128
545
|
stats: DiffStats;
|
|
129
546
|
files: FileDiff[];
|
|
130
|
-
|
|
547
|
+
filteredFiles: FilteredFile[];
|
|
131
548
|
}
|
|
132
549
|
interface DiffStats {
|
|
133
550
|
files: number;
|
|
@@ -135,41 +552,94 @@ interface DiffStats {
|
|
|
135
552
|
deletions: number;
|
|
136
553
|
changes: number;
|
|
137
554
|
}
|
|
138
|
-
|
|
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 {
|
|
139
559
|
path: string;
|
|
140
|
-
state:
|
|
141
|
-
|
|
560
|
+
state: DiffFileState;
|
|
561
|
+
rawState: string;
|
|
562
|
+
oldPath?: string;
|
|
142
563
|
bytes: number;
|
|
143
|
-
|
|
144
|
-
diff: string;
|
|
564
|
+
isEof: boolean;
|
|
145
565
|
}
|
|
146
|
-
interface
|
|
147
|
-
|
|
148
|
-
state: string;
|
|
149
|
-
old_path?: string;
|
|
150
|
-
bytes: number;
|
|
151
|
-
is_eof: boolean;
|
|
566
|
+
interface FileDiff extends DiffFileBase {
|
|
567
|
+
raw: string;
|
|
152
568
|
}
|
|
153
|
-
interface
|
|
154
|
-
sha: string;
|
|
569
|
+
interface FilteredFile extends DiffFileBase {
|
|
155
570
|
}
|
|
156
|
-
interface
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
571
|
+
interface CreateCommitOptions extends GitStorageInvocationOptions {
|
|
572
|
+
targetBranch: string;
|
|
573
|
+
commitMessage: string;
|
|
574
|
+
expectedHeadSha?: string;
|
|
575
|
+
author: CommitSignature;
|
|
576
|
+
committer?: CommitSignature;
|
|
577
|
+
signal?: AbortSignal;
|
|
578
|
+
}
|
|
579
|
+
interface CommitSignature {
|
|
580
|
+
name: string;
|
|
581
|
+
email: string;
|
|
582
|
+
}
|
|
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>;
|
|
603
|
+
interface CommitFileOptions {
|
|
604
|
+
mode?: GitFileMode;
|
|
605
|
+
}
|
|
606
|
+
interface CommitTextFileOptions extends CommitFileOptions {
|
|
607
|
+
encoding?: TextEncoding;
|
|
608
|
+
}
|
|
609
|
+
interface CommitBuilder {
|
|
610
|
+
addFile(path: string, source: CommitFileSource, options?: CommitFileOptions): CommitBuilder;
|
|
611
|
+
addFileFromString(path: string, contents: string, options?: CommitTextFileOptions): CommitBuilder;
|
|
612
|
+
deletePath(path: string): CommitBuilder;
|
|
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;
|
|
173
643
|
}
|
|
174
644
|
interface WebhookValidationOptions {
|
|
175
645
|
/**
|
|
@@ -196,7 +666,7 @@ interface WebhookValidationResult {
|
|
|
196
666
|
*/
|
|
197
667
|
timestamp?: number;
|
|
198
668
|
}
|
|
199
|
-
interface
|
|
669
|
+
interface RawWebhookPushEvent {
|
|
200
670
|
repository: {
|
|
201
671
|
id: string;
|
|
202
672
|
url: string;
|
|
@@ -207,12 +677,58 @@ interface WebhookPushEvent {
|
|
|
207
677
|
customer_id: string;
|
|
208
678
|
pushed_at: string;
|
|
209
679
|
}
|
|
210
|
-
|
|
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;
|
|
211
698
|
interface ParsedWebhookSignature {
|
|
212
699
|
timestamp: string;
|
|
213
700
|
signature: string;
|
|
214
701
|
}
|
|
215
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
|
+
|
|
216
732
|
/**
|
|
217
733
|
* Webhook validation utilities for Pierre Git Storage
|
|
218
734
|
*/
|
|
@@ -314,4 +830,4 @@ declare class GitStorage {
|
|
|
314
830
|
declare function createClient(options: GitStorageOptions): GitStorage;
|
|
315
831
|
type StorageOptions = GitStorageOptions;
|
|
316
832
|
|
|
317
|
-
export { type BaseRepo, type BranchInfo, type CommitInfo, type CreateRepoOptions, type
|
|
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 };
|