@pierre/storage 1.3.2 → 1.4.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 +18 -0
- package/dist/index.cjs +116 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +111 -1
- package/dist/index.d.ts +111 -1
- package/dist/index.js +116 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +126 -0
- package/src/schemas.ts +27 -0
- package/src/types.ts +52 -0
package/dist/index.d.cts
CHANGED
|
@@ -702,6 +702,75 @@ declare const createBranchResponseSchema: z.ZodObject<{
|
|
|
702
702
|
target_is_ephemeral: boolean;
|
|
703
703
|
commit_sha?: string | null | undefined;
|
|
704
704
|
}>;
|
|
705
|
+
declare const tagInfoSchema: z.ZodObject<{
|
|
706
|
+
cursor: z.ZodString;
|
|
707
|
+
name: z.ZodString;
|
|
708
|
+
sha: z.ZodString;
|
|
709
|
+
}, "strip", z.ZodTypeAny, {
|
|
710
|
+
cursor: string;
|
|
711
|
+
name: string;
|
|
712
|
+
sha: string;
|
|
713
|
+
}, {
|
|
714
|
+
cursor: string;
|
|
715
|
+
name: string;
|
|
716
|
+
sha: string;
|
|
717
|
+
}>;
|
|
718
|
+
declare const listTagsResponseSchema: z.ZodObject<{
|
|
719
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
720
|
+
cursor: z.ZodString;
|
|
721
|
+
name: z.ZodString;
|
|
722
|
+
sha: z.ZodString;
|
|
723
|
+
}, "strip", z.ZodTypeAny, {
|
|
724
|
+
cursor: string;
|
|
725
|
+
name: string;
|
|
726
|
+
sha: string;
|
|
727
|
+
}, {
|
|
728
|
+
cursor: string;
|
|
729
|
+
name: string;
|
|
730
|
+
sha: string;
|
|
731
|
+
}>, "many">;
|
|
732
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
733
|
+
has_more: z.ZodBoolean;
|
|
734
|
+
}, "strip", z.ZodTypeAny, {
|
|
735
|
+
has_more: boolean;
|
|
736
|
+
tags: {
|
|
737
|
+
cursor: string;
|
|
738
|
+
name: string;
|
|
739
|
+
sha: string;
|
|
740
|
+
}[];
|
|
741
|
+
next_cursor?: string | null | undefined;
|
|
742
|
+
}, {
|
|
743
|
+
has_more: boolean;
|
|
744
|
+
tags: {
|
|
745
|
+
cursor: string;
|
|
746
|
+
name: string;
|
|
747
|
+
sha: string;
|
|
748
|
+
}[];
|
|
749
|
+
next_cursor?: string | null | undefined;
|
|
750
|
+
}>;
|
|
751
|
+
declare const createTagResponseSchema: z.ZodObject<{
|
|
752
|
+
name: z.ZodString;
|
|
753
|
+
sha: z.ZodString;
|
|
754
|
+
message: z.ZodString;
|
|
755
|
+
}, "strip", z.ZodTypeAny, {
|
|
756
|
+
message: string;
|
|
757
|
+
name: string;
|
|
758
|
+
sha: string;
|
|
759
|
+
}, {
|
|
760
|
+
message: string;
|
|
761
|
+
name: string;
|
|
762
|
+
sha: string;
|
|
763
|
+
}>;
|
|
764
|
+
declare const deleteTagResponseSchema: z.ZodObject<{
|
|
765
|
+
name: z.ZodString;
|
|
766
|
+
message: z.ZodString;
|
|
767
|
+
}, "strip", z.ZodTypeAny, {
|
|
768
|
+
message: string;
|
|
769
|
+
name: string;
|
|
770
|
+
}, {
|
|
771
|
+
message: string;
|
|
772
|
+
name: string;
|
|
773
|
+
}>;
|
|
705
774
|
type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
|
|
706
775
|
type RawFileWithMetadata$1 = z.infer<typeof fileWithMetadataRawSchema>;
|
|
707
776
|
type RawCommitMetadata$1 = z.infer<typeof commitMetadataRawSchema>;
|
|
@@ -720,6 +789,10 @@ type RawFilteredFile$1 = z.infer<typeof filteredFileRawSchema>;
|
|
|
720
789
|
type GetBranchDiffResponseRaw = z.infer<typeof branchDiffResponseSchema>;
|
|
721
790
|
type GetCommitDiffResponseRaw = z.infer<typeof commitDiffResponseSchema>;
|
|
722
791
|
type CreateBranchResponseRaw = z.infer<typeof createBranchResponseSchema>;
|
|
792
|
+
type RawTagInfo$1 = z.infer<typeof tagInfoSchema>;
|
|
793
|
+
type ListTagsResponseRaw = z.infer<typeof listTagsResponseSchema>;
|
|
794
|
+
type CreateTagResponseRaw = z.infer<typeof createTagResponseSchema>;
|
|
795
|
+
type DeleteTagResponseRaw = z.infer<typeof deleteTagResponseSchema>;
|
|
723
796
|
|
|
724
797
|
/**
|
|
725
798
|
* Type definitions for Pierre Git Storage SDK
|
|
@@ -753,7 +826,10 @@ interface Repo {
|
|
|
753
826
|
listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
|
|
754
827
|
listFilesWithMetadata(options?: ListFilesWithMetadataOptions): Promise<ListFilesWithMetadataResult>;
|
|
755
828
|
listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
|
|
829
|
+
listTags(options?: ListTagsOptions): Promise<ListTagsResult>;
|
|
756
830
|
listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
|
|
831
|
+
createTag(options: CreateTagOptions): Promise<CreateTagResult>;
|
|
832
|
+
deleteTag(options: DeleteTagOptions): Promise<DeleteTagResult>;
|
|
757
833
|
getNote(options: GetNoteOptions): Promise<GetNoteResult>;
|
|
758
834
|
createNote(options: CreateNoteOptions): Promise<NoteWriteResult>;
|
|
759
835
|
appendNote(options: AppendNoteOptions): Promise<NoteWriteResult>;
|
|
@@ -958,6 +1034,40 @@ interface CreateBranchResult {
|
|
|
958
1034
|
targetIsEphemeral: boolean;
|
|
959
1035
|
commitSha?: string;
|
|
960
1036
|
}
|
|
1037
|
+
interface ListTagsOptions extends GitStorageInvocationOptions {
|
|
1038
|
+
cursor?: string;
|
|
1039
|
+
limit?: number;
|
|
1040
|
+
}
|
|
1041
|
+
type RawTagInfo = RawTagInfo$1;
|
|
1042
|
+
interface TagInfo {
|
|
1043
|
+
cursor: string;
|
|
1044
|
+
name: string;
|
|
1045
|
+
sha: string;
|
|
1046
|
+
}
|
|
1047
|
+
type ListTagsResponse = ListTagsResponseRaw;
|
|
1048
|
+
interface ListTagsResult {
|
|
1049
|
+
tags: TagInfo[];
|
|
1050
|
+
nextCursor?: string;
|
|
1051
|
+
hasMore: boolean;
|
|
1052
|
+
}
|
|
1053
|
+
interface CreateTagOptions extends GitStorageInvocationOptions {
|
|
1054
|
+
name: string;
|
|
1055
|
+
target: string;
|
|
1056
|
+
}
|
|
1057
|
+
type CreateTagResponse = CreateTagResponseRaw;
|
|
1058
|
+
interface CreateTagResult {
|
|
1059
|
+
name: string;
|
|
1060
|
+
sha: string;
|
|
1061
|
+
message: string;
|
|
1062
|
+
}
|
|
1063
|
+
interface DeleteTagOptions extends GitStorageInvocationOptions {
|
|
1064
|
+
name: string;
|
|
1065
|
+
}
|
|
1066
|
+
type DeleteTagResponse = DeleteTagResponseRaw;
|
|
1067
|
+
interface DeleteTagResult {
|
|
1068
|
+
name: string;
|
|
1069
|
+
message: string;
|
|
1070
|
+
}
|
|
961
1071
|
interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
962
1072
|
branch?: string;
|
|
963
1073
|
cursor?: string;
|
|
@@ -1435,4 +1545,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
|
|
|
1435
1545
|
|
|
1436
1546
|
type StorageOptions = GitStorageOptions;
|
|
1437
1547
|
|
|
1438
|
-
export { ApiError, type AppendNoteOptions, type ArchiveOptions, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitMetadata, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateGitCredentialOptions, type CreateNoteOptions, type CreateRepoOptions, type DeleteGitCredentialOptions, type DeleteNoteOptions, type DeleteRepoOptions, type DeleteRepoResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FileWithMetadata, type FilteredFile, type FindOneOptions, type ForkBaseRepo, type GenericGitBaseRepo, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, type GitCredential, type GitFileMode, type GitHubBaseRepo, GitStorage, type GitStorageOptions, type GrepFileMatch, type GrepLine, type GrepOptions, type GrepResult, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type ListFilesWithMetadataOptions, type ListFilesWithMetadataResponse, type ListFilesWithMetadataResult, type ListReposOptions, type ListReposResponse, type ListReposResult, type NoteWriteResponse, type NoteWriteResult, type NoteWriteResultPayload, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PublicGitHubBaseRepoAuth, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawCommitMetadata, type RawFileDiff, type RawFileWithMetadata, type RawFilteredFile, type RawRepoBaseInfo, type RawRepoInfo, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RepoBaseInfo, type RepoInfo, type RepoOptions, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type UpdateGitCredentialOptions, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
|
1548
|
+
export { ApiError, type AppendNoteOptions, type ArchiveOptions, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitMetadata, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateGitCredentialOptions, type CreateNoteOptions, type CreateRepoOptions, type CreateTagOptions, type CreateTagResponse, type CreateTagResult, type DeleteGitCredentialOptions, type DeleteNoteOptions, type DeleteRepoOptions, type DeleteRepoResult, type DeleteTagOptions, type DeleteTagResponse, type DeleteTagResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FileWithMetadata, type FilteredFile, type FindOneOptions, type ForkBaseRepo, type GenericGitBaseRepo, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, type GitCredential, type GitFileMode, type GitHubBaseRepo, GitStorage, type GitStorageOptions, type GrepFileMatch, type GrepLine, type GrepOptions, type GrepResult, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type ListFilesWithMetadataOptions, type ListFilesWithMetadataResponse, type ListFilesWithMetadataResult, type ListReposOptions, type ListReposResponse, type ListReposResult, type ListTagsOptions, type ListTagsResponse, type ListTagsResult, type NoteWriteResponse, type NoteWriteResult, type NoteWriteResultPayload, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PublicGitHubBaseRepoAuth, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawCommitMetadata, type RawFileDiff, type RawFileWithMetadata, type RawFilteredFile, type RawRepoBaseInfo, type RawRepoInfo, type RawTagInfo, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RepoBaseInfo, type RepoInfo, type RepoOptions, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TagInfo, type TextEncoding, type UpdateGitCredentialOptions, 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
|
@@ -702,6 +702,75 @@ declare const createBranchResponseSchema: z.ZodObject<{
|
|
|
702
702
|
target_is_ephemeral: boolean;
|
|
703
703
|
commit_sha?: string | null | undefined;
|
|
704
704
|
}>;
|
|
705
|
+
declare const tagInfoSchema: z.ZodObject<{
|
|
706
|
+
cursor: z.ZodString;
|
|
707
|
+
name: z.ZodString;
|
|
708
|
+
sha: z.ZodString;
|
|
709
|
+
}, "strip", z.ZodTypeAny, {
|
|
710
|
+
cursor: string;
|
|
711
|
+
name: string;
|
|
712
|
+
sha: string;
|
|
713
|
+
}, {
|
|
714
|
+
cursor: string;
|
|
715
|
+
name: string;
|
|
716
|
+
sha: string;
|
|
717
|
+
}>;
|
|
718
|
+
declare const listTagsResponseSchema: z.ZodObject<{
|
|
719
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
720
|
+
cursor: z.ZodString;
|
|
721
|
+
name: z.ZodString;
|
|
722
|
+
sha: z.ZodString;
|
|
723
|
+
}, "strip", z.ZodTypeAny, {
|
|
724
|
+
cursor: string;
|
|
725
|
+
name: string;
|
|
726
|
+
sha: string;
|
|
727
|
+
}, {
|
|
728
|
+
cursor: string;
|
|
729
|
+
name: string;
|
|
730
|
+
sha: string;
|
|
731
|
+
}>, "many">;
|
|
732
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
733
|
+
has_more: z.ZodBoolean;
|
|
734
|
+
}, "strip", z.ZodTypeAny, {
|
|
735
|
+
has_more: boolean;
|
|
736
|
+
tags: {
|
|
737
|
+
cursor: string;
|
|
738
|
+
name: string;
|
|
739
|
+
sha: string;
|
|
740
|
+
}[];
|
|
741
|
+
next_cursor?: string | null | undefined;
|
|
742
|
+
}, {
|
|
743
|
+
has_more: boolean;
|
|
744
|
+
tags: {
|
|
745
|
+
cursor: string;
|
|
746
|
+
name: string;
|
|
747
|
+
sha: string;
|
|
748
|
+
}[];
|
|
749
|
+
next_cursor?: string | null | undefined;
|
|
750
|
+
}>;
|
|
751
|
+
declare const createTagResponseSchema: z.ZodObject<{
|
|
752
|
+
name: z.ZodString;
|
|
753
|
+
sha: z.ZodString;
|
|
754
|
+
message: z.ZodString;
|
|
755
|
+
}, "strip", z.ZodTypeAny, {
|
|
756
|
+
message: string;
|
|
757
|
+
name: string;
|
|
758
|
+
sha: string;
|
|
759
|
+
}, {
|
|
760
|
+
message: string;
|
|
761
|
+
name: string;
|
|
762
|
+
sha: string;
|
|
763
|
+
}>;
|
|
764
|
+
declare const deleteTagResponseSchema: z.ZodObject<{
|
|
765
|
+
name: z.ZodString;
|
|
766
|
+
message: z.ZodString;
|
|
767
|
+
}, "strip", z.ZodTypeAny, {
|
|
768
|
+
message: string;
|
|
769
|
+
name: string;
|
|
770
|
+
}, {
|
|
771
|
+
message: string;
|
|
772
|
+
name: string;
|
|
773
|
+
}>;
|
|
705
774
|
type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
|
|
706
775
|
type RawFileWithMetadata$1 = z.infer<typeof fileWithMetadataRawSchema>;
|
|
707
776
|
type RawCommitMetadata$1 = z.infer<typeof commitMetadataRawSchema>;
|
|
@@ -720,6 +789,10 @@ type RawFilteredFile$1 = z.infer<typeof filteredFileRawSchema>;
|
|
|
720
789
|
type GetBranchDiffResponseRaw = z.infer<typeof branchDiffResponseSchema>;
|
|
721
790
|
type GetCommitDiffResponseRaw = z.infer<typeof commitDiffResponseSchema>;
|
|
722
791
|
type CreateBranchResponseRaw = z.infer<typeof createBranchResponseSchema>;
|
|
792
|
+
type RawTagInfo$1 = z.infer<typeof tagInfoSchema>;
|
|
793
|
+
type ListTagsResponseRaw = z.infer<typeof listTagsResponseSchema>;
|
|
794
|
+
type CreateTagResponseRaw = z.infer<typeof createTagResponseSchema>;
|
|
795
|
+
type DeleteTagResponseRaw = z.infer<typeof deleteTagResponseSchema>;
|
|
723
796
|
|
|
724
797
|
/**
|
|
725
798
|
* Type definitions for Pierre Git Storage SDK
|
|
@@ -753,7 +826,10 @@ interface Repo {
|
|
|
753
826
|
listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
|
|
754
827
|
listFilesWithMetadata(options?: ListFilesWithMetadataOptions): Promise<ListFilesWithMetadataResult>;
|
|
755
828
|
listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
|
|
829
|
+
listTags(options?: ListTagsOptions): Promise<ListTagsResult>;
|
|
756
830
|
listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
|
|
831
|
+
createTag(options: CreateTagOptions): Promise<CreateTagResult>;
|
|
832
|
+
deleteTag(options: DeleteTagOptions): Promise<DeleteTagResult>;
|
|
757
833
|
getNote(options: GetNoteOptions): Promise<GetNoteResult>;
|
|
758
834
|
createNote(options: CreateNoteOptions): Promise<NoteWriteResult>;
|
|
759
835
|
appendNote(options: AppendNoteOptions): Promise<NoteWriteResult>;
|
|
@@ -958,6 +1034,40 @@ interface CreateBranchResult {
|
|
|
958
1034
|
targetIsEphemeral: boolean;
|
|
959
1035
|
commitSha?: string;
|
|
960
1036
|
}
|
|
1037
|
+
interface ListTagsOptions extends GitStorageInvocationOptions {
|
|
1038
|
+
cursor?: string;
|
|
1039
|
+
limit?: number;
|
|
1040
|
+
}
|
|
1041
|
+
type RawTagInfo = RawTagInfo$1;
|
|
1042
|
+
interface TagInfo {
|
|
1043
|
+
cursor: string;
|
|
1044
|
+
name: string;
|
|
1045
|
+
sha: string;
|
|
1046
|
+
}
|
|
1047
|
+
type ListTagsResponse = ListTagsResponseRaw;
|
|
1048
|
+
interface ListTagsResult {
|
|
1049
|
+
tags: TagInfo[];
|
|
1050
|
+
nextCursor?: string;
|
|
1051
|
+
hasMore: boolean;
|
|
1052
|
+
}
|
|
1053
|
+
interface CreateTagOptions extends GitStorageInvocationOptions {
|
|
1054
|
+
name: string;
|
|
1055
|
+
target: string;
|
|
1056
|
+
}
|
|
1057
|
+
type CreateTagResponse = CreateTagResponseRaw;
|
|
1058
|
+
interface CreateTagResult {
|
|
1059
|
+
name: string;
|
|
1060
|
+
sha: string;
|
|
1061
|
+
message: string;
|
|
1062
|
+
}
|
|
1063
|
+
interface DeleteTagOptions extends GitStorageInvocationOptions {
|
|
1064
|
+
name: string;
|
|
1065
|
+
}
|
|
1066
|
+
type DeleteTagResponse = DeleteTagResponseRaw;
|
|
1067
|
+
interface DeleteTagResult {
|
|
1068
|
+
name: string;
|
|
1069
|
+
message: string;
|
|
1070
|
+
}
|
|
961
1071
|
interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
962
1072
|
branch?: string;
|
|
963
1073
|
cursor?: string;
|
|
@@ -1435,4 +1545,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
|
|
|
1435
1545
|
|
|
1436
1546
|
type StorageOptions = GitStorageOptions;
|
|
1437
1547
|
|
|
1438
|
-
export { ApiError, type AppendNoteOptions, type ArchiveOptions, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitMetadata, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateGitCredentialOptions, type CreateNoteOptions, type CreateRepoOptions, type DeleteGitCredentialOptions, type DeleteNoteOptions, type DeleteRepoOptions, type DeleteRepoResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FileWithMetadata, type FilteredFile, type FindOneOptions, type ForkBaseRepo, type GenericGitBaseRepo, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, type GitCredential, type GitFileMode, type GitHubBaseRepo, GitStorage, type GitStorageOptions, type GrepFileMatch, type GrepLine, type GrepOptions, type GrepResult, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type ListFilesWithMetadataOptions, type ListFilesWithMetadataResponse, type ListFilesWithMetadataResult, type ListReposOptions, type ListReposResponse, type ListReposResult, type NoteWriteResponse, type NoteWriteResult, type NoteWriteResultPayload, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PublicGitHubBaseRepoAuth, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawCommitMetadata, type RawFileDiff, type RawFileWithMetadata, type RawFilteredFile, type RawRepoBaseInfo, type RawRepoInfo, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RepoBaseInfo, type RepoInfo, type RepoOptions, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type UpdateGitCredentialOptions, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
|
1548
|
+
export { ApiError, type AppendNoteOptions, type ArchiveOptions, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitMetadata, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateGitCredentialOptions, type CreateNoteOptions, type CreateRepoOptions, type CreateTagOptions, type CreateTagResponse, type CreateTagResult, type DeleteGitCredentialOptions, type DeleteNoteOptions, type DeleteRepoOptions, type DeleteRepoResult, type DeleteTagOptions, type DeleteTagResponse, type DeleteTagResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FileWithMetadata, type FilteredFile, type FindOneOptions, type ForkBaseRepo, type GenericGitBaseRepo, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, type GitCredential, type GitFileMode, type GitHubBaseRepo, GitStorage, type GitStorageOptions, type GrepFileMatch, type GrepLine, type GrepOptions, type GrepResult, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type ListFilesWithMetadataOptions, type ListFilesWithMetadataResponse, type ListFilesWithMetadataResult, type ListReposOptions, type ListReposResponse, type ListReposResult, type ListTagsOptions, type ListTagsResponse, type ListTagsResult, type NoteWriteResponse, type NoteWriteResult, type NoteWriteResultPayload, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PublicGitHubBaseRepoAuth, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawCommitMetadata, type RawFileDiff, type RawFileWithMetadata, type RawFilteredFile, type RawRepoBaseInfo, type RawRepoInfo, type RawTagInfo, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RepoBaseInfo, type RepoInfo, type RepoOptions, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TagInfo, type TextEncoding, type UpdateGitCredentialOptions, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -162,6 +162,25 @@ var createBranchResponseSchema = z.object({
|
|
|
162
162
|
target_is_ephemeral: z.boolean(),
|
|
163
163
|
commit_sha: z.string().nullable().optional()
|
|
164
164
|
});
|
|
165
|
+
var tagInfoSchema = z.object({
|
|
166
|
+
cursor: z.string(),
|
|
167
|
+
name: z.string(),
|
|
168
|
+
sha: z.string()
|
|
169
|
+
});
|
|
170
|
+
var listTagsResponseSchema = z.object({
|
|
171
|
+
tags: z.array(tagInfoSchema),
|
|
172
|
+
next_cursor: z.string().nullable().optional(),
|
|
173
|
+
has_more: z.boolean()
|
|
174
|
+
});
|
|
175
|
+
var createTagResponseSchema = z.object({
|
|
176
|
+
name: z.string(),
|
|
177
|
+
sha: z.string(),
|
|
178
|
+
message: z.string()
|
|
179
|
+
});
|
|
180
|
+
var deleteTagResponseSchema = z.object({
|
|
181
|
+
name: z.string(),
|
|
182
|
+
message: z.string()
|
|
183
|
+
});
|
|
165
184
|
var refUpdateResultSchema = z.object({
|
|
166
185
|
branch: z.string(),
|
|
167
186
|
old_sha: z.string(),
|
|
@@ -524,7 +543,7 @@ function concatChunks(a, b) {
|
|
|
524
543
|
|
|
525
544
|
// package.json
|
|
526
545
|
var package_default = {
|
|
527
|
-
version: "1.
|
|
546
|
+
version: "1.4.0"};
|
|
528
547
|
|
|
529
548
|
// src/version.ts
|
|
530
549
|
var PACKAGE_NAME = "code-storage-sdk";
|
|
@@ -1678,6 +1697,33 @@ function transformCreateBranchResult(raw) {
|
|
|
1678
1697
|
commitSha: raw.commit_sha ?? void 0
|
|
1679
1698
|
};
|
|
1680
1699
|
}
|
|
1700
|
+
function transformTagInfo(raw) {
|
|
1701
|
+
return {
|
|
1702
|
+
cursor: raw.cursor,
|
|
1703
|
+
name: raw.name,
|
|
1704
|
+
sha: raw.sha
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
function transformListTagsResult(raw) {
|
|
1708
|
+
return {
|
|
1709
|
+
tags: raw.tags.map(transformTagInfo),
|
|
1710
|
+
nextCursor: raw.next_cursor ?? void 0,
|
|
1711
|
+
hasMore: raw.has_more
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
function transformCreateTagResult(raw) {
|
|
1715
|
+
return {
|
|
1716
|
+
name: raw.name,
|
|
1717
|
+
sha: raw.sha,
|
|
1718
|
+
message: raw.message
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
function transformDeleteTagResult(raw) {
|
|
1722
|
+
return {
|
|
1723
|
+
name: raw.name,
|
|
1724
|
+
message: raw.message
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1681
1727
|
function transformListReposResult(raw) {
|
|
1682
1728
|
return {
|
|
1683
1729
|
repos: raw.repos.map((repo) => ({
|
|
@@ -1950,6 +1996,31 @@ var RepoImpl = class {
|
|
|
1950
1996
|
next_cursor: raw.next_cursor ?? void 0
|
|
1951
1997
|
});
|
|
1952
1998
|
}
|
|
1999
|
+
async listTags(options) {
|
|
2000
|
+
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
2001
|
+
const jwt = await this.generateJWT(this.id, {
|
|
2002
|
+
permissions: ["git:read"],
|
|
2003
|
+
ttl
|
|
2004
|
+
});
|
|
2005
|
+
const cursor = options?.cursor;
|
|
2006
|
+
const limit = options?.limit;
|
|
2007
|
+
let params;
|
|
2008
|
+
if (typeof cursor === "string" || typeof limit === "number") {
|
|
2009
|
+
params = {};
|
|
2010
|
+
if (typeof cursor === "string") {
|
|
2011
|
+
params.cursor = cursor;
|
|
2012
|
+
}
|
|
2013
|
+
if (typeof limit === "number") {
|
|
2014
|
+
params.limit = limit.toString();
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
const response = await this.api.get({ path: "repos/tags", params }, jwt);
|
|
2018
|
+
const raw = listTagsResponseSchema.parse(await response.json());
|
|
2019
|
+
return transformListTagsResult({
|
|
2020
|
+
...raw,
|
|
2021
|
+
next_cursor: raw.next_cursor ?? void 0
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
1953
2024
|
async listCommits(options) {
|
|
1954
2025
|
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
1955
2026
|
const jwt = await this.generateJWT(this.id, {
|
|
@@ -2282,6 +2353,50 @@ var RepoImpl = class {
|
|
|
2282
2353
|
const raw = createBranchResponseSchema.parse(await response.json());
|
|
2283
2354
|
return transformCreateBranchResult(raw);
|
|
2284
2355
|
}
|
|
2356
|
+
async createTag(options) {
|
|
2357
|
+
const name = options?.name?.trim();
|
|
2358
|
+
if (!name) {
|
|
2359
|
+
throw new Error("createTag name is required");
|
|
2360
|
+
}
|
|
2361
|
+
if (name.startsWith("refs/")) {
|
|
2362
|
+
throw new Error("createTag name must not start with refs/");
|
|
2363
|
+
}
|
|
2364
|
+
const target = options?.target?.trim();
|
|
2365
|
+
if (!target) {
|
|
2366
|
+
throw new Error("createTag target is required");
|
|
2367
|
+
}
|
|
2368
|
+
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
2369
|
+
const jwt = await this.generateJWT(this.id, {
|
|
2370
|
+
permissions: ["git:write"],
|
|
2371
|
+
ttl
|
|
2372
|
+
});
|
|
2373
|
+
const response = await this.api.post(
|
|
2374
|
+
{ path: "repos/tags", body: { name, target } },
|
|
2375
|
+
jwt
|
|
2376
|
+
);
|
|
2377
|
+
const raw = createTagResponseSchema.parse(await response.json());
|
|
2378
|
+
return transformCreateTagResult(raw);
|
|
2379
|
+
}
|
|
2380
|
+
async deleteTag(options) {
|
|
2381
|
+
const name = options?.name?.trim();
|
|
2382
|
+
if (!name) {
|
|
2383
|
+
throw new Error("deleteTag name is required");
|
|
2384
|
+
}
|
|
2385
|
+
if (name.startsWith("refs/")) {
|
|
2386
|
+
throw new Error("deleteTag name must not start with refs/");
|
|
2387
|
+
}
|
|
2388
|
+
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
2389
|
+
const jwt = await this.generateJWT(this.id, {
|
|
2390
|
+
permissions: ["git:read", "git:write"],
|
|
2391
|
+
ttl
|
|
2392
|
+
});
|
|
2393
|
+
const response = await this.api.delete(
|
|
2394
|
+
{ path: "repos/tags", body: { name } },
|
|
2395
|
+
jwt
|
|
2396
|
+
);
|
|
2397
|
+
const raw = deleteTagResponseSchema.parse(await response.json());
|
|
2398
|
+
return transformDeleteTagResult(raw);
|
|
2399
|
+
}
|
|
2285
2400
|
async restoreCommit(options) {
|
|
2286
2401
|
const targetBranch = options?.targetBranch?.trim();
|
|
2287
2402
|
if (!targetBranch) {
|