@repome/api 0.1.8 → 0.3.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.mts +1515 -159
- package/dist/index.mjs +128 -77
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { oc } from "@orpc/contract";
|
|
3
|
+
//#region package.json
|
|
4
|
+
var version = "0.3.0";
|
|
5
|
+
//#endregion
|
|
3
6
|
//#region src/base.ts
|
|
7
|
+
const validationIssueSchema = z.object({
|
|
8
|
+
path: z.array(z.union([z.string(), z.number()])).optional(),
|
|
9
|
+
message: z.string()
|
|
10
|
+
});
|
|
4
11
|
const commonErrors = {
|
|
5
12
|
BAD_REQUEST: {
|
|
6
13
|
status: 400,
|
|
7
14
|
message: "Bad request",
|
|
8
|
-
data: z.object({}).optional()
|
|
15
|
+
data: z.object({ issues: z.array(validationIssueSchema).optional() }).optional()
|
|
9
16
|
},
|
|
10
17
|
UNAUTHENTICATED: {
|
|
11
18
|
status: 401,
|
|
@@ -134,63 +141,70 @@ const commonErrors = {
|
|
|
134
141
|
status: 502,
|
|
135
142
|
message: "Repo import failed",
|
|
136
143
|
data: z.object({ name: z.string() })
|
|
144
|
+
},
|
|
145
|
+
ORG_LAST_OWNED: {
|
|
146
|
+
status: 409,
|
|
147
|
+
message: "Cannot delete your last owned organization",
|
|
148
|
+
data: z.object({ slug: z.string() })
|
|
149
|
+
},
|
|
150
|
+
ORG_HAS_REPOS: {
|
|
151
|
+
status: 409,
|
|
152
|
+
message: "Cannot delete an organization that still owns repos",
|
|
153
|
+
data: z.object({
|
|
154
|
+
slug: z.string(),
|
|
155
|
+
repoCount: z.number().int().nonnegative()
|
|
156
|
+
})
|
|
137
157
|
}
|
|
138
158
|
};
|
|
139
159
|
const ocBase = oc.errors(commonErrors);
|
|
160
|
+
const ocPublic = ocBase.route({ spec: (operation) => ({
|
|
161
|
+
...operation,
|
|
162
|
+
security: []
|
|
163
|
+
}) });
|
|
140
164
|
//#endregion
|
|
141
|
-
//#region src/
|
|
142
|
-
const
|
|
143
|
-
const orgSlugSchema = z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9-]*$/, orgSlugHint);
|
|
144
|
-
const repoScopeSchema = z.object({ orgSlug: orgSlugSchema.optional() });
|
|
145
|
-
const orgIdOrSlugSchema = z.object({ idOrSlug: z.string().min(1) });
|
|
146
|
-
const orgCreateInputSchema = z.object({
|
|
147
|
-
slug: orgSlugSchema,
|
|
148
|
-
name: z.string().min(1).max(80)
|
|
149
|
-
});
|
|
150
|
-
const orgViewSchema = z.object({
|
|
151
|
-
id: z.string(),
|
|
152
|
-
slug: z.string(),
|
|
153
|
-
name: z.string(),
|
|
154
|
-
logo: z.string().nullable(),
|
|
155
|
-
metadata: z.string().nullable(),
|
|
156
|
-
createdAt: z.number()
|
|
157
|
-
});
|
|
158
|
-
const orgListOutputSchema = z.object({ items: z.array(orgViewSchema) });
|
|
159
|
-
const orgs = {
|
|
160
|
-
create: ocBase.input(orgCreateInputSchema).output(orgViewSchema),
|
|
161
|
-
list: ocBase.output(orgListOutputSchema),
|
|
162
|
-
get: ocBase.input(orgIdOrSlugSchema).output(orgViewSchema),
|
|
163
|
-
delete: ocBase.input(orgIdOrSlugSchema).output(z.object({ deleted: z.literal(true) }))
|
|
164
|
-
};
|
|
165
|
+
//#region src/pagination.ts
|
|
166
|
+
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.");
|
|
165
167
|
//#endregion
|
|
166
168
|
//#region src/repos.ts
|
|
167
|
-
const repoNameHint = "Lowercase, alphanumeric, ._- only.";
|
|
168
|
-
const
|
|
169
|
+
const repoNameHint = "Lowercase, alphanumeric, ._- only; \"..\" is not allowed.";
|
|
170
|
+
const CLONE_TOKEN_SCOPE = "read";
|
|
171
|
+
const repoNameSchema = z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9._-]*$/, repoNameHint).refine((value) => !value.includes(".."), repoNameHint);
|
|
169
172
|
function parseRepoName(value) {
|
|
170
173
|
return repoNameSchema.parse(value);
|
|
171
174
|
}
|
|
172
|
-
const
|
|
175
|
+
const defaultBranchHint = "Branch name (\"main\") or refs/heads/-qualified; other refs/ namespaces are not branches.";
|
|
176
|
+
const REFS_HEADS_PREFIX = "refs/heads/";
|
|
177
|
+
/**
|
|
178
|
+
* The one normalizer for default-branch spellings: a refs/heads/-qualified
|
|
179
|
+
* value becomes the short name, anything else passes through. Persisted rows
|
|
180
|
+
* hold the short shape only — the default-branch guards, headOid, and
|
|
181
|
+
* clone/view templates all build `refs/heads/${defaultBranch}` from it, so a
|
|
182
|
+
* qualified spelling would silently fall outside them.
|
|
183
|
+
*/
|
|
184
|
+
function normalizeDefaultBranch(branch) {
|
|
185
|
+
return branch.startsWith(REFS_HEADS_PREFIX) ? branch.slice(11) : branch;
|
|
186
|
+
}
|
|
187
|
+
const defaultBranchSchema = z.string().min(1).max(139).transform(normalizeDefaultBranch).pipe(z.string().min(1).max(128).refine((value) => !value.startsWith("refs/"), defaultBranchHint));
|
|
188
|
+
const repoIdentSchema = z.object({ name: repoNameSchema });
|
|
173
189
|
const repoCreateInputSchema = repoIdentSchema.extend({
|
|
174
190
|
description: z.string().max(512).optional(),
|
|
175
|
-
defaultBranch:
|
|
191
|
+
defaultBranch: defaultBranchSchema.default("main")
|
|
176
192
|
});
|
|
177
193
|
const repoEnsureInputSchema = repoCreateInputSchema;
|
|
178
194
|
const repoImportInputSchema = repoCreateInputSchema.extend({ remote: z.url() });
|
|
179
195
|
const repoUpdateInputSchema = repoIdentSchema.extend({
|
|
180
196
|
description: z.string().max(512).nullable().optional(),
|
|
181
|
-
defaultBranch:
|
|
197
|
+
defaultBranch: defaultBranchSchema.optional()
|
|
182
198
|
});
|
|
183
|
-
const repoListInputSchema =
|
|
184
|
-
cursor:
|
|
199
|
+
const repoListInputSchema = z.object({
|
|
200
|
+
cursor: cursorSchema,
|
|
185
201
|
limit: z.number().int().min(1).max(100).default(50)
|
|
186
202
|
});
|
|
187
203
|
const repoSchema = z.object({
|
|
188
|
-
orgId: z.string(),
|
|
189
204
|
name: z.string(),
|
|
190
205
|
ownerId: z.string(),
|
|
191
206
|
description: z.string().nullable(),
|
|
192
207
|
defaultBranch: z.string(),
|
|
193
|
-
artifactName: z.string(),
|
|
194
208
|
artifactId: z.string().nullable(),
|
|
195
209
|
remote: z.string().nullable(),
|
|
196
210
|
readOnly: z.boolean(),
|
|
@@ -200,7 +214,8 @@ const repoSchema = z.object({
|
|
|
200
214
|
updatedAt: z.number()
|
|
201
215
|
});
|
|
202
216
|
const repoCreateOutputSchema = repoSchema.extend({
|
|
203
|
-
token: z.string(),
|
|
217
|
+
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."),
|
|
218
|
+
tokenScope: z.literal(CLONE_TOKEN_SCOPE),
|
|
204
219
|
tokenExpiresAt: z.string()
|
|
205
220
|
});
|
|
206
221
|
const repoListOutputSchema = z.object({
|
|
@@ -223,28 +238,28 @@ const repos = {
|
|
|
223
238
|
};
|
|
224
239
|
//#endregion
|
|
225
240
|
//#region src/git.ts
|
|
226
|
-
const pageInputSchema =
|
|
241
|
+
const pageInputSchema = z.object({
|
|
227
242
|
name: repoNameSchema,
|
|
228
|
-
cursor:
|
|
243
|
+
cursor: cursorSchema,
|
|
229
244
|
limit: z.number().int().min(1).max(100).default(50)
|
|
230
245
|
});
|
|
231
|
-
const refInputSchema =
|
|
246
|
+
const refInputSchema = z.object({
|
|
232
247
|
name: repoNameSchema,
|
|
233
248
|
ref: z.string().min(1)
|
|
234
249
|
});
|
|
235
|
-
const oidInputSchema =
|
|
250
|
+
const oidInputSchema = z.object({
|
|
236
251
|
name: repoNameSchema,
|
|
237
252
|
oid: z.string().min(1)
|
|
238
253
|
});
|
|
239
|
-
const treeInputSchema =
|
|
254
|
+
const treeInputSchema = z.object({
|
|
240
255
|
name: repoNameSchema,
|
|
241
256
|
ref: z.string().min(1).default("HEAD"),
|
|
242
257
|
path: z.string().optional(),
|
|
243
258
|
recursive: z.boolean().default(true),
|
|
244
|
-
cursor:
|
|
259
|
+
cursor: cursorSchema,
|
|
245
260
|
limit: z.number().int().min(1).max(100).default(50)
|
|
246
261
|
});
|
|
247
|
-
const blobInputSchema =
|
|
262
|
+
const blobInputSchema = z.object({
|
|
248
263
|
name: repoNameSchema,
|
|
249
264
|
oid: z.string().min(1)
|
|
250
265
|
});
|
|
@@ -254,12 +269,12 @@ const signatureSchema$1 = z.object({
|
|
|
254
269
|
timestamp: z.number().int().optional(),
|
|
255
270
|
timezoneOffset: z.number().int().optional()
|
|
256
271
|
});
|
|
257
|
-
const branchCreateInputSchema =
|
|
272
|
+
const branchCreateInputSchema = z.object({
|
|
258
273
|
name: repoNameSchema,
|
|
259
274
|
branch: z.string().min(1),
|
|
260
275
|
fromRef: z.string().min(1)
|
|
261
276
|
});
|
|
262
|
-
const branchUpdateInputSchema =
|
|
277
|
+
const branchUpdateInputSchema = z.object({
|
|
263
278
|
name: repoNameSchema,
|
|
264
279
|
ref: z.string().min(1),
|
|
265
280
|
oid: z.string().min(1),
|
|
@@ -267,23 +282,23 @@ const branchUpdateInputSchema = repoScopeSchema.extend({
|
|
|
267
282
|
force: z.boolean().optional(),
|
|
268
283
|
allowDefaultBranchRewrite: z.boolean().optional()
|
|
269
284
|
});
|
|
270
|
-
const branchDeleteInputSchema =
|
|
285
|
+
const branchDeleteInputSchema = z.object({
|
|
271
286
|
name: repoNameSchema,
|
|
272
287
|
ref: z.string().min(1),
|
|
273
288
|
expectedOid: z.string().min(1).optional()
|
|
274
289
|
});
|
|
275
|
-
const tagCreateInputSchema =
|
|
290
|
+
const tagCreateInputSchema = z.object({
|
|
276
291
|
name: repoNameSchema,
|
|
277
292
|
tag: z.string().min(1),
|
|
278
293
|
oid: z.string().min(1),
|
|
279
294
|
message: z.string().min(1).optional(),
|
|
280
295
|
tagger: signatureSchema$1.optional()
|
|
281
296
|
});
|
|
282
|
-
const tagDeleteInputSchema =
|
|
297
|
+
const tagDeleteInputSchema = z.object({
|
|
283
298
|
name: repoNameSchema,
|
|
284
299
|
ref: z.string().min(1)
|
|
285
300
|
});
|
|
286
|
-
const commitCreateInputSchema =
|
|
301
|
+
const commitCreateInputSchema = z.object({
|
|
287
302
|
name: repoNameSchema,
|
|
288
303
|
ref: z.string().min(1),
|
|
289
304
|
message: z.string().min(1),
|
|
@@ -298,7 +313,7 @@ const workspaceFileSchema$1 = z.object({
|
|
|
298
313
|
content: z.string(),
|
|
299
314
|
encoding: z.literal("base64").default("base64")
|
|
300
315
|
});
|
|
301
|
-
const workspaceCommitInputSchema =
|
|
316
|
+
const workspaceCommitInputSchema = z.object({
|
|
302
317
|
name: repoNameSchema,
|
|
303
318
|
ref: z.string().min(1).default("refs/heads/main"),
|
|
304
319
|
message: z.string().min(1),
|
|
@@ -311,20 +326,20 @@ const workspaceCommitInputSchema = repoScopeSchema.extend({
|
|
|
311
326
|
message: "workspace.commit requires at least one file or remove",
|
|
312
327
|
path: ["files"]
|
|
313
328
|
});
|
|
314
|
-
const compareInputSchema =
|
|
329
|
+
const compareInputSchema = z.object({
|
|
315
330
|
name: repoNameSchema,
|
|
316
331
|
base: z.string().min(1),
|
|
317
332
|
head: z.string().min(1),
|
|
318
|
-
cursor:
|
|
333
|
+
cursor: cursorSchema,
|
|
319
334
|
limit: z.number().int().min(1).max(250).default(250)
|
|
320
335
|
});
|
|
321
|
-
const diffInputSchema =
|
|
336
|
+
const diffInputSchema = z.object({
|
|
322
337
|
name: repoNameSchema,
|
|
323
338
|
base: z.string().min(1),
|
|
324
339
|
head: z.string().min(1),
|
|
325
340
|
path: z.string().optional(),
|
|
326
341
|
includePatch: z.boolean().default(false),
|
|
327
|
-
cursor:
|
|
342
|
+
cursor: cursorSchema,
|
|
328
343
|
limit: z.number().int().min(1).max(250).default(50)
|
|
329
344
|
});
|
|
330
345
|
const gitRefSchema = z.object({
|
|
@@ -445,13 +460,23 @@ const git = {
|
|
|
445
460
|
//#endregion
|
|
446
461
|
//#region src/tokens.ts
|
|
447
462
|
const tokenScopeSchema = z.enum(["read", "write"]);
|
|
448
|
-
const
|
|
463
|
+
const TOKEN_OPS = [
|
|
464
|
+
"refs",
|
|
465
|
+
"object",
|
|
466
|
+
"merge",
|
|
467
|
+
"seed",
|
|
468
|
+
"clone",
|
|
469
|
+
"agent"
|
|
470
|
+
];
|
|
471
|
+
const tokenOpSchema = z.enum(TOKEN_OPS).describe("Token op selecting the TTL cap: refs 60s, object 300s, merge 600s, seed 600s, clone 900s, agent 1800s. Defaults to `refs` (60s) when omitted. The effective TTL is min(requested ttlSeconds, op cap, server hard cap), floored at 60s.");
|
|
472
|
+
const gitRemoteOpSchema = z.string().min(1).max(32).describe("Git operation from the credential helper (e.g. `push`, `fetch`). `push` and `receive-pack` mint write-scope tokens; anything else mints read scope. Values outside the token op set (refs, object, merge, seed, clone, agent) use the default refs 60s TTL cap.");
|
|
473
|
+
const tokenMintInputSchema = z.object({
|
|
449
474
|
name: repoNameSchema,
|
|
450
475
|
scope: tokenScopeSchema,
|
|
451
476
|
ttlSeconds: z.number().int().positive().optional(),
|
|
452
|
-
op:
|
|
477
|
+
op: tokenOpSchema.optional()
|
|
453
478
|
});
|
|
454
|
-
const tokenIdentInputSchema =
|
|
479
|
+
const tokenIdentInputSchema = z.object({
|
|
455
480
|
name: repoNameSchema,
|
|
456
481
|
id: z.string().min(1)
|
|
457
482
|
});
|
|
@@ -461,7 +486,7 @@ const tokenMintForGitRemoteInputSchema = z.object({
|
|
|
461
486
|
host: z.string().min(1),
|
|
462
487
|
path: z.string().min(1),
|
|
463
488
|
ttlSeconds: z.number().int().positive().optional(),
|
|
464
|
-
op:
|
|
489
|
+
op: gitRemoteOpSchema.optional()
|
|
465
490
|
});
|
|
466
491
|
const tokenViewSchema = z.object({
|
|
467
492
|
id: z.string(),
|
|
@@ -476,7 +501,7 @@ const tokenViewSchema = z.object({
|
|
|
476
501
|
revokedAt: z.string().nullable()
|
|
477
502
|
});
|
|
478
503
|
const tokenMintOutputSchema = tokenViewSchema.extend({ token: z.string() });
|
|
479
|
-
const tokenListInputSchema =
|
|
504
|
+
const tokenListInputSchema = z.object({ name: repoNameSchema });
|
|
480
505
|
const tokenListOutputSchema = z.object({ items: z.array(tokenViewSchema) });
|
|
481
506
|
const tokenRevokeOutputSchema = z.object({ revoked: z.boolean() });
|
|
482
507
|
const tokenValidateOutputSchema = z.object({
|
|
@@ -500,7 +525,7 @@ const tokens = {
|
|
|
500
525
|
//#region src/anon.ts
|
|
501
526
|
const anonRepoIdentSchema = z.object({ name: repoNameSchema });
|
|
502
527
|
const anonPageInputSchema = anonRepoIdentSchema.extend({
|
|
503
|
-
cursor:
|
|
528
|
+
cursor: cursorSchema,
|
|
504
529
|
limit: z.number().int().min(1).max(100).default(50)
|
|
505
530
|
});
|
|
506
531
|
const anonRefInputSchema = anonRepoIdentSchema.extend({ ref: z.string().min(1) });
|
|
@@ -508,15 +533,15 @@ const anonTreeInputSchema = anonRepoIdentSchema.extend({
|
|
|
508
533
|
ref: z.string().min(1).default("HEAD"),
|
|
509
534
|
path: z.string().optional(),
|
|
510
535
|
recursive: z.boolean().default(true),
|
|
511
|
-
cursor:
|
|
536
|
+
cursor: cursorSchema,
|
|
512
537
|
limit: z.number().int().min(1).max(100).default(50)
|
|
513
538
|
});
|
|
514
539
|
const anonBlobInputSchema = anonRepoIdentSchema.extend({ oid: z.string().min(1) });
|
|
515
540
|
const anonRepoCreateInputSchema = z.object({
|
|
516
541
|
name: repoNameSchema.optional(),
|
|
517
542
|
description: z.string().max(512).optional(),
|
|
518
|
-
defaultBranch:
|
|
519
|
-
ttlSeconds: z.number().int().min(60).max(
|
|
543
|
+
defaultBranch: defaultBranchSchema.default("main"),
|
|
544
|
+
ttlSeconds: z.number().int().min(60).max(3600 * 72).optional()
|
|
520
545
|
});
|
|
521
546
|
const anonRepoSchema = repoSchema.extend({
|
|
522
547
|
expiresAt: z.string(),
|
|
@@ -524,7 +549,7 @@ const anonRepoSchema = repoSchema.extend({
|
|
|
524
549
|
});
|
|
525
550
|
const anonRepoCreateOutputSchema = anonRepoSchema.extend({ anonId: z.string() });
|
|
526
551
|
const anonRepoListInputSchema = z.object({
|
|
527
|
-
cursor:
|
|
552
|
+
cursor: cursorSchema,
|
|
528
553
|
limit: z.number().int().min(1).max(100).default(50)
|
|
529
554
|
});
|
|
530
555
|
const anonRepoListOutputSchema = z.object({
|
|
@@ -536,7 +561,7 @@ const anonTokenMintForGitRemoteInputSchema = z.object({
|
|
|
536
561
|
host: z.string().min(1),
|
|
537
562
|
path: z.string().min(1),
|
|
538
563
|
ttlSeconds: z.number().int().positive().optional(),
|
|
539
|
-
op:
|
|
564
|
+
op: gitRemoteOpSchema.optional()
|
|
540
565
|
});
|
|
541
566
|
const signatureSchema = z.object({
|
|
542
567
|
name: z.string().min(1),
|
|
@@ -570,21 +595,21 @@ function pageOf(item) {
|
|
|
570
595
|
}
|
|
571
596
|
const anon = {
|
|
572
597
|
repos: {
|
|
573
|
-
create:
|
|
574
|
-
get:
|
|
575
|
-
list:
|
|
576
|
-
delete:
|
|
598
|
+
create: ocPublic.input(anonRepoCreateInputSchema).output(anonRepoCreateOutputSchema),
|
|
599
|
+
get: ocPublic.input(anonRepoIdentSchema).output(anonRepoSchema),
|
|
600
|
+
list: ocPublic.input(anonRepoListInputSchema).output(anonRepoListOutputSchema),
|
|
601
|
+
delete: ocPublic.input(anonRepoIdentSchema).output(z.object({ deleted: z.literal(true) }))
|
|
577
602
|
},
|
|
578
|
-
tokens: { mintForGitRemote:
|
|
603
|
+
tokens: { mintForGitRemote: ocPublic.input(anonTokenMintForGitRemoteInputSchema).output(tokenMintOutputSchema) },
|
|
579
604
|
git: {
|
|
580
605
|
refs: {
|
|
581
|
-
list:
|
|
582
|
-
get:
|
|
606
|
+
list: ocPublic.input(anonPageInputSchema).output(pageOf(gitRefSchema)),
|
|
607
|
+
get: ocPublic.input(anonRefInputSchema).output(gitRefSchema)
|
|
583
608
|
},
|
|
584
|
-
commits: { list:
|
|
585
|
-
tree: { get:
|
|
586
|
-
blob: { get:
|
|
587
|
-
workspace: { commit:
|
|
609
|
+
commits: { list: ocPublic.input(anonPageInputSchema.extend({ ref: z.string().optional() })).output(pageOf(gitCommitSchema)) },
|
|
610
|
+
tree: { get: ocPublic.input(anonTreeInputSchema).output(pageOf(gitTreeEntrySchema)) },
|
|
611
|
+
blob: { get: ocPublic.input(anonBlobInputSchema).output(z.union([gitBlobSchema, gitBlobTooLargeSchema])) },
|
|
612
|
+
workspace: { commit: ocPublic.input(anonWorkspaceCommitInputSchema).output(z.object({
|
|
588
613
|
commit: gitCommitSchema,
|
|
589
614
|
ref: gitRefSchema
|
|
590
615
|
})) }
|
|
@@ -592,7 +617,7 @@ const anon = {
|
|
|
592
617
|
};
|
|
593
618
|
//#endregion
|
|
594
619
|
//#region src/health.ts
|
|
595
|
-
const health = { ping:
|
|
620
|
+
const health = { ping: ocPublic.input(z.void()).output(z.object({
|
|
596
621
|
ok: z.literal(true),
|
|
597
622
|
ts: z.number()
|
|
598
623
|
})) };
|
|
@@ -642,6 +667,27 @@ const keys = {
|
|
|
642
667
|
delete: ocBase.input(apiKeyDeleteInputSchema).output(apiKeyDeleteOutputSchema)
|
|
643
668
|
};
|
|
644
669
|
//#endregion
|
|
670
|
+
//#region src/orgs.ts
|
|
671
|
+
const orgSlugHint = "Lowercase, alphanumeric, - only.";
|
|
672
|
+
const orgSlugSchema = z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9-]*$/, orgSlugHint);
|
|
673
|
+
const orgIdOrSlugSchema = z.object({ idOrSlug: z.string().min(1) });
|
|
674
|
+
const orgCreateInputSchema = z.object({ name: z.string().min(1).max(80).optional() });
|
|
675
|
+
const orgViewSchema = z.object({
|
|
676
|
+
id: z.string(),
|
|
677
|
+
slug: z.string(),
|
|
678
|
+
name: z.string(),
|
|
679
|
+
logo: z.string().nullable(),
|
|
680
|
+
metadata: z.string().nullable(),
|
|
681
|
+
createdAt: z.number()
|
|
682
|
+
});
|
|
683
|
+
const orgListOutputSchema = z.object({ items: z.array(orgViewSchema) });
|
|
684
|
+
const orgs = {
|
|
685
|
+
create: ocBase.input(orgCreateInputSchema).output(orgViewSchema),
|
|
686
|
+
list: ocBase.output(orgListOutputSchema),
|
|
687
|
+
get: ocBase.input(orgIdOrSlugSchema).output(orgViewSchema),
|
|
688
|
+
delete: ocBase.input(orgIdOrSlugSchema).output(z.object({ deleted: z.literal(true) }))
|
|
689
|
+
};
|
|
690
|
+
//#endregion
|
|
645
691
|
//#region src/members.ts
|
|
646
692
|
const memberRoleSchema = z.enum([
|
|
647
693
|
"owner",
|
|
@@ -667,10 +713,13 @@ const invitationViewSchema = z.object({
|
|
|
667
713
|
inviterId: z.string(),
|
|
668
714
|
expiresAt: z.number()
|
|
669
715
|
});
|
|
716
|
+
const invitationListItemSchema = invitationViewSchema.extend({ createdAt: z.number() });
|
|
670
717
|
const orgInputSchema = z.object({ orgSlug: orgSlugSchema });
|
|
671
718
|
const memberListOutputSchema = z.object({ items: z.array(memberViewSchema) });
|
|
719
|
+
const invitationListOutputSchema = z.object({ items: z.array(invitationListItemSchema) });
|
|
672
720
|
const members = {
|
|
673
721
|
list: ocBase.input(orgInputSchema).output(memberListOutputSchema),
|
|
722
|
+
listInvitations: ocBase.input(orgInputSchema).output(invitationListOutputSchema),
|
|
674
723
|
invite: ocBase.input(orgInputSchema.extend({
|
|
675
724
|
email: z.email(),
|
|
676
725
|
role: mutableMemberRoleSchema
|
|
@@ -730,6 +779,8 @@ function serializeAnonIdRecord(record) {
|
|
|
730
779
|
}
|
|
731
780
|
//#endregion
|
|
732
781
|
//#region src/index.ts
|
|
782
|
+
/** Contract package version; propagated into OpenAPI `info.version` (ISSUE-0057 V10-D2). */
|
|
783
|
+
const apiVersion = version;
|
|
733
784
|
const contract = {
|
|
734
785
|
anon,
|
|
735
786
|
health,
|
|
@@ -742,4 +793,4 @@ const contract = {
|
|
|
742
793
|
tokens
|
|
743
794
|
};
|
|
744
795
|
//#endregion
|
|
745
|
-
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 };
|
|
796
|
+
export { ANON_ID_STORE_VERSION, CLONE_TOKEN_SCOPE, TOKEN_OPS, anonRepoSchema, apiKeyViewSchema, apiVersion, commonErrors, compareViewSchema, contract, cursorSchema, defaultBranchHint, defaultBranchSchema, diffFileSchema, diffViewSchema, gitBlobSchema, gitCommitSchema, gitRefSchema, gitTreeEntrySchema, invitationListItemSchema, invitationViewSchema, meViewSchema, memberRoleSchema, memberViewSchema, mutableMemberRoleSchema, normalizeDefaultBranch, orgSlugHint, orgSlugSchema, orgViewSchema, parseAnonIdFile, parseRepoName, repoNameHint, repoNameSchema, repoSchema, scopeSchema, serializeAnonIdRecord, tokenOpSchema, tokenScopeSchema, tokenViewSchema };
|