@pierre/storage 0.2.0 → 0.2.2
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 +37 -0
- package/dist/index.cjs +583 -311
- 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 +583 -311
- package/dist/index.js.map +1 -1
- package/package.json +38 -39
- package/src/commit-pack.ts +128 -0
- package/src/commit.ts +18 -362
- package/src/diff-commit.ts +300 -0
- package/src/index.ts +72 -1
- package/src/schemas.ts +8 -0
- package/src/stream-utils.ts +255 -0
- package/src/types.ts +36 -1
package/dist/index.d.cts
CHANGED
|
@@ -398,6 +398,22 @@ declare const commitDiffResponseSchema: z.ZodObject<{
|
|
|
398
398
|
old_path?: string | null | undefined;
|
|
399
399
|
}[];
|
|
400
400
|
}>;
|
|
401
|
+
declare const createBranchResponseSchema: z.ZodObject<{
|
|
402
|
+
message: z.ZodString;
|
|
403
|
+
target_branch: z.ZodString;
|
|
404
|
+
target_is_ephemeral: z.ZodBoolean;
|
|
405
|
+
commit_sha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
406
|
+
}, "strip", z.ZodTypeAny, {
|
|
407
|
+
target_branch: string;
|
|
408
|
+
message: string;
|
|
409
|
+
target_is_ephemeral: boolean;
|
|
410
|
+
commit_sha?: string | null | undefined;
|
|
411
|
+
}, {
|
|
412
|
+
target_branch: string;
|
|
413
|
+
message: string;
|
|
414
|
+
target_is_ephemeral: boolean;
|
|
415
|
+
commit_sha?: string | null | undefined;
|
|
416
|
+
}>;
|
|
401
417
|
type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
|
|
402
418
|
type RawBranchInfo$1 = z.infer<typeof branchInfoSchema>;
|
|
403
419
|
type ListBranchesResponseRaw = z.infer<typeof listBranchesResponseSchema>;
|
|
@@ -407,6 +423,7 @@ type RawFileDiff$1 = z.infer<typeof diffFileRawSchema>;
|
|
|
407
423
|
type RawFilteredFile$1 = z.infer<typeof filteredFileRawSchema>;
|
|
408
424
|
type GetBranchDiffResponseRaw = z.infer<typeof branchDiffResponseSchema>;
|
|
409
425
|
type GetCommitDiffResponseRaw = z.infer<typeof commitDiffResponseSchema>;
|
|
426
|
+
type CreateBranchResponseRaw = z.infer<typeof createBranchResponseSchema>;
|
|
410
427
|
|
|
411
428
|
/**
|
|
412
429
|
* Type definitions for Pierre Git Storage SDK
|
|
@@ -437,9 +454,11 @@ interface Repo {
|
|
|
437
454
|
listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
|
|
438
455
|
getBranchDiff(options: GetBranchDiffOptions): Promise<GetBranchDiffResult>;
|
|
439
456
|
getCommitDiff(options: GetCommitDiffOptions): Promise<GetCommitDiffResult>;
|
|
440
|
-
pullUpstream(options
|
|
457
|
+
pullUpstream(options?: PullUpstreamOptions): Promise<void>;
|
|
441
458
|
restoreCommit(options: RestoreCommitOptions): Promise<RestoreCommitResult>;
|
|
459
|
+
createBranch(options: CreateBranchOptions): Promise<CreateBranchResult>;
|
|
442
460
|
createCommit(options: CreateCommitOptions): CommitBuilder;
|
|
461
|
+
createCommitFromDiff(options: CreateCommitFromDiffOptions): Promise<CommitResult>;
|
|
443
462
|
}
|
|
444
463
|
type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
445
464
|
type SimplePath = string;
|
|
@@ -504,6 +523,19 @@ interface ListBranchesResult {
|
|
|
504
523
|
nextCursor?: string;
|
|
505
524
|
hasMore: boolean;
|
|
506
525
|
}
|
|
526
|
+
interface CreateBranchOptions extends GitStorageInvocationOptions {
|
|
527
|
+
baseBranch: string;
|
|
528
|
+
targetBranch: string;
|
|
529
|
+
baseIsEphemeral?: boolean;
|
|
530
|
+
targetIsEphemeral?: boolean;
|
|
531
|
+
}
|
|
532
|
+
type CreateBranchResponse = CreateBranchResponseRaw;
|
|
533
|
+
interface CreateBranchResult {
|
|
534
|
+
message: string;
|
|
535
|
+
targetBranch: string;
|
|
536
|
+
targetIsEphemeral: boolean;
|
|
537
|
+
commitSha?: string;
|
|
538
|
+
}
|
|
507
539
|
interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
508
540
|
branch?: string;
|
|
509
541
|
cursor?: string;
|
|
@@ -628,6 +660,19 @@ interface CommitBuilder {
|
|
|
628
660
|
deletePath(path: string): CommitBuilder;
|
|
629
661
|
send(): Promise<CommitResult>;
|
|
630
662
|
}
|
|
663
|
+
type DiffSource = CommitFileSource;
|
|
664
|
+
interface CreateCommitFromDiffOptions extends GitStorageInvocationOptions {
|
|
665
|
+
targetBranch: string;
|
|
666
|
+
commitMessage: string;
|
|
667
|
+
diff: DiffSource;
|
|
668
|
+
expectedHeadSha?: string;
|
|
669
|
+
baseBranch?: string;
|
|
670
|
+
ephemeral?: boolean;
|
|
671
|
+
ephemeralBase?: boolean;
|
|
672
|
+
author: CommitSignature;
|
|
673
|
+
committer?: CommitSignature;
|
|
674
|
+
signal?: AbortSignal;
|
|
675
|
+
}
|
|
631
676
|
interface RefUpdate {
|
|
632
677
|
branch: string;
|
|
633
678
|
oldSha: string;
|
|
@@ -846,4 +891,4 @@ declare class GitStorage {
|
|
|
846
891
|
declare function createClient(options: GitStorageOptions): GitStorage;
|
|
847
892
|
type StorageOptions = GitStorageOptions;
|
|
848
893
|
|
|
849
|
-
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateCommitBranchOptions, 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 LegacyCreateCommitOptions, 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 RestoreCommitOptions, type RestoreCommitResult, 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 };
|
|
894
|
+
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateRepoOptions, type DiffFileBase, type DiffFileState, type DiffSource, 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 LegacyCreateCommitOptions, 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 RestoreCommitOptions, type RestoreCommitResult, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -398,6 +398,22 @@ declare const commitDiffResponseSchema: z.ZodObject<{
|
|
|
398
398
|
old_path?: string | null | undefined;
|
|
399
399
|
}[];
|
|
400
400
|
}>;
|
|
401
|
+
declare const createBranchResponseSchema: z.ZodObject<{
|
|
402
|
+
message: z.ZodString;
|
|
403
|
+
target_branch: z.ZodString;
|
|
404
|
+
target_is_ephemeral: z.ZodBoolean;
|
|
405
|
+
commit_sha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
406
|
+
}, "strip", z.ZodTypeAny, {
|
|
407
|
+
target_branch: string;
|
|
408
|
+
message: string;
|
|
409
|
+
target_is_ephemeral: boolean;
|
|
410
|
+
commit_sha?: string | null | undefined;
|
|
411
|
+
}, {
|
|
412
|
+
target_branch: string;
|
|
413
|
+
message: string;
|
|
414
|
+
target_is_ephemeral: boolean;
|
|
415
|
+
commit_sha?: string | null | undefined;
|
|
416
|
+
}>;
|
|
401
417
|
type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
|
|
402
418
|
type RawBranchInfo$1 = z.infer<typeof branchInfoSchema>;
|
|
403
419
|
type ListBranchesResponseRaw = z.infer<typeof listBranchesResponseSchema>;
|
|
@@ -407,6 +423,7 @@ type RawFileDiff$1 = z.infer<typeof diffFileRawSchema>;
|
|
|
407
423
|
type RawFilteredFile$1 = z.infer<typeof filteredFileRawSchema>;
|
|
408
424
|
type GetBranchDiffResponseRaw = z.infer<typeof branchDiffResponseSchema>;
|
|
409
425
|
type GetCommitDiffResponseRaw = z.infer<typeof commitDiffResponseSchema>;
|
|
426
|
+
type CreateBranchResponseRaw = z.infer<typeof createBranchResponseSchema>;
|
|
410
427
|
|
|
411
428
|
/**
|
|
412
429
|
* Type definitions for Pierre Git Storage SDK
|
|
@@ -437,9 +454,11 @@ interface Repo {
|
|
|
437
454
|
listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
|
|
438
455
|
getBranchDiff(options: GetBranchDiffOptions): Promise<GetBranchDiffResult>;
|
|
439
456
|
getCommitDiff(options: GetCommitDiffOptions): Promise<GetCommitDiffResult>;
|
|
440
|
-
pullUpstream(options
|
|
457
|
+
pullUpstream(options?: PullUpstreamOptions): Promise<void>;
|
|
441
458
|
restoreCommit(options: RestoreCommitOptions): Promise<RestoreCommitResult>;
|
|
459
|
+
createBranch(options: CreateBranchOptions): Promise<CreateBranchResult>;
|
|
442
460
|
createCommit(options: CreateCommitOptions): CommitBuilder;
|
|
461
|
+
createCommitFromDiff(options: CreateCommitFromDiffOptions): Promise<CommitResult>;
|
|
443
462
|
}
|
|
444
463
|
type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
445
464
|
type SimplePath = string;
|
|
@@ -504,6 +523,19 @@ interface ListBranchesResult {
|
|
|
504
523
|
nextCursor?: string;
|
|
505
524
|
hasMore: boolean;
|
|
506
525
|
}
|
|
526
|
+
interface CreateBranchOptions extends GitStorageInvocationOptions {
|
|
527
|
+
baseBranch: string;
|
|
528
|
+
targetBranch: string;
|
|
529
|
+
baseIsEphemeral?: boolean;
|
|
530
|
+
targetIsEphemeral?: boolean;
|
|
531
|
+
}
|
|
532
|
+
type CreateBranchResponse = CreateBranchResponseRaw;
|
|
533
|
+
interface CreateBranchResult {
|
|
534
|
+
message: string;
|
|
535
|
+
targetBranch: string;
|
|
536
|
+
targetIsEphemeral: boolean;
|
|
537
|
+
commitSha?: string;
|
|
538
|
+
}
|
|
507
539
|
interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
508
540
|
branch?: string;
|
|
509
541
|
cursor?: string;
|
|
@@ -628,6 +660,19 @@ interface CommitBuilder {
|
|
|
628
660
|
deletePath(path: string): CommitBuilder;
|
|
629
661
|
send(): Promise<CommitResult>;
|
|
630
662
|
}
|
|
663
|
+
type DiffSource = CommitFileSource;
|
|
664
|
+
interface CreateCommitFromDiffOptions extends GitStorageInvocationOptions {
|
|
665
|
+
targetBranch: string;
|
|
666
|
+
commitMessage: string;
|
|
667
|
+
diff: DiffSource;
|
|
668
|
+
expectedHeadSha?: string;
|
|
669
|
+
baseBranch?: string;
|
|
670
|
+
ephemeral?: boolean;
|
|
671
|
+
ephemeralBase?: boolean;
|
|
672
|
+
author: CommitSignature;
|
|
673
|
+
committer?: CommitSignature;
|
|
674
|
+
signal?: AbortSignal;
|
|
675
|
+
}
|
|
631
676
|
interface RefUpdate {
|
|
632
677
|
branch: string;
|
|
633
678
|
oldSha: string;
|
|
@@ -846,4 +891,4 @@ declare class GitStorage {
|
|
|
846
891
|
declare function createClient(options: GitStorageOptions): GitStorage;
|
|
847
892
|
type StorageOptions = GitStorageOptions;
|
|
848
893
|
|
|
849
|
-
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateCommitBranchOptions, 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 LegacyCreateCommitOptions, 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 RestoreCommitOptions, type RestoreCommitResult, 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 };
|
|
894
|
+
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateRepoOptions, type DiffFileBase, type DiffFileState, type DiffSource, 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 LegacyCreateCommitOptions, 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 RestoreCommitOptions, type RestoreCommitResult, 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 };
|