@pierre/storage 1.1.0 → 1.2.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/dist/index.d.cts CHANGED
@@ -10,6 +10,93 @@ declare const listFilesResponseSchema: z.ZodObject<{
10
10
  ref: string;
11
11
  paths: string[];
12
12
  }>;
13
+ declare const fileWithMetadataRawSchema: z.ZodObject<{
14
+ path: z.ZodString;
15
+ mode: z.ZodString;
16
+ size: z.ZodNumber;
17
+ last_commit_sha: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ path: string;
20
+ mode: string;
21
+ size: number;
22
+ last_commit_sha: string;
23
+ }, {
24
+ path: string;
25
+ mode: string;
26
+ size: number;
27
+ last_commit_sha: string;
28
+ }>;
29
+ declare const commitMetadataRawSchema: z.ZodObject<{
30
+ author: z.ZodString;
31
+ date: z.ZodString;
32
+ message: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ message: string;
35
+ date: string;
36
+ author: string;
37
+ }, {
38
+ message: string;
39
+ date: string;
40
+ author: string;
41
+ }>;
42
+ declare const listFilesWithMetadataResponseSchema: z.ZodObject<{
43
+ files: z.ZodArray<z.ZodObject<{
44
+ path: z.ZodString;
45
+ mode: z.ZodString;
46
+ size: z.ZodNumber;
47
+ last_commit_sha: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ path: string;
50
+ mode: string;
51
+ size: number;
52
+ last_commit_sha: string;
53
+ }, {
54
+ path: string;
55
+ mode: string;
56
+ size: number;
57
+ last_commit_sha: string;
58
+ }>, "many">;
59
+ commits: z.ZodRecord<z.ZodString, z.ZodObject<{
60
+ author: z.ZodString;
61
+ date: z.ZodString;
62
+ message: z.ZodString;
63
+ }, "strip", z.ZodTypeAny, {
64
+ message: string;
65
+ date: string;
66
+ author: string;
67
+ }, {
68
+ message: string;
69
+ date: string;
70
+ author: string;
71
+ }>>;
72
+ ref: z.ZodString;
73
+ }, "strip", z.ZodTypeAny, {
74
+ commits: Record<string, {
75
+ message: string;
76
+ date: string;
77
+ author: string;
78
+ }>;
79
+ files: {
80
+ path: string;
81
+ mode: string;
82
+ size: number;
83
+ last_commit_sha: string;
84
+ }[];
85
+ ref: string;
86
+ }, {
87
+ commits: Record<string, {
88
+ message: string;
89
+ date: string;
90
+ author: string;
91
+ }>;
92
+ files: {
93
+ path: string;
94
+ mode: string;
95
+ size: number;
96
+ last_commit_sha: string;
97
+ }[];
98
+ ref: string;
99
+ }>;
13
100
  declare const branchInfoSchema: z.ZodObject<{
14
101
  cursor: z.ZodString;
15
102
  name: z.ZodString;
@@ -373,14 +460,14 @@ declare const branchDiffResponseSchema: z.ZodObject<{
373
460
  deletions: z.ZodNumber;
374
461
  changes: z.ZodNumber;
375
462
  }, "strip", z.ZodTypeAny, {
463
+ files: number;
376
464
  additions: number;
377
465
  deletions: number;
378
- files: number;
379
466
  changes: number;
380
467
  }, {
468
+ files: number;
381
469
  additions: number;
382
470
  deletions: number;
383
- files: number;
384
471
  changes: number;
385
472
  }>;
386
473
  files: z.ZodArray<z.ZodObject<{
@@ -432,7 +519,6 @@ declare const branchDiffResponseSchema: z.ZodObject<{
432
519
  }>, "many">;
433
520
  }, "strip", z.ZodTypeAny, {
434
521
  branch: string;
435
- base: string;
436
522
  files: {
437
523
  path: string;
438
524
  state: string;
@@ -443,10 +529,11 @@ declare const branchDiffResponseSchema: z.ZodObject<{
443
529
  additions?: number | undefined;
444
530
  deletions?: number | undefined;
445
531
  }[];
532
+ base: string;
446
533
  stats: {
534
+ files: number;
447
535
  additions: number;
448
536
  deletions: number;
449
- files: number;
450
537
  changes: number;
451
538
  };
452
539
  filtered_files: {
@@ -458,7 +545,6 @@ declare const branchDiffResponseSchema: z.ZodObject<{
458
545
  }[];
459
546
  }, {
460
547
  branch: string;
461
- base: string;
462
548
  files: {
463
549
  path: string;
464
550
  state: string;
@@ -469,10 +555,11 @@ declare const branchDiffResponseSchema: z.ZodObject<{
469
555
  additions?: number | undefined;
470
556
  deletions?: number | undefined;
471
557
  }[];
558
+ base: string;
472
559
  stats: {
560
+ files: number;
473
561
  additions: number;
474
562
  deletions: number;
475
- files: number;
476
563
  changes: number;
477
564
  };
478
565
  filtered_files: {
@@ -491,14 +578,14 @@ declare const commitDiffResponseSchema: z.ZodObject<{
491
578
  deletions: z.ZodNumber;
492
579
  changes: z.ZodNumber;
493
580
  }, "strip", z.ZodTypeAny, {
581
+ files: number;
494
582
  additions: number;
495
583
  deletions: number;
496
- files: number;
497
584
  changes: number;
498
585
  }, {
586
+ files: number;
499
587
  additions: number;
500
588
  deletions: number;
501
- files: number;
502
589
  changes: number;
503
590
  }>;
504
591
  files: z.ZodArray<z.ZodObject<{
@@ -561,9 +648,9 @@ declare const commitDiffResponseSchema: z.ZodObject<{
561
648
  deletions?: number | undefined;
562
649
  }[];
563
650
  stats: {
651
+ files: number;
564
652
  additions: number;
565
653
  deletions: number;
566
- files: number;
567
654
  changes: number;
568
655
  };
569
656
  filtered_files: {
@@ -586,9 +673,9 @@ declare const commitDiffResponseSchema: z.ZodObject<{
586
673
  deletions?: number | undefined;
587
674
  }[];
588
675
  stats: {
676
+ files: number;
589
677
  additions: number;
590
678
  deletions: number;
591
- files: number;
592
679
  changes: number;
593
680
  };
594
681
  filtered_files: {
@@ -616,6 +703,9 @@ declare const createBranchResponseSchema: z.ZodObject<{
616
703
  commit_sha?: string | null | undefined;
617
704
  }>;
618
705
  type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
706
+ type RawFileWithMetadata$1 = z.infer<typeof fileWithMetadataRawSchema>;
707
+ type RawCommitMetadata$1 = z.infer<typeof commitMetadataRawSchema>;
708
+ type ListFilesWithMetadataResponseRaw = z.infer<typeof listFilesWithMetadataResponseSchema>;
619
709
  type RawBranchInfo$1 = z.infer<typeof branchInfoSchema>;
620
710
  type ListBranchesResponseRaw = z.infer<typeof listBranchesResponseSchema>;
621
711
  type RawCommitInfo$1 = z.infer<typeof commitInfoRawSchema>;
@@ -660,6 +750,7 @@ interface Repo {
660
750
  getFileStream(options: GetFileOptions): Promise<Response>;
661
751
  getArchiveStream(options?: ArchiveOptions): Promise<Response>;
662
752
  listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
753
+ listFilesWithMetadata(options?: ListFilesWithMetadataOptions): Promise<ListFilesWithMetadataResult>;
663
754
  listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
664
755
  listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
665
756
  getNote(options: GetNoteOptions): Promise<GetNoteResult>;
@@ -777,6 +868,30 @@ interface ListFilesResult {
777
868
  paths: string[];
778
869
  ref: string;
779
870
  }
871
+ interface ListFilesWithMetadataOptions extends GitStorageInvocationOptions {
872
+ ref?: string;
873
+ ephemeral?: boolean;
874
+ }
875
+ type RawFileWithMetadata = RawFileWithMetadata$1;
876
+ interface FileWithMetadata {
877
+ path: string;
878
+ mode: string;
879
+ size: number;
880
+ lastCommitSha: string;
881
+ }
882
+ type RawCommitMetadata = RawCommitMetadata$1;
883
+ interface CommitMetadata {
884
+ author: string;
885
+ date: Date;
886
+ rawDate: string;
887
+ message: string;
888
+ }
889
+ type ListFilesWithMetadataResponse = ListFilesWithMetadataResponseRaw;
890
+ interface ListFilesWithMetadataResult {
891
+ files: FileWithMetadata[];
892
+ commits: Record<string, CommitMetadata>;
893
+ ref: string;
894
+ }
780
895
  interface ListBranchesOptions extends GitStorageInvocationOptions {
781
896
  cursor?: string;
782
897
  limit?: number;
@@ -1271,4 +1386,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
1271
1386
 
1272
1387
  type StorageOptions = GitStorageOptions;
1273
1388
 
1274
- export { ApiError, type AppendNoteOptions, type ArchiveOptions, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, 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 CreateNoteOptions, type CreateRepoOptions, type DeleteNoteOptions, type DeleteRepoOptions, type DeleteRepoResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FilteredFile, type FindOneOptions, type ForkBaseRepo, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, 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 ListReposOptions, type ListReposResponse, type ListReposResult, type NoteWriteResponse, type NoteWriteResult, type NoteWriteResultPayload, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PublicGitHubBaseRepoAuth, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawFileDiff, 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 ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
1389
+ 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 CreateNoteOptions, type CreateRepoOptions, 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 GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, 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 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
@@ -10,6 +10,93 @@ declare const listFilesResponseSchema: z.ZodObject<{
10
10
  ref: string;
11
11
  paths: string[];
12
12
  }>;
13
+ declare const fileWithMetadataRawSchema: z.ZodObject<{
14
+ path: z.ZodString;
15
+ mode: z.ZodString;
16
+ size: z.ZodNumber;
17
+ last_commit_sha: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ path: string;
20
+ mode: string;
21
+ size: number;
22
+ last_commit_sha: string;
23
+ }, {
24
+ path: string;
25
+ mode: string;
26
+ size: number;
27
+ last_commit_sha: string;
28
+ }>;
29
+ declare const commitMetadataRawSchema: z.ZodObject<{
30
+ author: z.ZodString;
31
+ date: z.ZodString;
32
+ message: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ message: string;
35
+ date: string;
36
+ author: string;
37
+ }, {
38
+ message: string;
39
+ date: string;
40
+ author: string;
41
+ }>;
42
+ declare const listFilesWithMetadataResponseSchema: z.ZodObject<{
43
+ files: z.ZodArray<z.ZodObject<{
44
+ path: z.ZodString;
45
+ mode: z.ZodString;
46
+ size: z.ZodNumber;
47
+ last_commit_sha: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ path: string;
50
+ mode: string;
51
+ size: number;
52
+ last_commit_sha: string;
53
+ }, {
54
+ path: string;
55
+ mode: string;
56
+ size: number;
57
+ last_commit_sha: string;
58
+ }>, "many">;
59
+ commits: z.ZodRecord<z.ZodString, z.ZodObject<{
60
+ author: z.ZodString;
61
+ date: z.ZodString;
62
+ message: z.ZodString;
63
+ }, "strip", z.ZodTypeAny, {
64
+ message: string;
65
+ date: string;
66
+ author: string;
67
+ }, {
68
+ message: string;
69
+ date: string;
70
+ author: string;
71
+ }>>;
72
+ ref: z.ZodString;
73
+ }, "strip", z.ZodTypeAny, {
74
+ commits: Record<string, {
75
+ message: string;
76
+ date: string;
77
+ author: string;
78
+ }>;
79
+ files: {
80
+ path: string;
81
+ mode: string;
82
+ size: number;
83
+ last_commit_sha: string;
84
+ }[];
85
+ ref: string;
86
+ }, {
87
+ commits: Record<string, {
88
+ message: string;
89
+ date: string;
90
+ author: string;
91
+ }>;
92
+ files: {
93
+ path: string;
94
+ mode: string;
95
+ size: number;
96
+ last_commit_sha: string;
97
+ }[];
98
+ ref: string;
99
+ }>;
13
100
  declare const branchInfoSchema: z.ZodObject<{
14
101
  cursor: z.ZodString;
15
102
  name: z.ZodString;
@@ -373,14 +460,14 @@ declare const branchDiffResponseSchema: z.ZodObject<{
373
460
  deletions: z.ZodNumber;
374
461
  changes: z.ZodNumber;
375
462
  }, "strip", z.ZodTypeAny, {
463
+ files: number;
376
464
  additions: number;
377
465
  deletions: number;
378
- files: number;
379
466
  changes: number;
380
467
  }, {
468
+ files: number;
381
469
  additions: number;
382
470
  deletions: number;
383
- files: number;
384
471
  changes: number;
385
472
  }>;
386
473
  files: z.ZodArray<z.ZodObject<{
@@ -432,7 +519,6 @@ declare const branchDiffResponseSchema: z.ZodObject<{
432
519
  }>, "many">;
433
520
  }, "strip", z.ZodTypeAny, {
434
521
  branch: string;
435
- base: string;
436
522
  files: {
437
523
  path: string;
438
524
  state: string;
@@ -443,10 +529,11 @@ declare const branchDiffResponseSchema: z.ZodObject<{
443
529
  additions?: number | undefined;
444
530
  deletions?: number | undefined;
445
531
  }[];
532
+ base: string;
446
533
  stats: {
534
+ files: number;
447
535
  additions: number;
448
536
  deletions: number;
449
- files: number;
450
537
  changes: number;
451
538
  };
452
539
  filtered_files: {
@@ -458,7 +545,6 @@ declare const branchDiffResponseSchema: z.ZodObject<{
458
545
  }[];
459
546
  }, {
460
547
  branch: string;
461
- base: string;
462
548
  files: {
463
549
  path: string;
464
550
  state: string;
@@ -469,10 +555,11 @@ declare const branchDiffResponseSchema: z.ZodObject<{
469
555
  additions?: number | undefined;
470
556
  deletions?: number | undefined;
471
557
  }[];
558
+ base: string;
472
559
  stats: {
560
+ files: number;
473
561
  additions: number;
474
562
  deletions: number;
475
- files: number;
476
563
  changes: number;
477
564
  };
478
565
  filtered_files: {
@@ -491,14 +578,14 @@ declare const commitDiffResponseSchema: z.ZodObject<{
491
578
  deletions: z.ZodNumber;
492
579
  changes: z.ZodNumber;
493
580
  }, "strip", z.ZodTypeAny, {
581
+ files: number;
494
582
  additions: number;
495
583
  deletions: number;
496
- files: number;
497
584
  changes: number;
498
585
  }, {
586
+ files: number;
499
587
  additions: number;
500
588
  deletions: number;
501
- files: number;
502
589
  changes: number;
503
590
  }>;
504
591
  files: z.ZodArray<z.ZodObject<{
@@ -561,9 +648,9 @@ declare const commitDiffResponseSchema: z.ZodObject<{
561
648
  deletions?: number | undefined;
562
649
  }[];
563
650
  stats: {
651
+ files: number;
564
652
  additions: number;
565
653
  deletions: number;
566
- files: number;
567
654
  changes: number;
568
655
  };
569
656
  filtered_files: {
@@ -586,9 +673,9 @@ declare const commitDiffResponseSchema: z.ZodObject<{
586
673
  deletions?: number | undefined;
587
674
  }[];
588
675
  stats: {
676
+ files: number;
589
677
  additions: number;
590
678
  deletions: number;
591
- files: number;
592
679
  changes: number;
593
680
  };
594
681
  filtered_files: {
@@ -616,6 +703,9 @@ declare const createBranchResponseSchema: z.ZodObject<{
616
703
  commit_sha?: string | null | undefined;
617
704
  }>;
618
705
  type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
706
+ type RawFileWithMetadata$1 = z.infer<typeof fileWithMetadataRawSchema>;
707
+ type RawCommitMetadata$1 = z.infer<typeof commitMetadataRawSchema>;
708
+ type ListFilesWithMetadataResponseRaw = z.infer<typeof listFilesWithMetadataResponseSchema>;
619
709
  type RawBranchInfo$1 = z.infer<typeof branchInfoSchema>;
620
710
  type ListBranchesResponseRaw = z.infer<typeof listBranchesResponseSchema>;
621
711
  type RawCommitInfo$1 = z.infer<typeof commitInfoRawSchema>;
@@ -660,6 +750,7 @@ interface Repo {
660
750
  getFileStream(options: GetFileOptions): Promise<Response>;
661
751
  getArchiveStream(options?: ArchiveOptions): Promise<Response>;
662
752
  listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
753
+ listFilesWithMetadata(options?: ListFilesWithMetadataOptions): Promise<ListFilesWithMetadataResult>;
663
754
  listBranches(options?: ListBranchesOptions): Promise<ListBranchesResult>;
664
755
  listCommits(options?: ListCommitsOptions): Promise<ListCommitsResult>;
665
756
  getNote(options: GetNoteOptions): Promise<GetNoteResult>;
@@ -777,6 +868,30 @@ interface ListFilesResult {
777
868
  paths: string[];
778
869
  ref: string;
779
870
  }
871
+ interface ListFilesWithMetadataOptions extends GitStorageInvocationOptions {
872
+ ref?: string;
873
+ ephemeral?: boolean;
874
+ }
875
+ type RawFileWithMetadata = RawFileWithMetadata$1;
876
+ interface FileWithMetadata {
877
+ path: string;
878
+ mode: string;
879
+ size: number;
880
+ lastCommitSha: string;
881
+ }
882
+ type RawCommitMetadata = RawCommitMetadata$1;
883
+ interface CommitMetadata {
884
+ author: string;
885
+ date: Date;
886
+ rawDate: string;
887
+ message: string;
888
+ }
889
+ type ListFilesWithMetadataResponse = ListFilesWithMetadataResponseRaw;
890
+ interface ListFilesWithMetadataResult {
891
+ files: FileWithMetadata[];
892
+ commits: Record<string, CommitMetadata>;
893
+ ref: string;
894
+ }
780
895
  interface ListBranchesOptions extends GitStorageInvocationOptions {
781
896
  cursor?: string;
782
897
  limit?: number;
@@ -1271,4 +1386,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
1271
1386
 
1272
1387
  type StorageOptions = GitStorageOptions;
1273
1388
 
1274
- export { ApiError, type AppendNoteOptions, type ArchiveOptions, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, 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 CreateNoteOptions, type CreateRepoOptions, type DeleteNoteOptions, type DeleteRepoOptions, type DeleteRepoResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FilteredFile, type FindOneOptions, type ForkBaseRepo, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, 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 ListReposOptions, type ListReposResponse, type ListReposResult, type NoteWriteResponse, type NoteWriteResult, type NoteWriteResultPayload, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PublicGitHubBaseRepoAuth, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawFileDiff, 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 ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
1389
+ 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 CreateNoteOptions, type CreateRepoOptions, 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 GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, 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 ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
package/dist/index.js CHANGED
@@ -45,6 +45,22 @@ var listFilesResponseSchema = z.object({
45
45
  paths: z.array(z.string()),
46
46
  ref: z.string()
47
47
  });
48
+ var fileWithMetadataRawSchema = z.object({
49
+ path: z.string(),
50
+ mode: z.string(),
51
+ size: z.number(),
52
+ last_commit_sha: z.string()
53
+ });
54
+ var commitMetadataRawSchema = z.object({
55
+ author: z.string(),
56
+ date: z.string(),
57
+ message: z.string()
58
+ });
59
+ var listFilesWithMetadataResponseSchema = z.object({
60
+ files: z.array(fileWithMetadataRawSchema),
61
+ commits: z.record(commitMetadataRawSchema),
62
+ ref: z.string()
63
+ });
48
64
  var branchInfoSchema = z.object({
49
65
  cursor: z.string(),
50
66
  name: z.string(),
@@ -508,7 +524,7 @@ function concatChunks(a, b) {
508
524
 
509
525
  // package.json
510
526
  var package_default = {
511
- version: "1.1.0"};
527
+ version: "1.2.0"};
512
528
 
513
529
  // src/version.ts
514
530
  var PACKAGE_NAME = "code-storage-sdk";
@@ -1561,6 +1577,33 @@ function transformListCommitsResult(raw) {
1561
1577
  hasMore: raw.has_more
1562
1578
  };
1563
1579
  }
1580
+ function transformFileWithMetadata(raw) {
1581
+ return {
1582
+ path: raw.path,
1583
+ mode: raw.mode,
1584
+ size: raw.size,
1585
+ lastCommitSha: raw.last_commit_sha
1586
+ };
1587
+ }
1588
+ function transformCommitMetadata(raw) {
1589
+ return {
1590
+ author: raw.author,
1591
+ date: new Date(raw.date),
1592
+ rawDate: raw.date,
1593
+ message: raw.message
1594
+ };
1595
+ }
1596
+ function transformListFilesWithMetadataResult(raw) {
1597
+ const commits = {};
1598
+ for (const [sha, commit] of Object.entries(raw.commits)) {
1599
+ commits[sha] = transformCommitMetadata(commit);
1600
+ }
1601
+ return {
1602
+ files: raw.files.map(transformFileWithMetadata),
1603
+ commits,
1604
+ ref: raw.ref
1605
+ };
1606
+ }
1564
1607
  function normalizeDiffState(rawState) {
1565
1608
  if (!rawState) {
1566
1609
  return "unknown";
@@ -1845,6 +1888,29 @@ var RepoImpl = class {
1845
1888
  const raw = listFilesResponseSchema.parse(await response.json());
1846
1889
  return { paths: raw.paths, ref: raw.ref };
1847
1890
  }
1891
+ async listFilesWithMetadata(options) {
1892
+ const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
1893
+ const jwt = await this.generateJWT(this.id, {
1894
+ permissions: ["git:read"],
1895
+ ttl
1896
+ });
1897
+ const params = {};
1898
+ if (options?.ref) {
1899
+ params.ref = options.ref;
1900
+ }
1901
+ if (typeof options?.ephemeral === "boolean") {
1902
+ params.ephemeral = String(options.ephemeral);
1903
+ }
1904
+ const response = await this.api.get(
1905
+ {
1906
+ path: "repos/files/metadata",
1907
+ params: Object.keys(params).length ? params : void 0
1908
+ },
1909
+ jwt
1910
+ );
1911
+ const raw = listFilesWithMetadataResponseSchema.parse(await response.json());
1912
+ return transformListFilesWithMetadataResult(raw);
1913
+ }
1848
1914
  async listBranches(options) {
1849
1915
  const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
1850
1916
  const jwt = await this.generateJWT(this.id, {