@repome/api 0.1.7 → 0.1.9
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.mts +1058 -40
- package/dist/index.mjs +31 -12
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,11 @@ const commonErrors = {
|
|
|
12
12
|
message: "Sign in required",
|
|
13
13
|
data: z.object({}).optional()
|
|
14
14
|
},
|
|
15
|
+
TOO_MANY_REQUESTS: {
|
|
16
|
+
status: 429,
|
|
17
|
+
message: "Too many requests",
|
|
18
|
+
data: z.object({ retryAfterMs: z.number().int().nonnegative().optional() }).optional()
|
|
19
|
+
},
|
|
15
20
|
FORBIDDEN: {
|
|
16
21
|
status: 403,
|
|
17
22
|
message: "You do not have access to this resource",
|
|
@@ -26,6 +31,11 @@ const commonErrors = {
|
|
|
26
31
|
message: "Invitation not found",
|
|
27
32
|
data: z.object({ invitationId: z.string() })
|
|
28
33
|
},
|
|
34
|
+
KEY_NOT_FOUND: {
|
|
35
|
+
status: 404,
|
|
36
|
+
message: "API key not found",
|
|
37
|
+
data: z.object({ id: z.string() })
|
|
38
|
+
},
|
|
29
39
|
REPO_NOT_FOUND: {
|
|
30
40
|
status: 404,
|
|
31
41
|
message: "Repo not found",
|
|
@@ -131,7 +141,8 @@ const ocBase = oc.errors(commonErrors);
|
|
|
131
141
|
//#region src/orgs.ts
|
|
132
142
|
const orgSlugHint = "Lowercase, alphanumeric, - only.";
|
|
133
143
|
const orgSlugSchema = z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9-]*$/, orgSlugHint);
|
|
134
|
-
const
|
|
144
|
+
const PERSONAL_ORG_SLUG = "~";
|
|
145
|
+
const repoScopeSchema = z.object({ orgSlug: z.union([orgSlugSchema, z.literal("~")]).optional() });
|
|
135
146
|
const orgIdOrSlugSchema = z.object({ idOrSlug: z.string().min(1) });
|
|
136
147
|
const orgCreateInputSchema = z.object({
|
|
137
148
|
slug: orgSlugSchema,
|
|
@@ -153,8 +164,12 @@ const orgs = {
|
|
|
153
164
|
delete: ocBase.input(orgIdOrSlugSchema).output(z.object({ deleted: z.literal(true) }))
|
|
154
165
|
};
|
|
155
166
|
//#endregion
|
|
167
|
+
//#region src/pagination.ts
|
|
168
|
+
const cursorSchema = z.string().optional().describe("Opaque pagination cursor from a previous page. Lenient: an undecodable cursor restarts from the first page; a stale cursor (pointing at a removed item) yields an empty page on git listings and continues past the cursor position on catalog listings. Never an error.");
|
|
169
|
+
//#endregion
|
|
156
170
|
//#region src/repos.ts
|
|
157
171
|
const repoNameHint = "Lowercase, alphanumeric, ._- only.";
|
|
172
|
+
const CLONE_TOKEN_SCOPE = "read";
|
|
158
173
|
const repoNameSchema = z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9._-]*$/, repoNameHint);
|
|
159
174
|
function parseRepoName(value) {
|
|
160
175
|
return repoNameSchema.parse(value);
|
|
@@ -171,7 +186,7 @@ const repoUpdateInputSchema = repoIdentSchema.extend({
|
|
|
171
186
|
defaultBranch: z.string().min(1).max(128).optional()
|
|
172
187
|
});
|
|
173
188
|
const repoListInputSchema = repoScopeSchema.extend({
|
|
174
|
-
cursor:
|
|
189
|
+
cursor: cursorSchema,
|
|
175
190
|
limit: z.number().int().min(1).max(100).default(50)
|
|
176
191
|
});
|
|
177
192
|
const repoSchema = z.object({
|
|
@@ -190,7 +205,8 @@ const repoSchema = z.object({
|
|
|
190
205
|
updatedAt: z.number()
|
|
191
206
|
});
|
|
192
207
|
const repoCreateOutputSchema = repoSchema.extend({
|
|
193
|
-
token: z.string(),
|
|
208
|
+
token: z.string().describe("Convenience token bundled with the new repo. Read/clone-scoped: it cannot push. Mint a write token (tokens.mint, scope \"write\") or use the repome git credential helper for the first push."),
|
|
209
|
+
tokenScope: z.literal(CLONE_TOKEN_SCOPE),
|
|
194
210
|
tokenExpiresAt: z.string()
|
|
195
211
|
});
|
|
196
212
|
const repoListOutputSchema = z.object({
|
|
@@ -215,7 +231,7 @@ const repos = {
|
|
|
215
231
|
//#region src/git.ts
|
|
216
232
|
const pageInputSchema = repoScopeSchema.extend({
|
|
217
233
|
name: repoNameSchema,
|
|
218
|
-
cursor:
|
|
234
|
+
cursor: cursorSchema,
|
|
219
235
|
limit: z.number().int().min(1).max(100).default(50)
|
|
220
236
|
});
|
|
221
237
|
const refInputSchema = repoScopeSchema.extend({
|
|
@@ -231,7 +247,7 @@ const treeInputSchema = repoScopeSchema.extend({
|
|
|
231
247
|
ref: z.string().min(1).default("HEAD"),
|
|
232
248
|
path: z.string().optional(),
|
|
233
249
|
recursive: z.boolean().default(true),
|
|
234
|
-
cursor:
|
|
250
|
+
cursor: cursorSchema,
|
|
235
251
|
limit: z.number().int().min(1).max(100).default(50)
|
|
236
252
|
});
|
|
237
253
|
const blobInputSchema = repoScopeSchema.extend({
|
|
@@ -305,7 +321,7 @@ const compareInputSchema = repoScopeSchema.extend({
|
|
|
305
321
|
name: repoNameSchema,
|
|
306
322
|
base: z.string().min(1),
|
|
307
323
|
head: z.string().min(1),
|
|
308
|
-
cursor:
|
|
324
|
+
cursor: cursorSchema,
|
|
309
325
|
limit: z.number().int().min(1).max(250).default(250)
|
|
310
326
|
});
|
|
311
327
|
const diffInputSchema = repoScopeSchema.extend({
|
|
@@ -314,7 +330,7 @@ const diffInputSchema = repoScopeSchema.extend({
|
|
|
314
330
|
head: z.string().min(1),
|
|
315
331
|
path: z.string().optional(),
|
|
316
332
|
includePatch: z.boolean().default(false),
|
|
317
|
-
cursor:
|
|
333
|
+
cursor: cursorSchema,
|
|
318
334
|
limit: z.number().int().min(1).max(250).default(50)
|
|
319
335
|
});
|
|
320
336
|
const gitRefSchema = z.object({
|
|
@@ -490,7 +506,7 @@ const tokens = {
|
|
|
490
506
|
//#region src/anon.ts
|
|
491
507
|
const anonRepoIdentSchema = z.object({ name: repoNameSchema });
|
|
492
508
|
const anonPageInputSchema = anonRepoIdentSchema.extend({
|
|
493
|
-
cursor:
|
|
509
|
+
cursor: cursorSchema,
|
|
494
510
|
limit: z.number().int().min(1).max(100).default(50)
|
|
495
511
|
});
|
|
496
512
|
const anonRefInputSchema = anonRepoIdentSchema.extend({ ref: z.string().min(1) });
|
|
@@ -498,7 +514,7 @@ const anonTreeInputSchema = anonRepoIdentSchema.extend({
|
|
|
498
514
|
ref: z.string().min(1).default("HEAD"),
|
|
499
515
|
path: z.string().optional(),
|
|
500
516
|
recursive: z.boolean().default(true),
|
|
501
|
-
cursor:
|
|
517
|
+
cursor: cursorSchema,
|
|
502
518
|
limit: z.number().int().min(1).max(100).default(50)
|
|
503
519
|
});
|
|
504
520
|
const anonBlobInputSchema = anonRepoIdentSchema.extend({ oid: z.string().min(1) });
|
|
@@ -506,7 +522,7 @@ const anonRepoCreateInputSchema = z.object({
|
|
|
506
522
|
name: repoNameSchema.optional(),
|
|
507
523
|
description: z.string().max(512).optional(),
|
|
508
524
|
defaultBranch: z.string().min(1).max(128).default("main"),
|
|
509
|
-
ttlSeconds: z.number().int().min(
|
|
525
|
+
ttlSeconds: z.number().int().min(60).max(3600 * 72).optional()
|
|
510
526
|
});
|
|
511
527
|
const anonRepoSchema = repoSchema.extend({
|
|
512
528
|
expiresAt: z.string(),
|
|
@@ -514,7 +530,7 @@ const anonRepoSchema = repoSchema.extend({
|
|
|
514
530
|
});
|
|
515
531
|
const anonRepoCreateOutputSchema = anonRepoSchema.extend({ anonId: z.string() });
|
|
516
532
|
const anonRepoListInputSchema = z.object({
|
|
517
|
-
cursor:
|
|
533
|
+
cursor: cursorSchema,
|
|
518
534
|
limit: z.number().int().min(1).max(100).default(50)
|
|
519
535
|
});
|
|
520
536
|
const anonRepoListOutputSchema = z.object({
|
|
@@ -657,10 +673,13 @@ const invitationViewSchema = z.object({
|
|
|
657
673
|
inviterId: z.string(),
|
|
658
674
|
expiresAt: z.number()
|
|
659
675
|
});
|
|
676
|
+
const invitationListItemSchema = invitationViewSchema.extend({ createdAt: z.number() });
|
|
660
677
|
const orgInputSchema = z.object({ orgSlug: orgSlugSchema });
|
|
661
678
|
const memberListOutputSchema = z.object({ items: z.array(memberViewSchema) });
|
|
679
|
+
const invitationListOutputSchema = z.object({ items: z.array(invitationListItemSchema) });
|
|
662
680
|
const members = {
|
|
663
681
|
list: ocBase.input(orgInputSchema).output(memberListOutputSchema),
|
|
682
|
+
listInvitations: ocBase.input(orgInputSchema).output(invitationListOutputSchema),
|
|
664
683
|
invite: ocBase.input(orgInputSchema.extend({
|
|
665
684
|
email: z.email(),
|
|
666
685
|
role: mutableMemberRoleSchema
|
|
@@ -732,4 +751,4 @@ const contract = {
|
|
|
732
751
|
tokens
|
|
733
752
|
};
|
|
734
753
|
//#endregion
|
|
735
|
-
export { ANON_ID_STORE_VERSION, anonRepoSchema, apiKeyViewSchema, commonErrors, compareViewSchema, contract, diffFileSchema, diffViewSchema, gitBlobSchema, gitCommitSchema, gitRefSchema, gitTreeEntrySchema, invitationViewSchema, meViewSchema, memberRoleSchema, memberViewSchema, mutableMemberRoleSchema, orgSlugHint, orgSlugSchema, orgViewSchema, parseAnonIdFile, parseRepoName, repoNameHint, repoNameSchema, repoSchema, scopeSchema, serializeAnonIdRecord, tokenScopeSchema, tokenViewSchema };
|
|
754
|
+
export { ANON_ID_STORE_VERSION, CLONE_TOKEN_SCOPE, PERSONAL_ORG_SLUG, anonRepoSchema, apiKeyViewSchema, commonErrors, compareViewSchema, contract, cursorSchema, diffFileSchema, diffViewSchema, gitBlobSchema, gitCommitSchema, gitRefSchema, gitTreeEntrySchema, invitationListItemSchema, invitationViewSchema, meViewSchema, memberRoleSchema, memberViewSchema, mutableMemberRoleSchema, orgSlugHint, orgSlugSchema, orgViewSchema, parseAnonIdFile, parseRepoName, repoNameHint, repoNameSchema, repoSchema, scopeSchema, serializeAnonIdRecord, tokenScopeSchema, tokenViewSchema };
|