@pierre/storage 0.0.9 → 0.0.11
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 +83 -1
- package/dist/index.cjs +367 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +367 -5
- package/dist/index.js.map +1 -1
- package/package.json +37 -38
- package/src/commit.ts +496 -0
- package/src/index.ts +26 -4
- package/src/types.ts +58 -1
package/src/types.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface Repo {
|
|
|
32
32
|
getBranchDiff(options: GetBranchDiffOptions): Promise<GetBranchDiffResponse>;
|
|
33
33
|
getCommitDiff(options: GetCommitDiffOptions): Promise<GetCommitDiffResponse>;
|
|
34
34
|
getCommit(options: GetCommitOptions): Promise<GetCommitResponse>;
|
|
35
|
+
pullUpstream(options: PullUpstreamOptions): Promise<void>;
|
|
36
|
+
createCommit(options: CreateCommitOptions): CommitBuilder;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
@@ -80,7 +82,7 @@ export interface GetFileOptions extends GitStorageInvocationOptions {
|
|
|
80
82
|
ref?: string;
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
export interface
|
|
85
|
+
export interface PullUpstreamOptions extends GitStorageInvocationOptions {
|
|
84
86
|
ref?: string;
|
|
85
87
|
}
|
|
86
88
|
|
|
@@ -211,6 +213,61 @@ export interface GetCommitResponse {
|
|
|
211
213
|
};
|
|
212
214
|
}
|
|
213
215
|
|
|
216
|
+
export interface CreateCommitOptions extends GitStorageInvocationOptions {
|
|
217
|
+
targetRef: string;
|
|
218
|
+
commitMessage: string;
|
|
219
|
+
baseRef?: string;
|
|
220
|
+
author?: CommitSignature;
|
|
221
|
+
committer?: CommitSignature;
|
|
222
|
+
signal?: AbortSignal;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface CommitSignature {
|
|
226
|
+
name: string;
|
|
227
|
+
email: string;
|
|
228
|
+
date?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export type CommitFileSource =
|
|
232
|
+
| string
|
|
233
|
+
| Uint8Array
|
|
234
|
+
| ArrayBuffer
|
|
235
|
+
| AsyncIterable<Uint8Array | ArrayBuffer>
|
|
236
|
+
| Iterable<Uint8Array | ArrayBuffer>;
|
|
237
|
+
|
|
238
|
+
export interface CommitFileOptions {
|
|
239
|
+
mode?: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface CommitTextFileOptions extends CommitFileOptions {
|
|
243
|
+
encoding?: 'utf8' | 'utf-8';
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface CommitBuilder {
|
|
247
|
+
addFile(path: string, source: CommitFileSource, options?: CommitFileOptions): CommitBuilder;
|
|
248
|
+
addFileFromString(path: string, contents: string, options?: CommitTextFileOptions): CommitBuilder;
|
|
249
|
+
deletePath(path: string): CommitBuilder;
|
|
250
|
+
send(): Promise<CommitResponse>;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface CommitResponse {
|
|
254
|
+
commit: {
|
|
255
|
+
commit_sha: string;
|
|
256
|
+
tree_sha: string;
|
|
257
|
+
target_ref: string;
|
|
258
|
+
pack_bytes: number;
|
|
259
|
+
blob_count: number;
|
|
260
|
+
};
|
|
261
|
+
result: {
|
|
262
|
+
ref: string;
|
|
263
|
+
old_sha: string; // 40-hex previous tip; all zeroes when the ref is newly created.
|
|
264
|
+
new_sha: string;
|
|
265
|
+
success: boolean;
|
|
266
|
+
status: string;
|
|
267
|
+
message?: string;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
214
271
|
// Webhook types
|
|
215
272
|
export interface WebhookValidationOptions {
|
|
216
273
|
/**
|