@pierre/storage 1.3.2 → 1.4.1
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 +122 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -1
- package/dist/index.d.ts +117 -1
- package/dist/index.js +122 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +127 -0
- package/src/schemas.ts +27 -0
- package/src/types.ts +61 -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
|
|
@@ -737,9 +810,15 @@ interface GitStorageOptions extends OverrideableGitStorageOptions {
|
|
|
737
810
|
defaultTTL?: number;
|
|
738
811
|
}
|
|
739
812
|
type ValidAPIVersion = 1;
|
|
813
|
+
/** A policy operation included in the JWT. */
|
|
814
|
+
type Op = string;
|
|
815
|
+
declare const OP_NO_FORCE_PUSH: Op;
|
|
816
|
+
/** A list of policy operations. */
|
|
817
|
+
type Ops = Op[];
|
|
740
818
|
interface GetRemoteURLOptions {
|
|
741
819
|
permissions?: ('git:write' | 'git:read' | 'repo:write' | 'org:read')[];
|
|
742
820
|
ttl?: number;
|
|
821
|
+
ops?: Ops;
|
|
743
822
|
}
|
|
744
823
|
interface Repo {
|
|
745
824
|
id: string;
|
|
@@ -753,7 +832,10 @@ interface Repo {
|
|
|
753
832
|
listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
|
|
754
833
|
listFilesWithMetadata(options?: ListFilesWithMetadataOptions): Promise<ListFilesWithMetadataResult>;
|
|
755
834
|
listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
|
|
835
|
+
listTags(options?: ListTagsOptions): Promise<ListTagsResult>;
|
|
756
836
|
listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
|
|
837
|
+
createTag(options: CreateTagOptions): Promise<CreateTagResult>;
|
|
838
|
+
deleteTag(options: DeleteTagOptions): Promise<DeleteTagResult>;
|
|
757
839
|
getNote(options: GetNoteOptions): Promise<GetNoteResult>;
|
|
758
840
|
createNote(options: CreateNoteOptions): Promise<NoteWriteResult>;
|
|
759
841
|
appendNote(options: AppendNoteOptions): Promise<NoteWriteResult>;
|
|
@@ -958,6 +1040,40 @@ interface CreateBranchResult {
|
|
|
958
1040
|
targetIsEphemeral: boolean;
|
|
959
1041
|
commitSha?: string;
|
|
960
1042
|
}
|
|
1043
|
+
interface ListTagsOptions extends GitStorageInvocationOptions {
|
|
1044
|
+
cursor?: string;
|
|
1045
|
+
limit?: number;
|
|
1046
|
+
}
|
|
1047
|
+
type RawTagInfo = RawTagInfo$1;
|
|
1048
|
+
interface TagInfo {
|
|
1049
|
+
cursor: string;
|
|
1050
|
+
name: string;
|
|
1051
|
+
sha: string;
|
|
1052
|
+
}
|
|
1053
|
+
type ListTagsResponse = ListTagsResponseRaw;
|
|
1054
|
+
interface ListTagsResult {
|
|
1055
|
+
tags: TagInfo[];
|
|
1056
|
+
nextCursor?: string;
|
|
1057
|
+
hasMore: boolean;
|
|
1058
|
+
}
|
|
1059
|
+
interface CreateTagOptions extends GitStorageInvocationOptions {
|
|
1060
|
+
name: string;
|
|
1061
|
+
target: string;
|
|
1062
|
+
}
|
|
1063
|
+
type CreateTagResponse = CreateTagResponseRaw;
|
|
1064
|
+
interface CreateTagResult {
|
|
1065
|
+
name: string;
|
|
1066
|
+
sha: string;
|
|
1067
|
+
message: string;
|
|
1068
|
+
}
|
|
1069
|
+
interface DeleteTagOptions extends GitStorageInvocationOptions {
|
|
1070
|
+
name: string;
|
|
1071
|
+
}
|
|
1072
|
+
type DeleteTagResponse = DeleteTagResponseRaw;
|
|
1073
|
+
interface DeleteTagResult {
|
|
1074
|
+
name: string;
|
|
1075
|
+
message: string;
|
|
1076
|
+
}
|
|
961
1077
|
interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
962
1078
|
branch?: string;
|
|
963
1079
|
cursor?: string;
|
|
@@ -1435,4 +1551,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
|
|
|
1435
1551
|
|
|
1436
1552
|
type StorageOptions = GitStorageOptions;
|
|
1437
1553
|
|
|
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 };
|
|
1554
|
+
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, OP_NO_FORCE_PUSH, type Op, type Ops, 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
|
|
@@ -737,9 +810,15 @@ interface GitStorageOptions extends OverrideableGitStorageOptions {
|
|
|
737
810
|
defaultTTL?: number;
|
|
738
811
|
}
|
|
739
812
|
type ValidAPIVersion = 1;
|
|
813
|
+
/** A policy operation included in the JWT. */
|
|
814
|
+
type Op = string;
|
|
815
|
+
declare const OP_NO_FORCE_PUSH: Op;
|
|
816
|
+
/** A list of policy operations. */
|
|
817
|
+
type Ops = Op[];
|
|
740
818
|
interface GetRemoteURLOptions {
|
|
741
819
|
permissions?: ('git:write' | 'git:read' | 'repo:write' | 'org:read')[];
|
|
742
820
|
ttl?: number;
|
|
821
|
+
ops?: Ops;
|
|
743
822
|
}
|
|
744
823
|
interface Repo {
|
|
745
824
|
id: string;
|
|
@@ -753,7 +832,10 @@ interface Repo {
|
|
|
753
832
|
listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
|
|
754
833
|
listFilesWithMetadata(options?: ListFilesWithMetadataOptions): Promise<ListFilesWithMetadataResult>;
|
|
755
834
|
listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
|
|
835
|
+
listTags(options?: ListTagsOptions): Promise<ListTagsResult>;
|
|
756
836
|
listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
|
|
837
|
+
createTag(options: CreateTagOptions): Promise<CreateTagResult>;
|
|
838
|
+
deleteTag(options: DeleteTagOptions): Promise<DeleteTagResult>;
|
|
757
839
|
getNote(options: GetNoteOptions): Promise<GetNoteResult>;
|
|
758
840
|
createNote(options: CreateNoteOptions): Promise<NoteWriteResult>;
|
|
759
841
|
appendNote(options: AppendNoteOptions): Promise<NoteWriteResult>;
|
|
@@ -958,6 +1040,40 @@ interface CreateBranchResult {
|
|
|
958
1040
|
targetIsEphemeral: boolean;
|
|
959
1041
|
commitSha?: string;
|
|
960
1042
|
}
|
|
1043
|
+
interface ListTagsOptions extends GitStorageInvocationOptions {
|
|
1044
|
+
cursor?: string;
|
|
1045
|
+
limit?: number;
|
|
1046
|
+
}
|
|
1047
|
+
type RawTagInfo = RawTagInfo$1;
|
|
1048
|
+
interface TagInfo {
|
|
1049
|
+
cursor: string;
|
|
1050
|
+
name: string;
|
|
1051
|
+
sha: string;
|
|
1052
|
+
}
|
|
1053
|
+
type ListTagsResponse = ListTagsResponseRaw;
|
|
1054
|
+
interface ListTagsResult {
|
|
1055
|
+
tags: TagInfo[];
|
|
1056
|
+
nextCursor?: string;
|
|
1057
|
+
hasMore: boolean;
|
|
1058
|
+
}
|
|
1059
|
+
interface CreateTagOptions extends GitStorageInvocationOptions {
|
|
1060
|
+
name: string;
|
|
1061
|
+
target: string;
|
|
1062
|
+
}
|
|
1063
|
+
type CreateTagResponse = CreateTagResponseRaw;
|
|
1064
|
+
interface CreateTagResult {
|
|
1065
|
+
name: string;
|
|
1066
|
+
sha: string;
|
|
1067
|
+
message: string;
|
|
1068
|
+
}
|
|
1069
|
+
interface DeleteTagOptions extends GitStorageInvocationOptions {
|
|
1070
|
+
name: string;
|
|
1071
|
+
}
|
|
1072
|
+
type DeleteTagResponse = DeleteTagResponseRaw;
|
|
1073
|
+
interface DeleteTagResult {
|
|
1074
|
+
name: string;
|
|
1075
|
+
message: string;
|
|
1076
|
+
}
|
|
961
1077
|
interface ListCommitsOptions extends GitStorageInvocationOptions {
|
|
962
1078
|
branch?: string;
|
|
963
1079
|
cursor?: string;
|
|
@@ -1435,4 +1551,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
|
|
|
1435
1551
|
|
|
1436
1552
|
type StorageOptions = GitStorageOptions;
|
|
1437
1553
|
|
|
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 };
|
|
1554
|
+
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, OP_NO_FORCE_PUSH, type Op, type Ops, 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.1"};
|
|
528
547
|
|
|
529
548
|
// src/version.ts
|
|
530
549
|
var PACKAGE_NAME = "code-storage-sdk";
|
|
@@ -1162,6 +1181,9 @@ var ApiFetcher = class {
|
|
|
1162
1181
|
}
|
|
1163
1182
|
};
|
|
1164
1183
|
|
|
1184
|
+
// src/types.ts
|
|
1185
|
+
var OP_NO_FORCE_PUSH = "no-force-push";
|
|
1186
|
+
|
|
1165
1187
|
// src/util.ts
|
|
1166
1188
|
function timingSafeEqual(a, b) {
|
|
1167
1189
|
const bufferA = typeof a === "string" ? new TextEncoder().encode(a) : a;
|
|
@@ -1678,6 +1700,33 @@ function transformCreateBranchResult(raw) {
|
|
|
1678
1700
|
commitSha: raw.commit_sha ?? void 0
|
|
1679
1701
|
};
|
|
1680
1702
|
}
|
|
1703
|
+
function transformTagInfo(raw) {
|
|
1704
|
+
return {
|
|
1705
|
+
cursor: raw.cursor,
|
|
1706
|
+
name: raw.name,
|
|
1707
|
+
sha: raw.sha
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
function transformListTagsResult(raw) {
|
|
1711
|
+
return {
|
|
1712
|
+
tags: raw.tags.map(transformTagInfo),
|
|
1713
|
+
nextCursor: raw.next_cursor ?? void 0,
|
|
1714
|
+
hasMore: raw.has_more
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
function transformCreateTagResult(raw) {
|
|
1718
|
+
return {
|
|
1719
|
+
name: raw.name,
|
|
1720
|
+
sha: raw.sha,
|
|
1721
|
+
message: raw.message
|
|
1722
|
+
};
|
|
1723
|
+
}
|
|
1724
|
+
function transformDeleteTagResult(raw) {
|
|
1725
|
+
return {
|
|
1726
|
+
name: raw.name,
|
|
1727
|
+
message: raw.message
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1681
1730
|
function transformListReposResult(raw) {
|
|
1682
1731
|
return {
|
|
1683
1732
|
repos: raw.repos.map((repo) => ({
|
|
@@ -1950,6 +1999,31 @@ var RepoImpl = class {
|
|
|
1950
1999
|
next_cursor: raw.next_cursor ?? void 0
|
|
1951
2000
|
});
|
|
1952
2001
|
}
|
|
2002
|
+
async listTags(options) {
|
|
2003
|
+
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
2004
|
+
const jwt = await this.generateJWT(this.id, {
|
|
2005
|
+
permissions: ["git:read"],
|
|
2006
|
+
ttl
|
|
2007
|
+
});
|
|
2008
|
+
const cursor = options?.cursor;
|
|
2009
|
+
const limit = options?.limit;
|
|
2010
|
+
let params;
|
|
2011
|
+
if (typeof cursor === "string" || typeof limit === "number") {
|
|
2012
|
+
params = {};
|
|
2013
|
+
if (typeof cursor === "string") {
|
|
2014
|
+
params.cursor = cursor;
|
|
2015
|
+
}
|
|
2016
|
+
if (typeof limit === "number") {
|
|
2017
|
+
params.limit = limit.toString();
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
const response = await this.api.get({ path: "repos/tags", params }, jwt);
|
|
2021
|
+
const raw = listTagsResponseSchema.parse(await response.json());
|
|
2022
|
+
return transformListTagsResult({
|
|
2023
|
+
...raw,
|
|
2024
|
+
next_cursor: raw.next_cursor ?? void 0
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
1953
2027
|
async listCommits(options) {
|
|
1954
2028
|
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
1955
2029
|
const jwt = await this.generateJWT(this.id, {
|
|
@@ -2282,6 +2356,50 @@ var RepoImpl = class {
|
|
|
2282
2356
|
const raw = createBranchResponseSchema.parse(await response.json());
|
|
2283
2357
|
return transformCreateBranchResult(raw);
|
|
2284
2358
|
}
|
|
2359
|
+
async createTag(options) {
|
|
2360
|
+
const name = options?.name?.trim();
|
|
2361
|
+
if (!name) {
|
|
2362
|
+
throw new Error("createTag name is required");
|
|
2363
|
+
}
|
|
2364
|
+
if (name.startsWith("refs/")) {
|
|
2365
|
+
throw new Error("createTag name must not start with refs/");
|
|
2366
|
+
}
|
|
2367
|
+
const target = options?.target?.trim();
|
|
2368
|
+
if (!target) {
|
|
2369
|
+
throw new Error("createTag target is required");
|
|
2370
|
+
}
|
|
2371
|
+
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
2372
|
+
const jwt = await this.generateJWT(this.id, {
|
|
2373
|
+
permissions: ["git:write"],
|
|
2374
|
+
ttl
|
|
2375
|
+
});
|
|
2376
|
+
const response = await this.api.post(
|
|
2377
|
+
{ path: "repos/tags", body: { name, target } },
|
|
2378
|
+
jwt
|
|
2379
|
+
);
|
|
2380
|
+
const raw = createTagResponseSchema.parse(await response.json());
|
|
2381
|
+
return transformCreateTagResult(raw);
|
|
2382
|
+
}
|
|
2383
|
+
async deleteTag(options) {
|
|
2384
|
+
const name = options?.name?.trim();
|
|
2385
|
+
if (!name) {
|
|
2386
|
+
throw new Error("deleteTag name is required");
|
|
2387
|
+
}
|
|
2388
|
+
if (name.startsWith("refs/")) {
|
|
2389
|
+
throw new Error("deleteTag name must not start with refs/");
|
|
2390
|
+
}
|
|
2391
|
+
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
2392
|
+
const jwt = await this.generateJWT(this.id, {
|
|
2393
|
+
permissions: ["git:read", "git:write"],
|
|
2394
|
+
ttl
|
|
2395
|
+
});
|
|
2396
|
+
const response = await this.api.delete(
|
|
2397
|
+
{ path: "repos/tags", body: { name } },
|
|
2398
|
+
jwt
|
|
2399
|
+
);
|
|
2400
|
+
const raw = deleteTagResponseSchema.parse(await response.json());
|
|
2401
|
+
return transformDeleteTagResult(raw);
|
|
2402
|
+
}
|
|
2285
2403
|
async restoreCommit(options) {
|
|
2286
2404
|
const targetBranch = options?.targetBranch?.trim();
|
|
2287
2405
|
if (!targetBranch) {
|
|
@@ -2690,7 +2808,8 @@ var GitStorage = class _GitStorage {
|
|
|
2690
2808
|
repo: repoId,
|
|
2691
2809
|
scopes: permissions,
|
|
2692
2810
|
iat: now,
|
|
2693
|
-
exp: now + ttl
|
|
2811
|
+
exp: now + ttl,
|
|
2812
|
+
...options?.ops && options.ops.length > 0 ? { ops: options.ops } : {}
|
|
2694
2813
|
};
|
|
2695
2814
|
const key = await importPKCS8(this.options.key, "ES256");
|
|
2696
2815
|
const jwt = await new SignJWT(payload).setProtectedHeader({ alg: "ES256", typ: "JWT" }).sign(key);
|
|
@@ -2701,6 +2820,6 @@ function createClient(options) {
|
|
|
2701
2820
|
return new GitStorage(options);
|
|
2702
2821
|
}
|
|
2703
2822
|
|
|
2704
|
-
export { ApiError, GitStorage as CodeStorage, GitStorage, RefUpdateError, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
|
2823
|
+
export { ApiError, GitStorage as CodeStorage, GitStorage, OP_NO_FORCE_PUSH, RefUpdateError, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
|
2705
2824
|
//# sourceMappingURL=index.js.map
|
|
2706
2825
|
//# sourceMappingURL=index.js.map
|