@pierre/storage 0.9.2 → 1.0.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/src/schemas.ts CHANGED
@@ -1,205 +1,209 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  export const listFilesResponseSchema = z.object({
4
- paths: z.array(z.string()),
5
- ref: z.string(),
4
+ paths: z.array(z.string()),
5
+ ref: z.string(),
6
6
  });
7
7
 
8
8
  export const branchInfoSchema = z.object({
9
- cursor: z.string(),
10
- name: z.string(),
11
- head_sha: z.string(),
12
- created_at: z.string(),
9
+ cursor: z.string(),
10
+ name: z.string(),
11
+ head_sha: z.string(),
12
+ created_at: z.string(),
13
13
  });
14
14
 
15
15
  export const listBranchesResponseSchema = z.object({
16
- branches: z.array(branchInfoSchema),
17
- next_cursor: z.string().nullable().optional(),
18
- has_more: z.boolean(),
16
+ branches: z.array(branchInfoSchema),
17
+ next_cursor: z.string().nullable().optional(),
18
+ has_more: z.boolean(),
19
19
  });
20
20
 
21
21
  export const commitInfoRawSchema = z.object({
22
- sha: z.string(),
23
- message: z.string(),
24
- author_name: z.string(),
25
- author_email: z.string(),
26
- committer_name: z.string(),
27
- committer_email: z.string(),
28
- date: z.string(),
22
+ sha: z.string(),
23
+ message: z.string(),
24
+ author_name: z.string(),
25
+ author_email: z.string(),
26
+ committer_name: z.string(),
27
+ committer_email: z.string(),
28
+ date: z.string(),
29
29
  });
30
30
 
31
31
  export const listCommitsResponseSchema = z.object({
32
- commits: z.array(commitInfoRawSchema),
33
- next_cursor: z.string().nullable().optional(),
34
- has_more: z.boolean(),
32
+ commits: z.array(commitInfoRawSchema),
33
+ next_cursor: z.string().nullable().optional(),
34
+ has_more: z.boolean(),
35
35
  });
36
36
 
37
37
  export const repoBaseInfoSchema = z.object({
38
- provider: z.string(),
39
- owner: z.string(),
40
- name: z.string(),
38
+ provider: z.string(),
39
+ owner: z.string(),
40
+ name: z.string(),
41
41
  });
42
42
 
43
43
  export const repoInfoSchema = z.object({
44
- repo_id: z.string(),
45
- url: z.string(),
46
- default_branch: z.string(),
47
- created_at: z.string(),
48
- base_repo: repoBaseInfoSchema.optional().nullable(),
44
+ repo_id: z.string(),
45
+ url: z.string(),
46
+ default_branch: z.string(),
47
+ created_at: z.string(),
48
+ base_repo: repoBaseInfoSchema.optional().nullable(),
49
49
  });
50
50
 
51
51
  export const listReposResponseSchema = z.object({
52
- repos: z.array(repoInfoSchema),
53
- next_cursor: z.string().nullable().optional(),
54
- has_more: z.boolean(),
52
+ repos: z.array(repoInfoSchema),
53
+ next_cursor: z.string().nullable().optional(),
54
+ has_more: z.boolean(),
55
55
  });
56
56
 
57
57
  export const noteReadResponseSchema = z.object({
58
- sha: z.string(),
59
- note: z.string(),
60
- ref_sha: z.string(),
58
+ sha: z.string(),
59
+ note: z.string(),
60
+ ref_sha: z.string(),
61
61
  });
62
62
 
63
63
  export const noteResultSchema = z.object({
64
- success: z.boolean(),
65
- status: z.string(),
66
- message: z.string().optional(),
64
+ success: z.boolean(),
65
+ status: z.string(),
66
+ message: z.string().optional(),
67
67
  });
68
68
 
69
69
  export const noteWriteResponseSchema = z.object({
70
- sha: z.string(),
71
- target_ref: z.string(),
72
- base_commit: z.string().optional(),
73
- new_ref_sha: z.string(),
74
- result: noteResultSchema,
70
+ sha: z.string(),
71
+ target_ref: z.string(),
72
+ base_commit: z.string().optional(),
73
+ new_ref_sha: z.string(),
74
+ result: noteResultSchema,
75
75
  });
76
76
 
77
77
  export const diffStatsSchema = z.object({
78
- files: z.number(),
79
- additions: z.number(),
80
- deletions: z.number(),
81
- changes: z.number(),
78
+ files: z.number(),
79
+ additions: z.number(),
80
+ deletions: z.number(),
81
+ changes: z.number(),
82
82
  });
83
83
 
84
84
  export const diffFileRawSchema = z.object({
85
- path: z.string(),
86
- state: z.string(),
87
- old_path: z.string().nullable().optional(),
88
- raw: z.string(),
89
- bytes: z.number(),
90
- is_eof: z.boolean(),
85
+ path: z.string(),
86
+ state: z.string(),
87
+ old_path: z.string().nullable().optional(),
88
+ raw: z.string(),
89
+ bytes: z.number(),
90
+ is_eof: z.boolean(),
91
91
  });
92
92
 
93
93
  export const filteredFileRawSchema = z.object({
94
- path: z.string(),
95
- state: z.string(),
96
- old_path: z.string().nullable().optional(),
97
- bytes: z.number(),
98
- is_eof: z.boolean(),
94
+ path: z.string(),
95
+ state: z.string(),
96
+ old_path: z.string().nullable().optional(),
97
+ bytes: z.number(),
98
+ is_eof: z.boolean(),
99
99
  });
100
100
 
101
101
  export const branchDiffResponseSchema = z.object({
102
- branch: z.string(),
103
- base: z.string(),
104
- stats: diffStatsSchema,
105
- files: z.array(diffFileRawSchema),
106
- filtered_files: z.array(filteredFileRawSchema),
102
+ branch: z.string(),
103
+ base: z.string(),
104
+ stats: diffStatsSchema,
105
+ files: z.array(diffFileRawSchema),
106
+ filtered_files: z.array(filteredFileRawSchema),
107
107
  });
108
108
 
109
109
  export const commitDiffResponseSchema = z.object({
110
- sha: z.string(),
111
- stats: diffStatsSchema,
112
- files: z.array(diffFileRawSchema),
113
- filtered_files: z.array(filteredFileRawSchema),
110
+ sha: z.string(),
111
+ stats: diffStatsSchema,
112
+ files: z.array(diffFileRawSchema),
113
+ filtered_files: z.array(filteredFileRawSchema),
114
114
  });
115
115
 
116
116
  export const createBranchResponseSchema = z.object({
117
- message: z.string(),
118
- target_branch: z.string(),
119
- target_is_ephemeral: z.boolean(),
120
- commit_sha: z.string().nullable().optional(),
117
+ message: z.string(),
118
+ target_branch: z.string(),
119
+ target_is_ephemeral: z.boolean(),
120
+ commit_sha: z.string().nullable().optional(),
121
121
  });
122
122
 
123
123
  export const refUpdateResultSchema = z.object({
124
- branch: z.string(),
125
- old_sha: z.string(),
126
- new_sha: z.string(),
127
- success: z.boolean(),
128
- status: z.string(),
129
- message: z.string().optional(),
124
+ branch: z.string(),
125
+ old_sha: z.string(),
126
+ new_sha: z.string(),
127
+ success: z.boolean(),
128
+ status: z.string(),
129
+ message: z.string().optional(),
130
130
  });
131
131
 
132
132
  export const commitPackCommitSchema = z.object({
133
- commit_sha: z.string(),
134
- tree_sha: z.string(),
135
- target_branch: z.string(),
136
- pack_bytes: z.number(),
137
- blob_count: z.number(),
133
+ commit_sha: z.string(),
134
+ tree_sha: z.string(),
135
+ target_branch: z.string(),
136
+ pack_bytes: z.number(),
137
+ blob_count: z.number(),
138
138
  });
139
139
 
140
- export const restoreCommitCommitSchema = commitPackCommitSchema.omit({ blob_count: true });
140
+ export const restoreCommitCommitSchema = commitPackCommitSchema.omit({
141
+ blob_count: true,
142
+ });
141
143
 
142
144
  export const refUpdateResultWithOptionalsSchema = z.object({
143
- branch: z.string().optional(),
144
- old_sha: z.string().optional(),
145
- new_sha: z.string().optional(),
146
- success: z.boolean().optional(),
147
- status: z.string(),
148
- message: z.string().optional(),
145
+ branch: z.string().optional(),
146
+ old_sha: z.string().optional(),
147
+ new_sha: z.string().optional(),
148
+ success: z.boolean().optional(),
149
+ status: z.string(),
150
+ message: z.string().optional(),
149
151
  });
150
152
 
151
153
  export const commitPackAckSchema = z.object({
152
- commit: commitPackCommitSchema,
153
- result: refUpdateResultSchema,
154
+ commit: commitPackCommitSchema,
155
+ result: refUpdateResultSchema,
154
156
  });
155
157
 
156
158
  export const restoreCommitAckSchema = z.object({
157
- commit: restoreCommitCommitSchema,
158
- result: refUpdateResultSchema.extend({ success: z.literal(true) }),
159
+ commit: restoreCommitCommitSchema,
160
+ result: refUpdateResultSchema.extend({ success: z.literal(true) }),
159
161
  });
160
162
 
161
163
  export const commitPackResponseSchema = z.object({
162
- commit: commitPackCommitSchema.partial().optional().nullable(),
163
- result: refUpdateResultWithOptionalsSchema,
164
+ commit: commitPackCommitSchema.partial().optional().nullable(),
165
+ result: refUpdateResultWithOptionalsSchema,
164
166
  });
165
167
 
166
168
  export const restoreCommitResponseSchema = z.object({
167
- commit: restoreCommitCommitSchema.partial().optional().nullable(),
168
- result: refUpdateResultWithOptionalsSchema,
169
+ commit: restoreCommitCommitSchema.partial().optional().nullable(),
170
+ result: refUpdateResultWithOptionalsSchema,
169
171
  });
170
172
 
171
173
  export const grepLineSchema = z.object({
172
- line_number: z.number(),
173
- text: z.string(),
174
- type: z.string(),
174
+ line_number: z.number(),
175
+ text: z.string(),
176
+ type: z.string(),
175
177
  });
176
178
 
177
179
  export const grepFileMatchSchema = z.object({
178
- path: z.string(),
179
- lines: z.array(grepLineSchema),
180
+ path: z.string(),
181
+ lines: z.array(grepLineSchema),
180
182
  });
181
183
 
182
184
  export const grepResponseSchema = z.object({
183
- query: z.object({
184
- pattern: z.string(),
185
- case_sensitive: z.boolean(),
186
- }),
187
- repo: z.object({
188
- ref: z.string(),
189
- commit: z.string(),
190
- }),
191
- matches: z.array(grepFileMatchSchema),
192
- next_cursor: z.string().nullable().optional(),
193
- has_more: z.boolean(),
185
+ query: z.object({
186
+ pattern: z.string(),
187
+ case_sensitive: z.boolean(),
188
+ }),
189
+ repo: z.object({
190
+ ref: z.string(),
191
+ commit: z.string(),
192
+ }),
193
+ matches: z.array(grepFileMatchSchema),
194
+ next_cursor: z.string().nullable().optional(),
195
+ has_more: z.boolean(),
194
196
  });
195
197
 
196
198
  export const errorEnvelopeSchema = z.object({
197
- error: z.string(),
199
+ error: z.string(),
198
200
  });
199
201
 
200
202
  export type ListFilesResponseRaw = z.infer<typeof listFilesResponseSchema>;
201
203
  export type RawBranchInfo = z.infer<typeof branchInfoSchema>;
202
- export type ListBranchesResponseRaw = z.infer<typeof listBranchesResponseSchema>;
204
+ export type ListBranchesResponseRaw = z.infer<
205
+ typeof listBranchesResponseSchema
206
+ >;
203
207
  export type RawCommitInfo = z.infer<typeof commitInfoRawSchema>;
204
208
  export type ListCommitsResponseRaw = z.infer<typeof listCommitsResponseSchema>;
205
209
  export type RawRepoBaseInfo = z.infer<typeof repoBaseInfoSchema>;
@@ -211,7 +215,9 @@ export type RawFileDiff = z.infer<typeof diffFileRawSchema>;
211
215
  export type RawFilteredFile = z.infer<typeof filteredFileRawSchema>;
212
216
  export type GetBranchDiffResponseRaw = z.infer<typeof branchDiffResponseSchema>;
213
217
  export type GetCommitDiffResponseRaw = z.infer<typeof commitDiffResponseSchema>;
214
- export type CreateBranchResponseRaw = z.infer<typeof createBranchResponseSchema>;
218
+ export type CreateBranchResponseRaw = z.infer<
219
+ typeof createBranchResponseSchema
220
+ >;
215
221
  export type CommitPackAckRaw = z.infer<typeof commitPackAckSchema>;
216
222
  export type RestoreCommitAckRaw = z.infer<typeof restoreCommitAckSchema>;
217
223
  export type GrepResponseRaw = z.infer<typeof grepResponseSchema>;