@crowi/api-contract 2.0.0-alpha.6 → 2.0.0-alpha.7
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/generated/openapi.d.mts +291 -1
- package/dist/generated/openapi.d.ts +291 -1
- package/dist/generated/openapi.js.map +1 -1
- package/dist/index.d.mts +1551 -643
- package/dist/index.d.ts +1551 -643
- package/dist/index.js +1319 -1223
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1171 -1080
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -294,14 +294,37 @@ var ForbiddenErrorSchema = ApiErrorSchema.extend({
|
|
|
294
294
|
});
|
|
295
295
|
|
|
296
296
|
// src/schemas/app.ts
|
|
297
|
+
import { z as z4 } from "@hono/zod-openapi";
|
|
298
|
+
|
|
299
|
+
// src/schemas/app-capabilities.ts
|
|
297
300
|
import { z as z3 } from "@hono/zod-openapi";
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
var STATIC_CAPABILITIES = [
|
|
302
|
+
"oauth",
|
|
303
|
+
// The oauth:* tags mirror GRANT_TYPES_SUPPORTED + the S256 PKCE method
|
|
304
|
+
// (schemas/oauth-endpoints.ts / the RFC 8414 discovery doc). Keep in sync.
|
|
305
|
+
"oauth:auth-code",
|
|
306
|
+
"oauth:device",
|
|
307
|
+
"oauth:pkce",
|
|
308
|
+
"pat",
|
|
309
|
+
"pages",
|
|
310
|
+
"comments",
|
|
311
|
+
"bookmarks",
|
|
312
|
+
"attachments",
|
|
313
|
+
"notifications"
|
|
314
|
+
];
|
|
315
|
+
var DYNAMIC_CAPABILITIES = ["search", "collab", "collab:redis"];
|
|
316
|
+
var ALL_CAPABILITIES = [...STATIC_CAPABILITIES, ...DYNAMIC_CAPABILITIES];
|
|
317
|
+
var CapabilitySchema = z3.enum(ALL_CAPABILITIES).openapi("Capability");
|
|
318
|
+
var API_SURFACE_VERSION = "v2";
|
|
319
|
+
|
|
320
|
+
// src/schemas/app.ts
|
|
321
|
+
var AppInfoResponseSchema = z4.object({
|
|
322
|
+
title: z4.string().nullable(),
|
|
323
|
+
confidential: z4.string().nullable(),
|
|
324
|
+
version: z4.string(),
|
|
325
|
+
apiVersion: z4.string(),
|
|
326
|
+
capabilities: z4.array(CapabilitySchema),
|
|
327
|
+
canSelfRegister: z4.boolean()
|
|
305
328
|
});
|
|
306
329
|
|
|
307
330
|
// src/contracts/app.ts
|
|
@@ -335,22 +358,22 @@ var appRoutes = { getAppInfoRoute };
|
|
|
335
358
|
import { createRoute as createRoute2 } from "@hono/zod-openapi";
|
|
336
359
|
|
|
337
360
|
// src/schemas/installer.ts
|
|
338
|
-
import { z as
|
|
339
|
-
var InstallerStatusResponseSchema =
|
|
340
|
-
status:
|
|
341
|
-
});
|
|
342
|
-
var CreateAdminRequestSchema =
|
|
343
|
-
registerForm:
|
|
344
|
-
username:
|
|
345
|
-
name:
|
|
346
|
-
email:
|
|
347
|
-
password:
|
|
361
|
+
import { z as z5 } from "@hono/zod-openapi";
|
|
362
|
+
var InstallerStatusResponseSchema = z5.object({
|
|
363
|
+
status: z5.enum(["installer_required", "already_installed"])
|
|
364
|
+
});
|
|
365
|
+
var CreateAdminRequestSchema = z5.object({
|
|
366
|
+
registerForm: z5.object({
|
|
367
|
+
username: z5.string().min(1).regex(/^[\da-zA-Z\-_.]+$/, "username may only contain letters, digits, hyphens, underscores, and dots"),
|
|
368
|
+
name: z5.string().min(1),
|
|
369
|
+
email: z5.string().email(),
|
|
370
|
+
password: z5.string().min(6).regex(/^[\x20-\x7F]{6,}$/, "password must be 6+ printable ASCII characters")
|
|
348
371
|
})
|
|
349
372
|
});
|
|
350
|
-
var CreateAdminResponseSchema =
|
|
351
|
-
status:
|
|
352
|
-
message:
|
|
353
|
-
errors:
|
|
373
|
+
var CreateAdminResponseSchema = z5.object({
|
|
374
|
+
status: z5.enum(["ok", "error"]),
|
|
375
|
+
message: z5.string().optional(),
|
|
376
|
+
errors: z5.array(z5.string()).optional()
|
|
354
377
|
});
|
|
355
378
|
|
|
356
379
|
// src/contracts/installer.ts
|
|
@@ -422,53 +445,53 @@ var createAdminRoute = createRoute2({
|
|
|
422
445
|
var installerRoutes = { getInstallerStatusRoute, createAdminRoute };
|
|
423
446
|
|
|
424
447
|
// src/contracts/tokenAuth.ts
|
|
425
|
-
import { createRoute as createRoute3, z as
|
|
448
|
+
import { createRoute as createRoute3, z as z7 } from "@hono/zod-openapi";
|
|
426
449
|
|
|
427
450
|
// src/schemas/auth.ts
|
|
428
|
-
import { z as
|
|
429
|
-
var TokenAuthLoginRequestSchema =
|
|
430
|
-
email:
|
|
431
|
-
password:
|
|
432
|
-
});
|
|
433
|
-
var TokenAuthResponseSchema =
|
|
434
|
-
accessToken:
|
|
435
|
-
refreshToken:
|
|
436
|
-
expiresIn:
|
|
451
|
+
import { z as z6 } from "@hono/zod-openapi";
|
|
452
|
+
var TokenAuthLoginRequestSchema = z6.object({
|
|
453
|
+
email: z6.string().email(),
|
|
454
|
+
password: z6.string().min(6)
|
|
455
|
+
});
|
|
456
|
+
var TokenAuthResponseSchema = z6.object({
|
|
457
|
+
accessToken: z6.string(),
|
|
458
|
+
refreshToken: z6.string(),
|
|
459
|
+
expiresIn: z6.number(),
|
|
437
460
|
// seconds until expiration
|
|
438
|
-
user:
|
|
439
|
-
id:
|
|
440
|
-
username:
|
|
441
|
-
email:
|
|
442
|
-
name:
|
|
443
|
-
image:
|
|
444
|
-
admin:
|
|
461
|
+
user: z6.object({
|
|
462
|
+
id: z6.string(),
|
|
463
|
+
username: z6.string(),
|
|
464
|
+
email: z6.string().email(),
|
|
465
|
+
name: z6.string(),
|
|
466
|
+
image: z6.string().optional(),
|
|
467
|
+
admin: z6.boolean().optional()
|
|
445
468
|
})
|
|
446
469
|
});
|
|
447
|
-
var RefreshTokenRequestSchema =
|
|
448
|
-
refreshToken:
|
|
470
|
+
var RefreshTokenRequestSchema = z6.object({
|
|
471
|
+
refreshToken: z6.string()
|
|
449
472
|
});
|
|
450
|
-
var TokenAuthRegisterRequestSchema =
|
|
451
|
-
username:
|
|
452
|
-
name:
|
|
453
|
-
email:
|
|
454
|
-
password:
|
|
473
|
+
var TokenAuthRegisterRequestSchema = z6.object({
|
|
474
|
+
username: z6.string(),
|
|
475
|
+
name: z6.string(),
|
|
476
|
+
email: z6.string().email(),
|
|
477
|
+
password: z6.string().min(6)
|
|
455
478
|
});
|
|
456
|
-
var RegisterPendingResponseSchema =
|
|
457
|
-
status:
|
|
479
|
+
var RegisterPendingResponseSchema = z6.object({
|
|
480
|
+
status: z6.enum(["confirmation_required", "approval_required"])
|
|
458
481
|
});
|
|
459
482
|
|
|
460
483
|
// src/contracts/tokenAuth.ts
|
|
461
|
-
var TokenLogoutResponseSchema =
|
|
462
|
-
var TokenMeResponseSchema =
|
|
463
|
-
user:
|
|
464
|
-
id:
|
|
465
|
-
username:
|
|
466
|
-
email:
|
|
467
|
-
name:
|
|
468
|
-
image:
|
|
469
|
-
status:
|
|
470
|
-
admin:
|
|
471
|
-
createdAt:
|
|
484
|
+
var TokenLogoutResponseSchema = z7.object({ message: z7.string() });
|
|
485
|
+
var TokenMeResponseSchema = z7.object({
|
|
486
|
+
user: z7.object({
|
|
487
|
+
id: z7.string(),
|
|
488
|
+
username: z7.string(),
|
|
489
|
+
email: z7.string().email(),
|
|
490
|
+
name: z7.string(),
|
|
491
|
+
image: z7.string().optional(),
|
|
492
|
+
status: z7.number(),
|
|
493
|
+
admin: z7.boolean().optional(),
|
|
494
|
+
createdAt: z7.string()
|
|
472
495
|
})
|
|
473
496
|
});
|
|
474
497
|
var tokenLoginRoute = createRoute3({
|
|
@@ -596,7 +619,7 @@ var tokenLogoutRoute = createRoute3({
|
|
|
596
619
|
body: {
|
|
597
620
|
content: {
|
|
598
621
|
"application/json": {
|
|
599
|
-
schema:
|
|
622
|
+
schema: z7.object({ refreshToken: z7.string().optional() })
|
|
600
623
|
}
|
|
601
624
|
}
|
|
602
625
|
}
|
|
@@ -649,15 +672,15 @@ var tokenAuthRoutes = {
|
|
|
649
672
|
import { createRoute as createRoute4 } from "@hono/zod-openapi";
|
|
650
673
|
|
|
651
674
|
// src/schemas/inviteAccept.ts
|
|
652
|
-
import { z as
|
|
653
|
-
var InviteAcceptRequestSchema =
|
|
654
|
-
token:
|
|
655
|
-
username:
|
|
656
|
-
name:
|
|
657
|
-
password:
|
|
675
|
+
import { z as z8 } from "@hono/zod-openapi";
|
|
676
|
+
var InviteAcceptRequestSchema = z8.object({
|
|
677
|
+
token: z8.string(),
|
|
678
|
+
username: z8.string().min(1),
|
|
679
|
+
name: z8.string().min(1),
|
|
680
|
+
password: z8.string().min(6)
|
|
658
681
|
});
|
|
659
|
-
var InvitePreviewResponseSchema =
|
|
660
|
-
email:
|
|
682
|
+
var InvitePreviewResponseSchema = z8.object({
|
|
683
|
+
email: z8.string().email()
|
|
661
684
|
});
|
|
662
685
|
|
|
663
686
|
// src/contracts/inviteAccept.ts
|
|
@@ -734,16 +757,16 @@ var inviteAcceptRoutes = {
|
|
|
734
757
|
import { createRoute as createRoute5 } from "@hono/zod-openapi";
|
|
735
758
|
|
|
736
759
|
// src/schemas/passwordReset.ts
|
|
737
|
-
import { z as
|
|
738
|
-
var ForgotPasswordRequestSchema =
|
|
739
|
-
email:
|
|
760
|
+
import { z as z9 } from "@hono/zod-openapi";
|
|
761
|
+
var ForgotPasswordRequestSchema = z9.object({
|
|
762
|
+
email: z9.string().email()
|
|
740
763
|
});
|
|
741
|
-
var ForgotPasswordResponseSchema =
|
|
742
|
-
ok:
|
|
764
|
+
var ForgotPasswordResponseSchema = z9.object({
|
|
765
|
+
ok: z9.literal(true)
|
|
743
766
|
});
|
|
744
|
-
var ResetPasswordRequestSchema =
|
|
745
|
-
token:
|
|
746
|
-
password:
|
|
767
|
+
var ResetPasswordRequestSchema = z9.object({
|
|
768
|
+
token: z9.string(),
|
|
769
|
+
password: z9.string().min(6)
|
|
747
770
|
});
|
|
748
771
|
|
|
749
772
|
// src/contracts/passwordReset.ts
|
|
@@ -838,12 +861,12 @@ var passwordResetRoutes = {
|
|
|
838
861
|
import { createRoute as createRoute6 } from "@hono/zod-openapi";
|
|
839
862
|
|
|
840
863
|
// src/schemas/activation.ts
|
|
841
|
-
import { z as
|
|
842
|
-
var ActivateRequestSchema =
|
|
843
|
-
token:
|
|
864
|
+
import { z as z10 } from "@hono/zod-openapi";
|
|
865
|
+
var ActivateRequestSchema = z10.object({
|
|
866
|
+
token: z10.string()
|
|
844
867
|
});
|
|
845
|
-
var ActivateValidationResponseSchema =
|
|
846
|
-
ok:
|
|
868
|
+
var ActivateValidationResponseSchema = z10.object({
|
|
869
|
+
ok: z10.literal(true)
|
|
847
870
|
});
|
|
848
871
|
|
|
849
872
|
// src/contracts/activation.ts
|
|
@@ -908,14 +931,14 @@ var activationRoutes = {
|
|
|
908
931
|
import { createRoute as createRoute7 } from "@hono/zod-openapi";
|
|
909
932
|
|
|
910
933
|
// src/schemas/emailChange.ts
|
|
911
|
-
import { z as
|
|
912
|
-
var ConfirmEmailChangeRequestSchema =
|
|
913
|
-
token:
|
|
934
|
+
import { z as z11 } from "@hono/zod-openapi";
|
|
935
|
+
var ConfirmEmailChangeRequestSchema = z11.object({
|
|
936
|
+
token: z11.string()
|
|
914
937
|
});
|
|
915
|
-
var ConfirmEmailChangeResponseSchema =
|
|
916
|
-
ok:
|
|
938
|
+
var ConfirmEmailChangeResponseSchema = z11.object({
|
|
939
|
+
ok: z11.literal(true),
|
|
917
940
|
/** The newly-confirmed email address. */
|
|
918
|
-
email:
|
|
941
|
+
email: z11.string().email()
|
|
919
942
|
});
|
|
920
943
|
|
|
921
944
|
// src/contracts/emailChange.ts
|
|
@@ -981,19 +1004,19 @@ var emailChangeRoutes = {
|
|
|
981
1004
|
};
|
|
982
1005
|
|
|
983
1006
|
// src/contracts/me.ts
|
|
984
|
-
import { createRoute as createRoute8, z as
|
|
1007
|
+
import { createRoute as createRoute8, z as z16 } from "@hono/zod-openapi";
|
|
985
1008
|
|
|
986
1009
|
// src/schemas/me.ts
|
|
987
|
-
import { z as
|
|
1010
|
+
import { z as z15 } from "@hono/zod-openapi";
|
|
988
1011
|
|
|
989
1012
|
// src/schemas/page.ts
|
|
990
|
-
import { z as
|
|
1013
|
+
import { z as z14 } from "@hono/zod-openapi";
|
|
991
1014
|
|
|
992
1015
|
// src/schemas/collab.ts
|
|
993
|
-
import { z as
|
|
1016
|
+
import { z as z13 } from "@hono/zod-openapi";
|
|
994
1017
|
|
|
995
1018
|
// src/schemas/userPublic.ts
|
|
996
|
-
import { z as
|
|
1019
|
+
import { z as z12 } from "@hono/zod-openapi";
|
|
997
1020
|
var UserPublicStatus = {
|
|
998
1021
|
REGISTERED: 1,
|
|
999
1022
|
ACTIVE: 2,
|
|
@@ -1001,64 +1024,64 @@ var UserPublicStatus = {
|
|
|
1001
1024
|
DELETED: 4,
|
|
1002
1025
|
INVITED: 5
|
|
1003
1026
|
};
|
|
1004
|
-
var UserPublicStatusSchema =
|
|
1005
|
-
var UserPublicSchema =
|
|
1006
|
-
_id:
|
|
1007
|
-
id:
|
|
1027
|
+
var UserPublicStatusSchema = z12.nativeEnum(UserPublicStatus);
|
|
1028
|
+
var UserPublicSchema = z12.object({
|
|
1029
|
+
_id: z12.string(),
|
|
1030
|
+
id: z12.string().optional(),
|
|
1008
1031
|
// for compatibility (virtual field)
|
|
1009
|
-
username:
|
|
1010
|
-
name:
|
|
1011
|
-
email:
|
|
1012
|
-
image:
|
|
1013
|
-
introduction:
|
|
1014
|
-
createdAt:
|
|
1015
|
-
admin:
|
|
1032
|
+
username: z12.string(),
|
|
1033
|
+
name: z12.string(),
|
|
1034
|
+
email: z12.string().email(),
|
|
1035
|
+
image: z12.string().nullable().optional(),
|
|
1036
|
+
introduction: z12.string().optional(),
|
|
1037
|
+
createdAt: z12.string(),
|
|
1038
|
+
admin: z12.boolean().optional(),
|
|
1016
1039
|
status: UserPublicStatusSchema.optional()
|
|
1017
1040
|
});
|
|
1018
1041
|
|
|
1019
1042
|
// src/schemas/collab.ts
|
|
1020
1043
|
var ContributorRefSchema = UserPublicSchema;
|
|
1021
|
-
var RevisionTypeSchema =
|
|
1022
|
-
var WsTokenResponseSchema =
|
|
1023
|
-
wsToken:
|
|
1024
|
-
pageId:
|
|
1025
|
-
expiresAt:
|
|
1026
|
-
readonly:
|
|
1027
|
-
});
|
|
1028
|
-
var WsTokenPayloadSchema =
|
|
1029
|
-
userId:
|
|
1030
|
-
pageId:
|
|
1031
|
-
readonly:
|
|
1032
|
-
iat:
|
|
1033
|
-
exp:
|
|
1034
|
-
});
|
|
1035
|
-
var CollabSaveMessageSchema =
|
|
1036
|
-
kind:
|
|
1037
|
-
message:
|
|
1038
|
-
});
|
|
1039
|
-
var CollabSaveOkSchema =
|
|
1040
|
-
kind:
|
|
1041
|
-
revisionId:
|
|
1042
|
-
});
|
|
1043
|
-
var CollabSaveErrorSchema =
|
|
1044
|
-
kind:
|
|
1045
|
-
code:
|
|
1046
|
-
message:
|
|
1047
|
-
});
|
|
1048
|
-
var CollabForceReloadMessageSchema =
|
|
1049
|
-
kind:
|
|
1050
|
-
reason:
|
|
1044
|
+
var RevisionTypeSchema = z13.enum(["snapshot", "incremental"]);
|
|
1045
|
+
var WsTokenResponseSchema = z13.object({
|
|
1046
|
+
wsToken: z13.string(),
|
|
1047
|
+
pageId: z13.string(),
|
|
1048
|
+
expiresAt: z13.string(),
|
|
1049
|
+
readonly: z13.boolean()
|
|
1050
|
+
});
|
|
1051
|
+
var WsTokenPayloadSchema = z13.object({
|
|
1052
|
+
userId: z13.string(),
|
|
1053
|
+
pageId: z13.string(),
|
|
1054
|
+
readonly: z13.boolean(),
|
|
1055
|
+
iat: z13.number().int(),
|
|
1056
|
+
exp: z13.number().int()
|
|
1057
|
+
});
|
|
1058
|
+
var CollabSaveMessageSchema = z13.object({
|
|
1059
|
+
kind: z13.literal("crowi:save"),
|
|
1060
|
+
message: z13.string().optional()
|
|
1061
|
+
});
|
|
1062
|
+
var CollabSaveOkSchema = z13.object({
|
|
1063
|
+
kind: z13.literal("crowi:save-ok"),
|
|
1064
|
+
revisionId: z13.string()
|
|
1065
|
+
});
|
|
1066
|
+
var CollabSaveErrorSchema = z13.object({
|
|
1067
|
+
kind: z13.literal("crowi:save-error"),
|
|
1068
|
+
code: z13.string(),
|
|
1069
|
+
message: z13.string()
|
|
1070
|
+
});
|
|
1071
|
+
var CollabForceReloadMessageSchema = z13.object({
|
|
1072
|
+
kind: z13.literal("crowi:force-reload"),
|
|
1073
|
+
reason: z13.string().optional()
|
|
1051
1074
|
});
|
|
1052
1075
|
|
|
1053
1076
|
// src/schemas/page.ts
|
|
1054
|
-
var PageGrantSchema =
|
|
1077
|
+
var PageGrantSchema = z14.enum(["1", "2", "3", "4"]).transform((val) => Number(val));
|
|
1055
1078
|
var PageGrantEnum = {
|
|
1056
1079
|
PUBLIC: 1,
|
|
1057
1080
|
RESTRICTED: 2,
|
|
1058
1081
|
SPECIFIED: 3,
|
|
1059
1082
|
OWNER: 4
|
|
1060
1083
|
};
|
|
1061
|
-
var PageStatusSchema =
|
|
1084
|
+
var PageStatusSchema = z14.enum(["wip", "published", "deleted", "deprecated", "draft"]);
|
|
1062
1085
|
var PageStatusEnum = {
|
|
1063
1086
|
WIP: "wip",
|
|
1064
1087
|
PUBLISHED: "published",
|
|
@@ -1066,51 +1089,51 @@ var PageStatusEnum = {
|
|
|
1066
1089
|
DEPRECATED: "deprecated",
|
|
1067
1090
|
DRAFT: "draft"
|
|
1068
1091
|
};
|
|
1069
|
-
var PageTypeSchema =
|
|
1092
|
+
var PageTypeSchema = z14.enum(["portal", "user", "public"]);
|
|
1070
1093
|
var PageTypeEnum = {
|
|
1071
1094
|
PORTAL: "portal",
|
|
1072
1095
|
USER: "user",
|
|
1073
1096
|
PUBLIC: "public"
|
|
1074
1097
|
};
|
|
1075
|
-
var PageUserSchema =
|
|
1076
|
-
_id:
|
|
1077
|
-
id:
|
|
1098
|
+
var PageUserSchema = z14.object({
|
|
1099
|
+
_id: z14.string(),
|
|
1100
|
+
id: z14.string().optional(),
|
|
1078
1101
|
// for compatibility
|
|
1079
|
-
username:
|
|
1080
|
-
name:
|
|
1081
|
-
email:
|
|
1082
|
-
image:
|
|
1083
|
-
createdAt:
|
|
1084
|
-
});
|
|
1085
|
-
var TocEntrySchema =
|
|
1086
|
-
level:
|
|
1087
|
-
text:
|
|
1088
|
-
anchorId:
|
|
1089
|
-
});
|
|
1090
|
-
var WikiLinkSchema =
|
|
1102
|
+
username: z14.string(),
|
|
1103
|
+
name: z14.string(),
|
|
1104
|
+
email: z14.string().email(),
|
|
1105
|
+
image: z14.string().nullable().optional(),
|
|
1106
|
+
createdAt: z14.string()
|
|
1107
|
+
});
|
|
1108
|
+
var TocEntrySchema = z14.object({
|
|
1109
|
+
level: z14.number().int().min(1).max(6),
|
|
1110
|
+
text: z14.string(),
|
|
1111
|
+
anchorId: z14.string()
|
|
1112
|
+
});
|
|
1113
|
+
var WikiLinkSchema = z14.object({
|
|
1091
1114
|
/** Verbatim source between the `[[` `]]` (no surrounding brackets). */
|
|
1092
|
-
raw:
|
|
1115
|
+
raw: z14.string(),
|
|
1093
1116
|
/** Normalised target (left of the `|`, fragment trimmed for resolution). */
|
|
1094
|
-
target:
|
|
1117
|
+
target: z14.string(),
|
|
1095
1118
|
/** Optional pipe-aliased display text (right of the `|`). */
|
|
1096
|
-
displayText:
|
|
1097
|
-
});
|
|
1098
|
-
var MentionSchema =
|
|
1099
|
-
username:
|
|
1100
|
-
});
|
|
1101
|
-
var RevisionMetaSchemaShape =
|
|
1102
|
-
toc:
|
|
1103
|
-
wikiLinks:
|
|
1104
|
-
mentions:
|
|
1105
|
-
codeBlockLanguages:
|
|
1106
|
-
});
|
|
1107
|
-
var RevisionSchema =
|
|
1108
|
-
_id:
|
|
1109
|
-
path:
|
|
1110
|
-
body:
|
|
1111
|
-
format:
|
|
1119
|
+
displayText: z14.string().optional()
|
|
1120
|
+
});
|
|
1121
|
+
var MentionSchema = z14.object({
|
|
1122
|
+
username: z14.string()
|
|
1123
|
+
});
|
|
1124
|
+
var RevisionMetaSchemaShape = z14.object({
|
|
1125
|
+
toc: z14.array(TocEntrySchema).optional(),
|
|
1126
|
+
wikiLinks: z14.array(WikiLinkSchema).optional(),
|
|
1127
|
+
mentions: z14.array(MentionSchema).optional(),
|
|
1128
|
+
codeBlockLanguages: z14.array(z14.string()).optional()
|
|
1129
|
+
});
|
|
1130
|
+
var RevisionSchema = z14.object({
|
|
1131
|
+
_id: z14.string(),
|
|
1132
|
+
path: z14.string(),
|
|
1133
|
+
body: z14.string(),
|
|
1134
|
+
format: z14.string().default("markdown"),
|
|
1112
1135
|
author: PageUserSchema.nullable().optional(),
|
|
1113
|
-
createdAt:
|
|
1136
|
+
createdAt: z14.string(),
|
|
1114
1137
|
meta: RevisionMetaSchemaShape.optional(),
|
|
1115
1138
|
// RFC-0002 Phase 3: transformed mdast (parse + core plugins +
|
|
1116
1139
|
// shiki) for the web client to render without re-parsing the body.
|
|
@@ -1118,42 +1141,42 @@ var RevisionSchema = z13.object({
|
|
|
1118
1141
|
// spec to maintain a strict Zod schema for. Only single-page detail
|
|
1119
1142
|
// (`getPage`) and single-revision detail (`getRevision`) emit it;
|
|
1120
1143
|
// list endpoints skip it for payload weight.
|
|
1121
|
-
renderedAst:
|
|
1144
|
+
renderedAst: z14.unknown().optional(),
|
|
1122
1145
|
// RFC-0002 round 3.1: semver of the renderer pipeline that produced
|
|
1123
1146
|
// `renderedAst`. The read path uses this to detect stale entries
|
|
1124
1147
|
// (rebuilt by `renderer:rebuild` once RFC-0008 lands). Absent on
|
|
1125
1148
|
// revisions saved before this field was introduced.
|
|
1126
|
-
rendererVersion:
|
|
1149
|
+
rendererVersion: z14.string().optional(),
|
|
1127
1150
|
// RFC-0003 collaborative-save fields. All optional; v1.x revisions
|
|
1128
1151
|
// emit none of them. See `packages/api/src/models/revision.ts` for
|
|
1129
1152
|
// semantics. The list-page endpoint currently does not surface
|
|
1130
1153
|
// these — they only appear on the Phase 5+ checkpoint Revisions
|
|
1131
1154
|
// produced by Hocuspocus and on the single-revision detail route.
|
|
1132
|
-
parentRevisionId:
|
|
1155
|
+
parentRevisionId: z14.string().nullable().optional(),
|
|
1133
1156
|
type: RevisionTypeSchema.optional(),
|
|
1134
|
-
savedBy:
|
|
1135
|
-
contributors:
|
|
1136
|
-
message:
|
|
1157
|
+
savedBy: z14.union([z14.string(), PageUserSchema]).nullable().optional(),
|
|
1158
|
+
contributors: z14.array(z14.union([z14.string(), PageUserSchema])).optional(),
|
|
1159
|
+
message: z14.string().optional(),
|
|
1137
1160
|
// RFC-0010 — edit channel ('web' | 'oauth' | 'pat'); absent on
|
|
1138
1161
|
// pre-RFC-0010 / collaborative / browser revisions.
|
|
1139
|
-
editVia:
|
|
1140
|
-
});
|
|
1141
|
-
var PageExtendedSchema =
|
|
1142
|
-
var PageSchema =
|
|
1143
|
-
_id:
|
|
1144
|
-
path:
|
|
1145
|
-
revision:
|
|
1146
|
-
redirectTo:
|
|
1162
|
+
editVia: z14.enum(["web", "oauth", "pat"]).optional()
|
|
1163
|
+
});
|
|
1164
|
+
var PageExtendedSchema = z14.record(z14.string(), z14.any()).optional();
|
|
1165
|
+
var PageSchema = z14.object({
|
|
1166
|
+
_id: z14.string(),
|
|
1167
|
+
path: z14.string(),
|
|
1168
|
+
revision: z14.union([z14.string(), RevisionSchema]).optional(),
|
|
1169
|
+
redirectTo: z14.string().nullable().optional(),
|
|
1147
1170
|
status: PageStatusSchema.nullable().optional(),
|
|
1148
|
-
grant:
|
|
1149
|
-
grantedUsers:
|
|
1150
|
-
creator:
|
|
1151
|
-
lastUpdateUser:
|
|
1152
|
-
liker:
|
|
1153
|
-
commentCount:
|
|
1171
|
+
grant: z14.number().optional(),
|
|
1172
|
+
grantedUsers: z14.array(z14.string()).optional(),
|
|
1173
|
+
creator: z14.union([z14.string(), PageUserSchema]).nullable().optional(),
|
|
1174
|
+
lastUpdateUser: z14.union([z14.string(), PageUserSchema]).nullable().optional(),
|
|
1175
|
+
liker: z14.array(z14.string()).optional(),
|
|
1176
|
+
commentCount: z14.number().default(0),
|
|
1154
1177
|
extended: PageExtendedSchema,
|
|
1155
|
-
createdAt:
|
|
1156
|
-
updatedAt:
|
|
1178
|
+
createdAt: z14.string(),
|
|
1179
|
+
updatedAt: z14.string().optional(),
|
|
1157
1180
|
// RFC-0003 collaborative-edit fields. All optional; `null` is the
|
|
1158
1181
|
// "no live state yet" value. Existing read endpoints (list /
|
|
1159
1182
|
// detail) do not currently emit these — the contract is widened
|
|
@@ -1161,31 +1184,32 @@ var PageSchema = z13.object({
|
|
|
1161
1184
|
// bump. `yjsState` is intentionally omitted from the contract:
|
|
1162
1185
|
// the binary blob lives only inside Hocuspocus and never crosses
|
|
1163
1186
|
// the HTTP API.
|
|
1164
|
-
currentRevision:
|
|
1165
|
-
yjsCheckpointAt:
|
|
1187
|
+
currentRevision: z14.string().nullable().optional(),
|
|
1188
|
+
yjsCheckpointAt: z14.string().nullable().optional(),
|
|
1166
1189
|
// dynamic fields
|
|
1167
|
-
latestRevision:
|
|
1168
|
-
likerCount:
|
|
1169
|
-
seenUsersCount:
|
|
1190
|
+
latestRevision: z14.string().optional(),
|
|
1191
|
+
likerCount: z14.number().optional(),
|
|
1192
|
+
seenUsersCount: z14.number().optional()
|
|
1170
1193
|
});
|
|
1171
1194
|
var PageWithRevisionSchema = PageSchema.extend({
|
|
1172
1195
|
revision: RevisionSchema,
|
|
1173
1196
|
creator: PageUserSchema.nullable().optional(),
|
|
1174
1197
|
lastUpdateUser: PageUserSchema.nullable().optional()
|
|
1175
1198
|
});
|
|
1176
|
-
var GetPageRequestSchema =
|
|
1177
|
-
path:
|
|
1178
|
-
page_id:
|
|
1179
|
-
revision_id:
|
|
1199
|
+
var GetPageRequestSchema = z14.object({
|
|
1200
|
+
path: z14.string().optional(),
|
|
1201
|
+
page_id: z14.string().optional(),
|
|
1202
|
+
revision_id: z14.string().optional()
|
|
1180
1203
|
});
|
|
1181
|
-
var GetPageResponseSchema =
|
|
1204
|
+
var GetPageResponseSchema = z14.object({
|
|
1182
1205
|
page: PageWithRevisionSchema
|
|
1183
1206
|
});
|
|
1184
|
-
var
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1207
|
+
var ClaimPageLinkAccessResponseSchema = GetPageResponseSchema.extend({ granted: z14.boolean() });
|
|
1208
|
+
var ListPagesRequestSchema = z14.object({
|
|
1209
|
+
path: z14.string().optional(),
|
|
1210
|
+
user: z14.string().optional(),
|
|
1211
|
+
limit: z14.coerce.number().optional().default(50),
|
|
1212
|
+
offset: z14.coerce.number().optional().default(0),
|
|
1189
1213
|
// NOT `z.coerce.boolean()`: that uses JS `Boolean(v)`, so the string
|
|
1190
1214
|
// `"false"` (which is how the web client serialises `false` on the
|
|
1191
1215
|
// query string) coerces to `true`. That silently flipped
|
|
@@ -1193,25 +1217,25 @@ var ListPagesRequestSchema = z13.object({
|
|
|
1193
1217
|
// filter and leak other users' drafts. Parse the string explicitly so
|
|
1194
1218
|
// only `"true"` / `true` is truthy; anything else (incl. `"false"`,
|
|
1195
1219
|
// absent) is `false`.
|
|
1196
|
-
include_deleted:
|
|
1220
|
+
include_deleted: z14.preprocess((v) => v === true || v === "true" || v === "1", z14.boolean()).optional().default(false),
|
|
1197
1221
|
// Sort field + direction for the listing. Defaults preserve the legacy
|
|
1198
1222
|
// "newest-updated first" order so existing callers are unaffected.
|
|
1199
1223
|
// `path` sorts alphabetically by full page path (≈ name order).
|
|
1200
|
-
sort:
|
|
1201
|
-
order:
|
|
1224
|
+
sort: z14.enum(["updatedAt", "createdAt", "path"]).optional().default("updatedAt"),
|
|
1225
|
+
order: z14.enum(["asc", "desc"]).optional().default("desc"),
|
|
1202
1226
|
// When listing a portal path (`/foo/`), open the portal document at this
|
|
1203
1227
|
// past revision so the catch-all can mirror `?revision_id=` on portals.
|
|
1204
1228
|
// Only the `portalPage` is rewound — the child rows always reflect the
|
|
1205
1229
|
// latest. Absent for normal listings.
|
|
1206
|
-
revision_id:
|
|
1230
|
+
revision_id: z14.string().optional()
|
|
1207
1231
|
});
|
|
1208
|
-
var PagerSchema =
|
|
1209
|
-
prev:
|
|
1210
|
-
next:
|
|
1211
|
-
offset:
|
|
1232
|
+
var PagerSchema = z14.object({
|
|
1233
|
+
prev: z14.number().nullable(),
|
|
1234
|
+
next: z14.number().nullable(),
|
|
1235
|
+
offset: z14.number()
|
|
1212
1236
|
});
|
|
1213
|
-
var ListPagesResponseSchema =
|
|
1214
|
-
pages:
|
|
1237
|
+
var ListPagesResponseSchema = z14.object({
|
|
1238
|
+
pages: z14.array(PageSchema),
|
|
1215
1239
|
pager: PagerSchema,
|
|
1216
1240
|
portalPage: PageSchema.nullable().optional(),
|
|
1217
1241
|
// When listing a portal path (`/foo/`) that has NO portal document of
|
|
@@ -1223,204 +1247,204 @@ var ListPagesResponseSchema = z13.object({
|
|
|
1223
1247
|
// listings.
|
|
1224
1248
|
contentPage: PageSchema.nullable().optional()
|
|
1225
1249
|
});
|
|
1226
|
-
var PageChildSegmentSchema =
|
|
1250
|
+
var PageChildSegmentSchema = z14.object({
|
|
1227
1251
|
// The bare segment name immediately under the queried path
|
|
1228
1252
|
// (e.g. 'rfc' for /crowi/rfc/... when querying /crowi/).
|
|
1229
|
-
segment:
|
|
1253
|
+
segment: z14.string(),
|
|
1230
1254
|
// Portal-style path for this segment (always trailing-slashed),
|
|
1231
1255
|
// e.g. '/crowi/rfc/'. Drop the trailing slash for the page path when
|
|
1232
1256
|
// the segment is a leaf page (see `isPage`).
|
|
1233
|
-
path:
|
|
1257
|
+
path: z14.string(),
|
|
1234
1258
|
// True when a real page is saved at the segment path itself
|
|
1235
1259
|
// (e.g. `/crowi/rfc`, no trailing slash) — i.e. the segment is a
|
|
1236
1260
|
// navigable page, not only an inferred directory.
|
|
1237
|
-
isPage:
|
|
1261
|
+
isPage: z14.boolean(),
|
|
1238
1262
|
// True when a real portal page is saved at `path` (→ compass icon).
|
|
1239
|
-
hasPortal:
|
|
1263
|
+
hasPortal: z14.boolean(),
|
|
1240
1264
|
// Number of descendant content pages strictly under this segment
|
|
1241
1265
|
// (excludes the segment's own page / portal docs). A rough "how much
|
|
1242
1266
|
// lives here" hint; > 0 means the segment is an expandable directory.
|
|
1243
|
-
count:
|
|
1267
|
+
count: z14.number()
|
|
1244
1268
|
});
|
|
1245
|
-
var ListPageChildrenRequestSchema =
|
|
1269
|
+
var ListPageChildrenRequestSchema = z14.object({
|
|
1246
1270
|
// Portal path to list children of. Trailing slash optional — the
|
|
1247
1271
|
// handler normalises it. '/' lists the top-level segments.
|
|
1248
|
-
path:
|
|
1272
|
+
path: z14.string()
|
|
1249
1273
|
});
|
|
1250
|
-
var ListPageChildrenResponseSchema =
|
|
1274
|
+
var ListPageChildrenResponseSchema = z14.object({
|
|
1251
1275
|
// Sorted alphabetically by segment.
|
|
1252
|
-
children:
|
|
1253
|
-
});
|
|
1254
|
-
var CreatePageRequestSchema =
|
|
1255
|
-
path:
|
|
1256
|
-
body:
|
|
1257
|
-
grant:
|
|
1258
|
-
});
|
|
1259
|
-
var UpdatePageRequestSchema =
|
|
1260
|
-
page_id:
|
|
1261
|
-
body:
|
|
1262
|
-
revision_id:
|
|
1263
|
-
grant:
|
|
1264
|
-
});
|
|
1265
|
-
var RevertToRevisionRequestSchema =
|
|
1266
|
-
page_id:
|
|
1267
|
-
revision_id:
|
|
1268
|
-
});
|
|
1269
|
-
var SetPageGrantRequestSchema =
|
|
1270
|
-
page_id:
|
|
1271
|
-
grant:
|
|
1272
|
-
});
|
|
1273
|
-
var RenamePageRequestSchema =
|
|
1274
|
-
page_id:
|
|
1275
|
-
new_path:
|
|
1276
|
-
revision_id:
|
|
1277
|
-
create_redirect:
|
|
1276
|
+
children: z14.array(PageChildSegmentSchema)
|
|
1277
|
+
});
|
|
1278
|
+
var CreatePageRequestSchema = z14.object({
|
|
1279
|
+
path: z14.string(),
|
|
1280
|
+
body: z14.string(),
|
|
1281
|
+
grant: z14.number().optional()
|
|
1282
|
+
});
|
|
1283
|
+
var UpdatePageRequestSchema = z14.object({
|
|
1284
|
+
page_id: z14.string(),
|
|
1285
|
+
body: z14.string(),
|
|
1286
|
+
revision_id: z14.string().optional(),
|
|
1287
|
+
grant: z14.number().optional()
|
|
1288
|
+
});
|
|
1289
|
+
var RevertToRevisionRequestSchema = z14.object({
|
|
1290
|
+
page_id: z14.string(),
|
|
1291
|
+
revision_id: z14.string()
|
|
1292
|
+
});
|
|
1293
|
+
var SetPageGrantRequestSchema = z14.object({
|
|
1294
|
+
page_id: z14.string(),
|
|
1295
|
+
grant: z14.number().int()
|
|
1296
|
+
});
|
|
1297
|
+
var RenamePageRequestSchema = z14.object({
|
|
1298
|
+
page_id: z14.string(),
|
|
1299
|
+
new_path: z14.string(),
|
|
1300
|
+
revision_id: z14.string().optional(),
|
|
1301
|
+
create_redirect: z14.boolean().optional(),
|
|
1278
1302
|
// When true, rename the page together with its whole (grant-visible)
|
|
1279
1303
|
// descendant subtree (renameTree) instead of just the single page.
|
|
1280
1304
|
// Defaults to false — the single-page rename behaviour.
|
|
1281
|
-
include_descendants:
|
|
1305
|
+
include_descendants: z14.boolean().optional()
|
|
1282
1306
|
});
|
|
1283
|
-
var RenamePageResponseSchema =
|
|
1307
|
+
var RenamePageResponseSchema = z14.object({
|
|
1284
1308
|
page: PageSchema,
|
|
1285
|
-
renamed_count:
|
|
1286
|
-
});
|
|
1287
|
-
var RenameTreeErrorSchema =
|
|
1288
|
-
error:
|
|
1289
|
-
code:
|
|
1290
|
-
message:
|
|
1291
|
-
conflicts:
|
|
1292
|
-
|
|
1293
|
-
path:
|
|
1294
|
-
reasons:
|
|
1309
|
+
renamed_count: z14.number()
|
|
1310
|
+
});
|
|
1311
|
+
var RenameTreeErrorSchema = z14.object({
|
|
1312
|
+
error: z14.object({
|
|
1313
|
+
code: z14.literal("PAGE_RENAME_TREE_FAILED"),
|
|
1314
|
+
message: z14.string(),
|
|
1315
|
+
conflicts: z14.array(
|
|
1316
|
+
z14.object({
|
|
1317
|
+
path: z14.string(),
|
|
1318
|
+
reasons: z14.array(z14.string())
|
|
1295
1319
|
})
|
|
1296
1320
|
),
|
|
1297
1321
|
// True when the failure happened after some pages were already moved
|
|
1298
1322
|
// (non-transactional best-effort). When omitted/false the failure was
|
|
1299
1323
|
// detected up-front and nothing was moved.
|
|
1300
|
-
partial:
|
|
1324
|
+
partial: z14.boolean().optional()
|
|
1301
1325
|
})
|
|
1302
1326
|
});
|
|
1303
|
-
var RenameSubtreeRequestSchema =
|
|
1304
|
-
old_path:
|
|
1305
|
-
new_path:
|
|
1306
|
-
create_redirect:
|
|
1327
|
+
var RenameSubtreeRequestSchema = z14.object({
|
|
1328
|
+
old_path: z14.string(),
|
|
1329
|
+
new_path: z14.string(),
|
|
1330
|
+
create_redirect: z14.boolean().optional()
|
|
1307
1331
|
});
|
|
1308
|
-
var RenameSubtreeResponseSchema =
|
|
1309
|
-
renamed_count:
|
|
1332
|
+
var RenameSubtreeResponseSchema = z14.object({
|
|
1333
|
+
renamed_count: z14.number()
|
|
1310
1334
|
});
|
|
1311
|
-
var PageNotFoundErrorSchema =
|
|
1312
|
-
error:
|
|
1313
|
-
code:
|
|
1314
|
-
message:
|
|
1335
|
+
var PageNotFoundErrorSchema = z14.object({
|
|
1336
|
+
error: z14.object({
|
|
1337
|
+
code: z14.literal("PAGE_NOT_FOUND"),
|
|
1338
|
+
message: z14.literal("Page not found")
|
|
1315
1339
|
})
|
|
1316
1340
|
});
|
|
1317
|
-
var PageNotGrantedErrorSchema =
|
|
1318
|
-
error:
|
|
1319
|
-
code:
|
|
1320
|
-
message:
|
|
1341
|
+
var PageNotGrantedErrorSchema = z14.object({
|
|
1342
|
+
error: z14.object({
|
|
1343
|
+
code: z14.literal("PAGE_NOT_GRANTED"),
|
|
1344
|
+
message: z14.literal("Page is not granted for the user")
|
|
1321
1345
|
})
|
|
1322
1346
|
});
|
|
1323
|
-
var PageRevisionErrorSchema =
|
|
1324
|
-
error:
|
|
1325
|
-
code:
|
|
1326
|
-
message:
|
|
1347
|
+
var PageRevisionErrorSchema = z14.object({
|
|
1348
|
+
error: z14.object({
|
|
1349
|
+
code: z14.literal("PAGE_REVISION_ERROR"),
|
|
1350
|
+
message: z14.string()
|
|
1327
1351
|
})
|
|
1328
1352
|
});
|
|
1329
|
-
var SeenPageRequestSchema =
|
|
1330
|
-
page_id:
|
|
1353
|
+
var SeenPageRequestSchema = z14.object({
|
|
1354
|
+
page_id: z14.string()
|
|
1331
1355
|
});
|
|
1332
|
-
var SeenUsersResponseSchema =
|
|
1333
|
-
seenUsers:
|
|
1334
|
-
seenUsersCount:
|
|
1356
|
+
var SeenUsersResponseSchema = z14.object({
|
|
1357
|
+
seenUsers: z14.array(UserPublicSchema),
|
|
1358
|
+
seenUsersCount: z14.number()
|
|
1335
1359
|
});
|
|
1336
|
-
var GetSeenUsersRequestSchema =
|
|
1337
|
-
page_id:
|
|
1360
|
+
var GetSeenUsersRequestSchema = z14.object({
|
|
1361
|
+
page_id: z14.string(),
|
|
1338
1362
|
// Optional cap on returned `seenUsers`. `seenUsersCount` always reflects
|
|
1339
1363
|
// the full count regardless of `limit`. Omit for the full list.
|
|
1340
|
-
limit:
|
|
1364
|
+
limit: z14.coerce.number().int().positive().optional()
|
|
1341
1365
|
});
|
|
1342
|
-
var GetWatchStatusRequestSchema =
|
|
1343
|
-
page_id:
|
|
1366
|
+
var GetWatchStatusRequestSchema = z14.object({
|
|
1367
|
+
page_id: z14.string()
|
|
1344
1368
|
});
|
|
1345
|
-
var WatchStatusResponseSchema =
|
|
1346
|
-
watching:
|
|
1369
|
+
var WatchStatusResponseSchema = z14.object({
|
|
1370
|
+
watching: z14.boolean()
|
|
1347
1371
|
});
|
|
1348
|
-
var SetWatchStatusRequestSchema =
|
|
1349
|
-
page_id:
|
|
1350
|
-
watching:
|
|
1372
|
+
var SetWatchStatusRequestSchema = z14.object({
|
|
1373
|
+
page_id: z14.string(),
|
|
1374
|
+
watching: z14.boolean()
|
|
1351
1375
|
});
|
|
1352
1376
|
|
|
1353
1377
|
// src/schemas/me.ts
|
|
1354
|
-
var LanguageSchema =
|
|
1355
|
-
var ThemeSchema =
|
|
1356
|
-
var UserProfileResponseSchema =
|
|
1357
|
-
id:
|
|
1358
|
-
username:
|
|
1359
|
-
name:
|
|
1360
|
-
email:
|
|
1378
|
+
var LanguageSchema = z15.enum(["en", "ja"]);
|
|
1379
|
+
var ThemeSchema = z15.enum(["system", "light", "dark"]);
|
|
1380
|
+
var UserProfileResponseSchema = z15.object({
|
|
1381
|
+
id: z15.string(),
|
|
1382
|
+
username: z15.string(),
|
|
1383
|
+
name: z15.string(),
|
|
1384
|
+
email: z15.string().email(),
|
|
1361
1385
|
lang: LanguageSchema,
|
|
1362
1386
|
theme: ThemeSchema,
|
|
1363
|
-
image:
|
|
1364
|
-
introduction:
|
|
1365
|
-
hasPassword:
|
|
1366
|
-
createdAt:
|
|
1387
|
+
image: z15.string().nullable(),
|
|
1388
|
+
introduction: z15.string().optional(),
|
|
1389
|
+
hasPassword: z15.boolean(),
|
|
1390
|
+
createdAt: z15.string(),
|
|
1367
1391
|
/**
|
|
1368
1392
|
* True when the profile update requested a new email that is awaiting
|
|
1369
1393
|
* confirmation: the stored `email` is unchanged and a confirmation
|
|
1370
1394
|
* link was sent to the new address.
|
|
1371
1395
|
*/
|
|
1372
|
-
emailChangePending:
|
|
1396
|
+
emailChangePending: z15.boolean().optional()
|
|
1373
1397
|
});
|
|
1374
|
-
var UpdateProfileRequestSchema =
|
|
1375
|
-
userForm:
|
|
1376
|
-
name:
|
|
1377
|
-
email:
|
|
1398
|
+
var UpdateProfileRequestSchema = z15.object({
|
|
1399
|
+
userForm: z15.object({
|
|
1400
|
+
name: z15.string().min(1, "Name is required"),
|
|
1401
|
+
email: z15.string().email("Invalid email format"),
|
|
1378
1402
|
lang: LanguageSchema
|
|
1379
1403
|
})
|
|
1380
1404
|
});
|
|
1381
|
-
var UpdateThemeRequestSchema =
|
|
1405
|
+
var UpdateThemeRequestSchema = z15.object({
|
|
1382
1406
|
theme: ThemeSchema
|
|
1383
1407
|
});
|
|
1384
|
-
var ThemeUpdateResponseSchema =
|
|
1385
|
-
status:
|
|
1408
|
+
var ThemeUpdateResponseSchema = z15.object({
|
|
1409
|
+
status: z15.literal("ok"),
|
|
1386
1410
|
theme: ThemeSchema
|
|
1387
1411
|
});
|
|
1388
|
-
var PictureUploadResponseSchema =
|
|
1389
|
-
status:
|
|
1390
|
-
url:
|
|
1391
|
-
message:
|
|
1412
|
+
var PictureUploadResponseSchema = z15.object({
|
|
1413
|
+
status: z15.boolean(),
|
|
1414
|
+
url: z15.string().optional(),
|
|
1415
|
+
message: z15.string().optional()
|
|
1392
1416
|
});
|
|
1393
|
-
var SuccessResponseSchema =
|
|
1394
|
-
status:
|
|
1395
|
-
message:
|
|
1417
|
+
var SuccessResponseSchema = z15.object({
|
|
1418
|
+
status: z15.literal("ok"),
|
|
1419
|
+
message: z15.string().optional()
|
|
1396
1420
|
});
|
|
1397
|
-
var ProfileErrorResponseSchema =
|
|
1398
|
-
status:
|
|
1421
|
+
var ProfileErrorResponseSchema = z15.object({
|
|
1422
|
+
status: z15.literal("error"),
|
|
1399
1423
|
/** Stable code so the web can localize the message (e.g. EMAIL_TAKEN). */
|
|
1400
|
-
code:
|
|
1401
|
-
message:
|
|
1402
|
-
errors:
|
|
1424
|
+
code: z15.string().optional(),
|
|
1425
|
+
message: z15.string().optional(),
|
|
1426
|
+
errors: z15.array(z15.string()).optional()
|
|
1403
1427
|
});
|
|
1404
1428
|
var PASSWORD_REGEX = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~])[a-zA-Z\d!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~]+$/;
|
|
1405
|
-
var UpdatePasswordRequestSchema =
|
|
1406
|
-
oldPassword:
|
|
1407
|
-
newPassword:
|
|
1408
|
-
newPasswordConfirm:
|
|
1429
|
+
var UpdatePasswordRequestSchema = z15.object({
|
|
1430
|
+
oldPassword: z15.string().optional(),
|
|
1431
|
+
newPassword: z15.string().min(8, "Password must be at least 8 characters").max(100, "Password must be at most 100 characters").regex(PASSWORD_REGEX, "Password must contain at least one letter, one digit, and one special character"),
|
|
1432
|
+
newPasswordConfirm: z15.string()
|
|
1409
1433
|
}).refine((data) => data.newPassword === data.newPasswordConfirm, {
|
|
1410
1434
|
message: "Passwords do not match",
|
|
1411
1435
|
path: ["newPasswordConfirm"]
|
|
1412
1436
|
});
|
|
1413
|
-
var PasswordUpdateSuccessSchema =
|
|
1414
|
-
status:
|
|
1415
|
-
message:
|
|
1437
|
+
var PasswordUpdateSuccessSchema = z15.object({
|
|
1438
|
+
status: z15.literal("ok"),
|
|
1439
|
+
message: z15.string()
|
|
1416
1440
|
});
|
|
1417
|
-
var PasswordErrorResponseSchema =
|
|
1418
|
-
status:
|
|
1419
|
-
message:
|
|
1420
|
-
errors:
|
|
1441
|
+
var PasswordErrorResponseSchema = z15.object({
|
|
1442
|
+
status: z15.literal("error"),
|
|
1443
|
+
message: z15.string(),
|
|
1444
|
+
errors: z15.array(z15.string()).optional()
|
|
1421
1445
|
});
|
|
1422
|
-
var RecentlyViewedPagesResponseSchema =
|
|
1423
|
-
pages:
|
|
1446
|
+
var RecentlyViewedPagesResponseSchema = z15.object({
|
|
1447
|
+
pages: z15.array(PageSchema)
|
|
1424
1448
|
});
|
|
1425
1449
|
|
|
1426
1450
|
// src/contracts/me.ts
|
|
@@ -1503,8 +1527,8 @@ var uploadPictureRoute = createRoute8({
|
|
|
1503
1527
|
body: {
|
|
1504
1528
|
content: {
|
|
1505
1529
|
"multipart/form-data": {
|
|
1506
|
-
schema:
|
|
1507
|
-
file:
|
|
1530
|
+
schema: z16.object({
|
|
1531
|
+
file: z16.any().optional().describe("Profile picture file")
|
|
1508
1532
|
})
|
|
1509
1533
|
}
|
|
1510
1534
|
}
|
|
@@ -1604,37 +1628,37 @@ var meRoutes = {
|
|
|
1604
1628
|
};
|
|
1605
1629
|
|
|
1606
1630
|
// src/contracts/access-token.ts
|
|
1607
|
-
import { createRoute as createRoute9, z as
|
|
1631
|
+
import { createRoute as createRoute9, z as z18 } from "@hono/zod-openapi";
|
|
1608
1632
|
|
|
1609
1633
|
// src/schemas/access-token.ts
|
|
1610
|
-
import { z as
|
|
1611
|
-
var AccessTokenSchema =
|
|
1612
|
-
id:
|
|
1613
|
-
name:
|
|
1614
|
-
scopes:
|
|
1634
|
+
import { z as z17 } from "@hono/zod-openapi";
|
|
1635
|
+
var AccessTokenSchema = z17.object({
|
|
1636
|
+
id: z17.string(),
|
|
1637
|
+
name: z17.string(),
|
|
1638
|
+
scopes: z17.array(z17.string()),
|
|
1615
1639
|
/** ISO-8601 expiry, or `null` for a non-expiring token. */
|
|
1616
|
-
expiresAt:
|
|
1640
|
+
expiresAt: z17.string().nullable(),
|
|
1617
1641
|
/** ISO-8601 of last successful use, or `null` if never used. */
|
|
1618
|
-
lastUsedAt:
|
|
1619
|
-
createdAt:
|
|
1642
|
+
lastUsedAt: z17.string().nullable(),
|
|
1643
|
+
createdAt: z17.string()
|
|
1620
1644
|
});
|
|
1621
|
-
var ListAccessTokensResponseSchema =
|
|
1622
|
-
accessTokens:
|
|
1645
|
+
var ListAccessTokensResponseSchema = z17.object({
|
|
1646
|
+
accessTokens: z17.array(AccessTokenSchema)
|
|
1623
1647
|
});
|
|
1624
|
-
var CreateAccessTokenRequestSchema =
|
|
1625
|
-
name:
|
|
1626
|
-
scopes:
|
|
1627
|
-
expiresAt:
|
|
1648
|
+
var CreateAccessTokenRequestSchema = z17.object({
|
|
1649
|
+
name: z17.string().min(1, "Name is required").max(200),
|
|
1650
|
+
scopes: z17.array(z17.string()).min(1, "At least one scope is required"),
|
|
1651
|
+
expiresAt: z17.string().datetime().nullable().optional()
|
|
1628
1652
|
});
|
|
1629
1653
|
var CreateAccessTokenResponseSchema = AccessTokenSchema.extend({
|
|
1630
|
-
token:
|
|
1631
|
-
});
|
|
1632
|
-
var InvalidScopeErrorSchema =
|
|
1633
|
-
error:
|
|
1634
|
-
code:
|
|
1635
|
-
message:
|
|
1636
|
-
details:
|
|
1637
|
-
invalidScopes:
|
|
1654
|
+
token: z17.string()
|
|
1655
|
+
});
|
|
1656
|
+
var InvalidScopeErrorSchema = z17.object({
|
|
1657
|
+
error: z17.object({
|
|
1658
|
+
code: z17.literal("INVALID_SCOPE"),
|
|
1659
|
+
message: z17.string(),
|
|
1660
|
+
details: z17.object({
|
|
1661
|
+
invalidScopes: z17.array(z17.string())
|
|
1638
1662
|
}).optional()
|
|
1639
1663
|
})
|
|
1640
1664
|
});
|
|
@@ -1706,7 +1730,7 @@ var deleteAccessTokenRoute = createRoute9({
|
|
|
1706
1730
|
security: [{ bearerAuth: [] }],
|
|
1707
1731
|
summary: "Revoke a personal access token",
|
|
1708
1732
|
request: {
|
|
1709
|
-
params:
|
|
1733
|
+
params: z18.object({ id: z18.string() })
|
|
1710
1734
|
},
|
|
1711
1735
|
responses: {
|
|
1712
1736
|
200: {
|
|
@@ -1738,13 +1762,13 @@ var accessTokenRoutes = {
|
|
|
1738
1762
|
};
|
|
1739
1763
|
|
|
1740
1764
|
// src/contracts/oauth.ts
|
|
1741
|
-
import { createRoute as createRoute10, z as
|
|
1765
|
+
import { createRoute as createRoute10, z as z21 } from "@hono/zod-openapi";
|
|
1742
1766
|
|
|
1743
1767
|
// src/schemas/oauth-endpoints.ts
|
|
1744
|
-
import { z as
|
|
1768
|
+
import { z as z20 } from "@hono/zod-openapi";
|
|
1745
1769
|
|
|
1746
1770
|
// src/schemas/oauth.ts
|
|
1747
|
-
import { z as
|
|
1771
|
+
import { z as z19 } from "@hono/zod-openapi";
|
|
1748
1772
|
var SCOPES = [
|
|
1749
1773
|
// umbrella
|
|
1750
1774
|
"read",
|
|
@@ -1812,11 +1836,11 @@ function scopeSatisfies(required, granted) {
|
|
|
1812
1836
|
return false;
|
|
1813
1837
|
}
|
|
1814
1838
|
var InsufficientScopeErrorSchema = ApiErrorSchema.extend({
|
|
1815
|
-
error:
|
|
1816
|
-
code:
|
|
1817
|
-
message:
|
|
1818
|
-
details:
|
|
1819
|
-
requiredScope:
|
|
1839
|
+
error: z19.object({
|
|
1840
|
+
code: z19.literal("INSUFFICIENT_SCOPE"),
|
|
1841
|
+
message: z19.string(),
|
|
1842
|
+
details: z19.object({
|
|
1843
|
+
requiredScope: z19.string()
|
|
1820
1844
|
}).optional()
|
|
1821
1845
|
})
|
|
1822
1846
|
});
|
|
@@ -1835,91 +1859,91 @@ var OAUTH_ERROR_CODES = [
|
|
|
1835
1859
|
"slow_down",
|
|
1836
1860
|
"expired_token"
|
|
1837
1861
|
];
|
|
1838
|
-
var OAuthErrorSchema =
|
|
1839
|
-
error:
|
|
1840
|
-
error_description:
|
|
1841
|
-
});
|
|
1842
|
-
var AuthorizeRequestSchema =
|
|
1843
|
-
client_id:
|
|
1844
|
-
redirect_uri:
|
|
1845
|
-
scope:
|
|
1846
|
-
code_challenge:
|
|
1847
|
-
code_challenge_method:
|
|
1848
|
-
state:
|
|
1849
|
-
});
|
|
1850
|
-
var AuthorizeResponseSchema =
|
|
1851
|
-
redirectUri:
|
|
1852
|
-
});
|
|
1853
|
-
var TokenRequestSchema =
|
|
1854
|
-
|
|
1855
|
-
grant_type:
|
|
1856
|
-
code:
|
|
1857
|
-
code_verifier:
|
|
1858
|
-
redirect_uri:
|
|
1859
|
-
client_id:
|
|
1862
|
+
var OAuthErrorSchema = z20.object({
|
|
1863
|
+
error: z20.enum(OAUTH_ERROR_CODES),
|
|
1864
|
+
error_description: z20.string().optional()
|
|
1865
|
+
});
|
|
1866
|
+
var AuthorizeRequestSchema = z20.object({
|
|
1867
|
+
client_id: z20.string().min(1),
|
|
1868
|
+
redirect_uri: z20.string().min(1),
|
|
1869
|
+
scope: z20.string().min(1),
|
|
1870
|
+
code_challenge: z20.string().min(1),
|
|
1871
|
+
code_challenge_method: z20.literal("S256"),
|
|
1872
|
+
state: z20.string().optional()
|
|
1873
|
+
});
|
|
1874
|
+
var AuthorizeResponseSchema = z20.object({
|
|
1875
|
+
redirectUri: z20.string()
|
|
1876
|
+
});
|
|
1877
|
+
var TokenRequestSchema = z20.discriminatedUnion("grant_type", [
|
|
1878
|
+
z20.object({
|
|
1879
|
+
grant_type: z20.literal("authorization_code"),
|
|
1880
|
+
code: z20.string().min(1),
|
|
1881
|
+
code_verifier: z20.string().min(1),
|
|
1882
|
+
redirect_uri: z20.string().min(1),
|
|
1883
|
+
client_id: z20.string().min(1)
|
|
1860
1884
|
}),
|
|
1861
|
-
|
|
1862
|
-
grant_type:
|
|
1863
|
-
refresh_token:
|
|
1864
|
-
client_id:
|
|
1865
|
-
scope:
|
|
1885
|
+
z20.object({
|
|
1886
|
+
grant_type: z20.literal("refresh_token"),
|
|
1887
|
+
refresh_token: z20.string().min(1),
|
|
1888
|
+
client_id: z20.string().min(1),
|
|
1889
|
+
scope: z20.string().optional()
|
|
1866
1890
|
}),
|
|
1867
1891
|
// RFC 8628 §3.4 — device authorization grant. The client polls with the
|
|
1868
1892
|
// opaque `device_code` returned by `/oauth/device/authorize`.
|
|
1869
|
-
|
|
1870
|
-
grant_type:
|
|
1871
|
-
device_code:
|
|
1872
|
-
client_id:
|
|
1893
|
+
z20.object({
|
|
1894
|
+
grant_type: z20.literal("urn:ietf:params:oauth:grant-type:device_code"),
|
|
1895
|
+
device_code: z20.string().min(1),
|
|
1896
|
+
client_id: z20.string().min(1)
|
|
1873
1897
|
})
|
|
1874
1898
|
]);
|
|
1875
1899
|
var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
1876
|
-
var TokenResponseSchema =
|
|
1877
|
-
access_token:
|
|
1878
|
-
token_type:
|
|
1879
|
-
expires_in:
|
|
1880
|
-
refresh_token:
|
|
1881
|
-
scope:
|
|
1882
|
-
});
|
|
1883
|
-
var RevokeRequestSchema =
|
|
1884
|
-
token:
|
|
1885
|
-
token_type_hint:
|
|
1886
|
-
});
|
|
1887
|
-
var RevokeResponseSchema =
|
|
1888
|
-
var DeviceAuthorizeRequestSchema =
|
|
1889
|
-
client_id:
|
|
1890
|
-
scope:
|
|
1891
|
-
});
|
|
1892
|
-
var DeviceAuthorizeResponseSchema =
|
|
1893
|
-
device_code:
|
|
1894
|
-
user_code:
|
|
1895
|
-
verification_uri:
|
|
1896
|
-
verification_uri_complete:
|
|
1897
|
-
expires_in:
|
|
1898
|
-
interval:
|
|
1899
|
-
});
|
|
1900
|
-
var DeviceVerifyRequestSchema =
|
|
1901
|
-
user_code:
|
|
1902
|
-
action:
|
|
1903
|
-
});
|
|
1904
|
-
var DeviceVerifyResponseSchema =
|
|
1905
|
-
status:
|
|
1906
|
-
});
|
|
1907
|
-
var DeviceInfoResponseSchema =
|
|
1908
|
-
client_id:
|
|
1909
|
-
scopes:
|
|
1900
|
+
var TokenResponseSchema = z20.object({
|
|
1901
|
+
access_token: z20.string(),
|
|
1902
|
+
token_type: z20.literal("Bearer"),
|
|
1903
|
+
expires_in: z20.number(),
|
|
1904
|
+
refresh_token: z20.string(),
|
|
1905
|
+
scope: z20.string()
|
|
1906
|
+
});
|
|
1907
|
+
var RevokeRequestSchema = z20.object({
|
|
1908
|
+
token: z20.string().min(1),
|
|
1909
|
+
token_type_hint: z20.string().optional()
|
|
1910
|
+
});
|
|
1911
|
+
var RevokeResponseSchema = z20.object({});
|
|
1912
|
+
var DeviceAuthorizeRequestSchema = z20.object({
|
|
1913
|
+
client_id: z20.string().min(1),
|
|
1914
|
+
scope: z20.string().min(1)
|
|
1915
|
+
});
|
|
1916
|
+
var DeviceAuthorizeResponseSchema = z20.object({
|
|
1917
|
+
device_code: z20.string(),
|
|
1918
|
+
user_code: z20.string(),
|
|
1919
|
+
verification_uri: z20.string(),
|
|
1920
|
+
verification_uri_complete: z20.string(),
|
|
1921
|
+
expires_in: z20.number(),
|
|
1922
|
+
interval: z20.number()
|
|
1923
|
+
});
|
|
1924
|
+
var DeviceVerifyRequestSchema = z20.object({
|
|
1925
|
+
user_code: z20.string().min(1),
|
|
1926
|
+
action: z20.enum(["approve", "deny"])
|
|
1927
|
+
});
|
|
1928
|
+
var DeviceVerifyResponseSchema = z20.object({
|
|
1929
|
+
status: z20.enum(["approved", "denied"])
|
|
1930
|
+
});
|
|
1931
|
+
var DeviceInfoResponseSchema = z20.object({
|
|
1932
|
+
client_id: z20.string(),
|
|
1933
|
+
scopes: z20.array(z20.string())
|
|
1910
1934
|
});
|
|
1911
1935
|
var GRANT_TYPES_SUPPORTED = ["authorization_code", "refresh_token", DEVICE_CODE_GRANT_TYPE];
|
|
1912
|
-
var DiscoveryResponseSchema =
|
|
1913
|
-
issuer:
|
|
1914
|
-
authorization_endpoint:
|
|
1915
|
-
token_endpoint:
|
|
1916
|
-
revocation_endpoint:
|
|
1917
|
-
device_authorization_endpoint:
|
|
1918
|
-
scopes_supported:
|
|
1919
|
-
response_types_supported:
|
|
1920
|
-
grant_types_supported:
|
|
1921
|
-
code_challenge_methods_supported:
|
|
1922
|
-
token_endpoint_auth_methods_supported:
|
|
1936
|
+
var DiscoveryResponseSchema = z20.object({
|
|
1937
|
+
issuer: z20.string(),
|
|
1938
|
+
authorization_endpoint: z20.string(),
|
|
1939
|
+
token_endpoint: z20.string(),
|
|
1940
|
+
revocation_endpoint: z20.string(),
|
|
1941
|
+
device_authorization_endpoint: z20.string().optional(),
|
|
1942
|
+
scopes_supported: z20.array(z20.string()),
|
|
1943
|
+
response_types_supported: z20.array(z20.string()),
|
|
1944
|
+
grant_types_supported: z20.array(z20.string()),
|
|
1945
|
+
code_challenge_methods_supported: z20.array(z20.string()),
|
|
1946
|
+
token_endpoint_auth_methods_supported: z20.array(z20.string())
|
|
1923
1947
|
});
|
|
1924
1948
|
var DISCOVERY_SCOPES_SUPPORTED = ISSUABLE_SCOPES;
|
|
1925
1949
|
|
|
@@ -2055,7 +2079,7 @@ var deviceInfoRoute = createRoute10({
|
|
|
2055
2079
|
// scopes so the web consent screen can show them before approval. Reveals
|
|
2056
2080
|
// no secret. Unknown / expired / non-pending → 404 (PHASE4-Q9 option A).
|
|
2057
2081
|
request: {
|
|
2058
|
-
query:
|
|
2082
|
+
query: z21.object({ user_code: z21.string().min(1) })
|
|
2059
2083
|
},
|
|
2060
2084
|
responses: {
|
|
2061
2085
|
200: {
|
|
@@ -2109,94 +2133,94 @@ var oauthRoutes = {
|
|
|
2109
2133
|
};
|
|
2110
2134
|
|
|
2111
2135
|
// src/contracts/user.ts
|
|
2112
|
-
import { createRoute as createRoute11, z as
|
|
2136
|
+
import { createRoute as createRoute11, z as z24 } from "@hono/zod-openapi";
|
|
2113
2137
|
|
|
2114
2138
|
// src/schemas/user.ts
|
|
2115
|
-
import { z as
|
|
2139
|
+
import { z as z23 } from "@hono/zod-openapi";
|
|
2116
2140
|
|
|
2117
2141
|
// src/schemas/bookmark.ts
|
|
2118
|
-
import { z as
|
|
2119
|
-
var BookmarkSchema =
|
|
2120
|
-
_id:
|
|
2142
|
+
import { z as z22 } from "@hono/zod-openapi";
|
|
2143
|
+
var BookmarkSchema = z22.object({
|
|
2144
|
+
_id: z22.string(),
|
|
2121
2145
|
page: PageSchema,
|
|
2122
|
-
user:
|
|
2123
|
-
createdAt:
|
|
2146
|
+
user: z22.union([z22.string(), UserPublicSchema]),
|
|
2147
|
+
createdAt: z22.string()
|
|
2124
2148
|
});
|
|
2125
|
-
var GetBookmarkRequestSchema =
|
|
2126
|
-
page_id:
|
|
2149
|
+
var GetBookmarkRequestSchema = z22.object({
|
|
2150
|
+
page_id: z22.string()
|
|
2127
2151
|
});
|
|
2128
|
-
var BookmarkResponseSchema =
|
|
2152
|
+
var BookmarkResponseSchema = z22.object({
|
|
2129
2153
|
bookmark: BookmarkSchema.nullable()
|
|
2130
2154
|
});
|
|
2131
|
-
var ListMyBookmarksResponseSchema =
|
|
2132
|
-
bookmarks:
|
|
2155
|
+
var ListMyBookmarksResponseSchema = z22.object({
|
|
2156
|
+
bookmarks: z22.array(BookmarkSchema),
|
|
2133
2157
|
pager: PagerSchema,
|
|
2134
|
-
total:
|
|
2158
|
+
total: z22.number()
|
|
2135
2159
|
});
|
|
2136
|
-
var AddBookmarkRequestSchema =
|
|
2137
|
-
page_id:
|
|
2160
|
+
var AddBookmarkRequestSchema = z22.object({
|
|
2161
|
+
page_id: z22.string()
|
|
2138
2162
|
});
|
|
2139
|
-
var RemoveBookmarkRequestSchema =
|
|
2140
|
-
page_id:
|
|
2163
|
+
var RemoveBookmarkRequestSchema = z22.object({
|
|
2164
|
+
page_id: z22.string()
|
|
2141
2165
|
});
|
|
2142
|
-
var RemoveBookmarkResponseSchema =
|
|
2143
|
-
ok:
|
|
2166
|
+
var RemoveBookmarkResponseSchema = z22.object({
|
|
2167
|
+
ok: z22.literal(true)
|
|
2144
2168
|
});
|
|
2145
2169
|
|
|
2146
2170
|
// src/schemas/user.ts
|
|
2147
|
-
var UserStatusSchema =
|
|
2171
|
+
var UserStatusSchema = z23.enum(["1", "2", "3", "4", "5"]).transform((val) => Number(val));
|
|
2148
2172
|
var UserStatusEnum = UserPublicStatus;
|
|
2149
|
-
var UserLanguageSchema =
|
|
2150
|
-
var PaginationRequestSchema =
|
|
2151
|
-
limit:
|
|
2152
|
-
offset:
|
|
2153
|
-
});
|
|
2154
|
-
var UserListItemSchema =
|
|
2155
|
-
_id:
|
|
2156
|
-
username:
|
|
2157
|
-
name:
|
|
2158
|
-
image:
|
|
2159
|
-
});
|
|
2160
|
-
var ListUsersRequestSchema =
|
|
2161
|
-
q:
|
|
2173
|
+
var UserLanguageSchema = z23.enum(["en", "ja"]);
|
|
2174
|
+
var PaginationRequestSchema = z23.object({
|
|
2175
|
+
limit: z23.coerce.number().optional().default(50),
|
|
2176
|
+
offset: z23.coerce.number().optional().default(0)
|
|
2177
|
+
});
|
|
2178
|
+
var UserListItemSchema = z23.object({
|
|
2179
|
+
_id: z23.string(),
|
|
2180
|
+
username: z23.string(),
|
|
2181
|
+
name: z23.string(),
|
|
2182
|
+
image: z23.string().nullable().optional()
|
|
2183
|
+
});
|
|
2184
|
+
var ListUsersRequestSchema = z23.object({
|
|
2185
|
+
q: z23.string().optional(),
|
|
2162
2186
|
// Cap the page size so a client can't request the whole user table in one
|
|
2163
2187
|
// unbounded find+sort (mirrors the page-list `limit` guard).
|
|
2164
|
-
limit:
|
|
2165
|
-
offset:
|
|
2188
|
+
limit: z23.coerce.number().int().min(1).max(100).optional().default(24),
|
|
2189
|
+
offset: z23.coerce.number().int().min(0).optional().default(0)
|
|
2166
2190
|
});
|
|
2167
|
-
var ListUsersResponseSchema =
|
|
2168
|
-
users:
|
|
2191
|
+
var ListUsersResponseSchema = z23.object({
|
|
2192
|
+
users: z23.array(UserListItemSchema),
|
|
2169
2193
|
pager: PagerSchema,
|
|
2170
|
-
total:
|
|
2194
|
+
total: z23.number()
|
|
2171
2195
|
});
|
|
2172
|
-
var UserPageResponseSchema =
|
|
2196
|
+
var UserPageResponseSchema = z23.object({
|
|
2173
2197
|
user: UserPublicSchema,
|
|
2174
2198
|
// Page statistics
|
|
2175
|
-
createdPagesCount:
|
|
2176
|
-
bookmarksCount:
|
|
2199
|
+
createdPagesCount: z23.number(),
|
|
2200
|
+
bookmarksCount: z23.number(),
|
|
2177
2201
|
// Optionally include recent items for initial display
|
|
2178
|
-
recentPages:
|
|
2179
|
-
recentBookmarks:
|
|
2202
|
+
recentPages: z23.array(PageSchema).optional(),
|
|
2203
|
+
recentBookmarks: z23.array(BookmarkSchema).optional()
|
|
2180
2204
|
});
|
|
2181
|
-
var UserBookmarksResponseSchema =
|
|
2182
|
-
bookmarks:
|
|
2205
|
+
var UserBookmarksResponseSchema = z23.object({
|
|
2206
|
+
bookmarks: z23.array(BookmarkSchema),
|
|
2183
2207
|
pager: PagerSchema,
|
|
2184
|
-
total:
|
|
2208
|
+
total: z23.number()
|
|
2185
2209
|
});
|
|
2186
|
-
var UserPagesResponseSchema =
|
|
2187
|
-
pages:
|
|
2210
|
+
var UserPagesResponseSchema = z23.object({
|
|
2211
|
+
pages: z23.array(PageSchema),
|
|
2188
2212
|
pager: PagerSchema,
|
|
2189
|
-
total:
|
|
2213
|
+
total: z23.number()
|
|
2190
2214
|
});
|
|
2191
|
-
var UserNotFoundErrorSchema =
|
|
2192
|
-
error:
|
|
2193
|
-
code:
|
|
2194
|
-
message:
|
|
2215
|
+
var UserNotFoundErrorSchema = z23.object({
|
|
2216
|
+
error: z23.object({
|
|
2217
|
+
code: z23.literal("USER_NOT_FOUND"),
|
|
2218
|
+
message: z23.literal("User not found")
|
|
2195
2219
|
})
|
|
2196
2220
|
});
|
|
2197
2221
|
|
|
2198
2222
|
// src/contracts/user.ts
|
|
2199
|
-
var UsernameParamSchema =
|
|
2223
|
+
var UsernameParamSchema = z24.object({ username: z24.string() });
|
|
2200
2224
|
var getUserPageRoute = createRoute11({
|
|
2201
2225
|
method: "get",
|
|
2202
2226
|
path: "/user/{username}",
|
|
@@ -2439,34 +2463,34 @@ var bookmarkRoutes = {
|
|
|
2439
2463
|
import { createRoute as createRoute13 } from "@hono/zod-openapi";
|
|
2440
2464
|
|
|
2441
2465
|
// src/schemas/backlink.ts
|
|
2442
|
-
import { z as
|
|
2443
|
-
var ObjectIdString =
|
|
2444
|
-
var BacklinkFromPageSchema =
|
|
2445
|
-
_id:
|
|
2446
|
-
path:
|
|
2447
|
-
});
|
|
2448
|
-
var BacklinkFromRevisionSchema =
|
|
2449
|
-
_id:
|
|
2466
|
+
import { z as z25 } from "@hono/zod-openapi";
|
|
2467
|
+
var ObjectIdString = z25.string().regex(/^[0-9a-f]{24}$/, "Invalid ObjectId");
|
|
2468
|
+
var BacklinkFromPageSchema = z25.object({
|
|
2469
|
+
_id: z25.string(),
|
|
2470
|
+
path: z25.string()
|
|
2471
|
+
});
|
|
2472
|
+
var BacklinkFromRevisionSchema = z25.object({
|
|
2473
|
+
_id: z25.string(),
|
|
2450
2474
|
author: UserPublicSchema.nullable().optional()
|
|
2451
2475
|
});
|
|
2452
|
-
var BacklinkSchema =
|
|
2453
|
-
_id:
|
|
2476
|
+
var BacklinkSchema = z25.object({
|
|
2477
|
+
_id: z25.string(),
|
|
2454
2478
|
// The destination page's id (the page being linked TO). Always the
|
|
2455
2479
|
// page passed in the request, but echoed for cache-key parity with the
|
|
2456
2480
|
// legacy response.
|
|
2457
|
-
page:
|
|
2481
|
+
page: z25.string(),
|
|
2458
2482
|
fromPage: BacklinkFromPageSchema,
|
|
2459
2483
|
fromRevision: BacklinkFromRevisionSchema,
|
|
2460
|
-
updatedAt:
|
|
2484
|
+
updatedAt: z25.string()
|
|
2461
2485
|
});
|
|
2462
|
-
var GetBacklinksRequestSchema =
|
|
2486
|
+
var GetBacklinksRequestSchema = z25.object({
|
|
2463
2487
|
page_id: ObjectIdString,
|
|
2464
|
-
limit:
|
|
2465
|
-
offset:
|
|
2488
|
+
limit: z25.coerce.number().int().min(1).max(100).optional().default(20),
|
|
2489
|
+
offset: z25.coerce.number().int().min(0).optional().default(0)
|
|
2466
2490
|
});
|
|
2467
|
-
var GetBacklinksResponseSchema =
|
|
2468
|
-
backlinks:
|
|
2469
|
-
hasNext:
|
|
2491
|
+
var GetBacklinksResponseSchema = z25.object({
|
|
2492
|
+
backlinks: z25.array(BacklinkSchema),
|
|
2493
|
+
hasNext: z25.boolean()
|
|
2470
2494
|
});
|
|
2471
2495
|
|
|
2472
2496
|
// src/contracts/backlink.ts
|
|
@@ -2491,6 +2515,10 @@ var getBacklinksRoute = createRoute13({
|
|
|
2491
2515
|
401: {
|
|
2492
2516
|
description: "Authentication required",
|
|
2493
2517
|
content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
|
|
2518
|
+
},
|
|
2519
|
+
404: {
|
|
2520
|
+
description: "Page not found or not granted",
|
|
2521
|
+
content: { "application/json": { schema: PageNotFoundErrorSchema } }
|
|
2494
2522
|
}
|
|
2495
2523
|
}
|
|
2496
2524
|
});
|
|
@@ -2502,51 +2530,51 @@ var backlinkRoutes = {
|
|
|
2502
2530
|
import { createRoute as createRoute14 } from "@hono/zod-openapi";
|
|
2503
2531
|
|
|
2504
2532
|
// src/schemas/comment.ts
|
|
2505
|
-
import { z as
|
|
2506
|
-
var CommentSchema =
|
|
2507
|
-
_id:
|
|
2508
|
-
page:
|
|
2533
|
+
import { z as z26 } from "@hono/zod-openapi";
|
|
2534
|
+
var CommentSchema = z26.object({
|
|
2535
|
+
_id: z26.string(),
|
|
2536
|
+
page: z26.string(),
|
|
2509
2537
|
// creator is populated to a user object on the API side; allow string fallback for safety
|
|
2510
|
-
creator:
|
|
2511
|
-
revision:
|
|
2512
|
-
comment:
|
|
2513
|
-
commentPosition:
|
|
2514
|
-
createdAt:
|
|
2515
|
-
});
|
|
2516
|
-
var ListCommentsRequestSchema =
|
|
2517
|
-
page_id:
|
|
2518
|
-
revision_id:
|
|
2519
|
-
});
|
|
2520
|
-
var ListCommentsResponseSchema =
|
|
2521
|
-
comments:
|
|
2522
|
-
});
|
|
2523
|
-
var AddCommentRequestSchema =
|
|
2524
|
-
page_id:
|
|
2525
|
-
revision_id:
|
|
2526
|
-
comment:
|
|
2527
|
-
comment_position:
|
|
2528
|
-
});
|
|
2529
|
-
var AddCommentResponseSchema =
|
|
2538
|
+
creator: z26.union([z26.string(), PageUserSchema]).nullable(),
|
|
2539
|
+
revision: z26.string(),
|
|
2540
|
+
comment: z26.string(),
|
|
2541
|
+
commentPosition: z26.number().default(-1),
|
|
2542
|
+
createdAt: z26.string()
|
|
2543
|
+
});
|
|
2544
|
+
var ListCommentsRequestSchema = z26.object({
|
|
2545
|
+
page_id: z26.string().optional(),
|
|
2546
|
+
revision_id: z26.string().optional()
|
|
2547
|
+
});
|
|
2548
|
+
var ListCommentsResponseSchema = z26.object({
|
|
2549
|
+
comments: z26.array(CommentSchema)
|
|
2550
|
+
});
|
|
2551
|
+
var AddCommentRequestSchema = z26.object({
|
|
2552
|
+
page_id: z26.string().min(1, "page_id is required"),
|
|
2553
|
+
revision_id: z26.string().min(1, "revision_id is required"),
|
|
2554
|
+
comment: z26.string().min(1, "comment is required"),
|
|
2555
|
+
comment_position: z26.number().int().optional()
|
|
2556
|
+
});
|
|
2557
|
+
var AddCommentResponseSchema = z26.object({
|
|
2530
2558
|
comment: CommentSchema,
|
|
2531
|
-
newlyWatching:
|
|
2559
|
+
newlyWatching: z26.boolean()
|
|
2532
2560
|
});
|
|
2533
|
-
var DeleteCommentRequestSchema =
|
|
2534
|
-
comment_id:
|
|
2535
|
-
page_id:
|
|
2561
|
+
var DeleteCommentRequestSchema = z26.object({
|
|
2562
|
+
comment_id: z26.string().min(1, "comment_id is required"),
|
|
2563
|
+
page_id: z26.string().min(1, "page_id is required")
|
|
2536
2564
|
});
|
|
2537
|
-
var DeleteCommentResponseSchema =
|
|
2538
|
-
ok:
|
|
2565
|
+
var DeleteCommentResponseSchema = z26.object({
|
|
2566
|
+
ok: z26.literal(true)
|
|
2539
2567
|
});
|
|
2540
|
-
var CommentNotFoundErrorSchema =
|
|
2541
|
-
error:
|
|
2542
|
-
code:
|
|
2543
|
-
message:
|
|
2568
|
+
var CommentNotFoundErrorSchema = z26.object({
|
|
2569
|
+
error: z26.object({
|
|
2570
|
+
code: z26.literal("COMMENT_NOT_FOUND"),
|
|
2571
|
+
message: z26.literal("Comment not found")
|
|
2544
2572
|
})
|
|
2545
2573
|
});
|
|
2546
|
-
var CommentInvalidRequestErrorSchema =
|
|
2547
|
-
error:
|
|
2548
|
-
code:
|
|
2549
|
-
message:
|
|
2574
|
+
var CommentInvalidRequestErrorSchema = z26.object({
|
|
2575
|
+
error: z26.object({
|
|
2576
|
+
code: z26.literal("INVALID_REQUEST"),
|
|
2577
|
+
message: z26.string()
|
|
2550
2578
|
})
|
|
2551
2579
|
});
|
|
2552
2580
|
|
|
@@ -2650,49 +2678,49 @@ var commentRoutes = {
|
|
|
2650
2678
|
};
|
|
2651
2679
|
|
|
2652
2680
|
// src/contracts/revision.ts
|
|
2653
|
-
import { createRoute as createRoute15, z as
|
|
2681
|
+
import { createRoute as createRoute15, z as z28 } from "@hono/zod-openapi";
|
|
2654
2682
|
|
|
2655
2683
|
// src/schemas/revision.ts
|
|
2656
|
-
import { z as
|
|
2657
|
-
var RevisionMetaSchema =
|
|
2658
|
-
_id:
|
|
2659
|
-
path:
|
|
2684
|
+
import { z as z27 } from "@hono/zod-openapi";
|
|
2685
|
+
var RevisionMetaSchema = z27.object({
|
|
2686
|
+
_id: z27.string(),
|
|
2687
|
+
path: z27.string(),
|
|
2660
2688
|
author: PageUserSchema.nullable().optional(),
|
|
2661
2689
|
savedBy: PageUserSchema.nullable().optional(),
|
|
2662
|
-
contributors:
|
|
2690
|
+
contributors: z27.array(PageUserSchema).optional(),
|
|
2663
2691
|
// RFC-0010 — edit channel. `web` (browser / collab editor) vs the API
|
|
2664
2692
|
// token paths (`oauth` / `pat`). Absent on pre-RFC-0010 revisions. The
|
|
2665
2693
|
// history UI shows an "app" chip for the token paths.
|
|
2666
|
-
editVia:
|
|
2667
|
-
createdAt:
|
|
2694
|
+
editVia: z27.enum(["web", "oauth", "pat"]).optional(),
|
|
2695
|
+
createdAt: z27.string()
|
|
2668
2696
|
});
|
|
2669
|
-
var ListRevisionsRequestSchema =
|
|
2670
|
-
limit:
|
|
2671
|
-
offset:
|
|
2697
|
+
var ListRevisionsRequestSchema = z27.object({
|
|
2698
|
+
limit: z27.coerce.number().int().positive().max(200).optional().default(50),
|
|
2699
|
+
offset: z27.coerce.number().int().min(0).optional().default(0)
|
|
2672
2700
|
});
|
|
2673
|
-
var ListRevisionsResponseSchema =
|
|
2674
|
-
revisions:
|
|
2701
|
+
var ListRevisionsResponseSchema = z27.object({
|
|
2702
|
+
revisions: z27.array(RevisionMetaSchema),
|
|
2675
2703
|
pager: PagerSchema
|
|
2676
2704
|
});
|
|
2677
|
-
var GetRevisionResponseSchema =
|
|
2705
|
+
var GetRevisionResponseSchema = z27.object({
|
|
2678
2706
|
revision: RevisionSchema
|
|
2679
2707
|
});
|
|
2680
|
-
var GetRevisionsRequestSchema =
|
|
2681
|
-
ids:
|
|
2708
|
+
var GetRevisionsRequestSchema = z27.object({
|
|
2709
|
+
ids: z27.string().min(1, "ids is required")
|
|
2682
2710
|
});
|
|
2683
|
-
var GetRevisionsResponseSchema =
|
|
2684
|
-
revisions:
|
|
2711
|
+
var GetRevisionsResponseSchema = z27.object({
|
|
2712
|
+
revisions: z27.array(RevisionSchema)
|
|
2685
2713
|
});
|
|
2686
|
-
var RevisionInvalidRequestErrorSchema =
|
|
2687
|
-
error:
|
|
2688
|
-
code:
|
|
2689
|
-
message:
|
|
2714
|
+
var RevisionInvalidRequestErrorSchema = z27.object({
|
|
2715
|
+
error: z27.object({
|
|
2716
|
+
code: z27.literal("INVALID_REQUEST"),
|
|
2717
|
+
message: z27.string()
|
|
2690
2718
|
})
|
|
2691
2719
|
});
|
|
2692
2720
|
|
|
2693
2721
|
// src/contracts/revision.ts
|
|
2694
|
-
var PageIdParamSchema =
|
|
2695
|
-
var RevisionIdParamSchema =
|
|
2722
|
+
var PageIdParamSchema = z28.object({ page_id: z28.string() });
|
|
2723
|
+
var RevisionIdParamSchema = z28.object({ id: z28.string() });
|
|
2696
2724
|
var listRevisionsRoute = createRoute15({
|
|
2697
2725
|
method: "get",
|
|
2698
2726
|
path: "/pages/{page_id}/revisions",
|
|
@@ -2788,24 +2816,24 @@ var revisionRoutes = {
|
|
|
2788
2816
|
};
|
|
2789
2817
|
|
|
2790
2818
|
// src/contracts/notification.ts
|
|
2791
|
-
import { createRoute as createRoute16, z as
|
|
2819
|
+
import { createRoute as createRoute16, z as z30 } from "@hono/zod-openapi";
|
|
2792
2820
|
|
|
2793
2821
|
// src/schemas/notification.ts
|
|
2794
|
-
import { z as
|
|
2795
|
-
var NotificationStatusSchema =
|
|
2822
|
+
import { z as z29 } from "@hono/zod-openapi";
|
|
2823
|
+
var NotificationStatusSchema = z29.enum(["UNREAD", "UNOPENED", "OPENED"]);
|
|
2796
2824
|
var NotificationStatusEnum = {
|
|
2797
2825
|
UNREAD: "UNREAD",
|
|
2798
2826
|
UNOPENED: "UNOPENED",
|
|
2799
2827
|
OPENED: "OPENED"
|
|
2800
2828
|
};
|
|
2801
|
-
var NotificationActionSchema =
|
|
2829
|
+
var NotificationActionSchema = z29.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
|
|
2802
2830
|
var NotificationActionEnum = {
|
|
2803
2831
|
COMMENT: "COMMENT",
|
|
2804
2832
|
LIKE: "LIKE",
|
|
2805
2833
|
MENTION: "MENTION",
|
|
2806
2834
|
UPDATE: "UPDATE"
|
|
2807
2835
|
};
|
|
2808
|
-
var NotificationTargetModelSchema =
|
|
2836
|
+
var NotificationTargetModelSchema = z29.enum(["Page"]);
|
|
2809
2837
|
var NotificationTargetModelEnum = {
|
|
2810
2838
|
PAGE: "Page"
|
|
2811
2839
|
};
|
|
@@ -2814,68 +2842,68 @@ var PageRefSchema = PageSchema.pick({
|
|
|
2814
2842
|
path: true,
|
|
2815
2843
|
status: true
|
|
2816
2844
|
});
|
|
2817
|
-
var NotificationSchema =
|
|
2818
|
-
_id:
|
|
2819
|
-
user:
|
|
2845
|
+
var NotificationSchema = z29.object({
|
|
2846
|
+
_id: z29.string(),
|
|
2847
|
+
user: z29.string(),
|
|
2820
2848
|
targetModel: NotificationTargetModelSchema,
|
|
2821
2849
|
target: PageRefSchema,
|
|
2822
2850
|
action: NotificationActionSchema,
|
|
2823
2851
|
status: NotificationStatusSchema,
|
|
2824
|
-
actionUsers:
|
|
2825
|
-
createdAt:
|
|
2852
|
+
actionUsers: z29.array(UserPublicSchema),
|
|
2853
|
+
createdAt: z29.string()
|
|
2826
2854
|
});
|
|
2827
|
-
var ListNotificationsRequestSchema =
|
|
2828
|
-
limit:
|
|
2829
|
-
offset:
|
|
2855
|
+
var ListNotificationsRequestSchema = z29.object({
|
|
2856
|
+
limit: z29.coerce.number().optional().default(10),
|
|
2857
|
+
offset: z29.coerce.number().optional().default(0)
|
|
2830
2858
|
});
|
|
2831
|
-
var ListNotificationsResponseSchema =
|
|
2832
|
-
notifications:
|
|
2859
|
+
var ListNotificationsResponseSchema = z29.object({
|
|
2860
|
+
notifications: z29.array(NotificationSchema),
|
|
2833
2861
|
pager: PagerSchema
|
|
2834
2862
|
});
|
|
2835
|
-
var MarkAllAsReadResponseSchema =
|
|
2836
|
-
ok:
|
|
2863
|
+
var MarkAllAsReadResponseSchema = z29.object({
|
|
2864
|
+
ok: z29.literal(true)
|
|
2837
2865
|
});
|
|
2838
|
-
var OpenNotificationParamSchema =
|
|
2839
|
-
id:
|
|
2866
|
+
var OpenNotificationParamSchema = z29.object({
|
|
2867
|
+
id: z29.string()
|
|
2840
2868
|
});
|
|
2841
|
-
var OpenNotificationResponseSchema =
|
|
2869
|
+
var OpenNotificationResponseSchema = z29.object({
|
|
2842
2870
|
notification: NotificationSchema
|
|
2843
2871
|
});
|
|
2844
|
-
var NotificationStatusResponseSchema =
|
|
2845
|
-
count:
|
|
2872
|
+
var NotificationStatusResponseSchema = z29.object({
|
|
2873
|
+
count: z29.number()
|
|
2846
2874
|
});
|
|
2847
|
-
var NotificationNotFoundErrorSchema =
|
|
2848
|
-
error:
|
|
2849
|
-
code:
|
|
2850
|
-
message:
|
|
2875
|
+
var NotificationNotFoundErrorSchema = z29.object({
|
|
2876
|
+
error: z29.object({
|
|
2877
|
+
code: z29.literal("NOTIFICATION_NOT_FOUND"),
|
|
2878
|
+
message: z29.literal("Notification not found")
|
|
2851
2879
|
})
|
|
2852
2880
|
});
|
|
2853
|
-
var NotificationsTokenResponseSchema =
|
|
2854
|
-
token:
|
|
2855
|
-
selfUserId:
|
|
2856
|
-
expiresAt:
|
|
2881
|
+
var NotificationsTokenResponseSchema = z29.object({
|
|
2882
|
+
token: z29.string(),
|
|
2883
|
+
selfUserId: z29.string(),
|
|
2884
|
+
expiresAt: z29.string()
|
|
2857
2885
|
});
|
|
2858
|
-
var NotificationsTokenPayloadSchema =
|
|
2859
|
-
selfUserId:
|
|
2886
|
+
var NotificationsTokenPayloadSchema = z29.object({
|
|
2887
|
+
selfUserId: z29.string(),
|
|
2860
2888
|
// Random UUID mixed into every signed token so two tokens minted
|
|
2861
2889
|
// within the same second still produce byte-different JWT strings.
|
|
2862
2890
|
// The browser uses the token as a React effect dependency to drive
|
|
2863
2891
|
// the WebSocket reconnect — without `jti`, the iat/exp pair is
|
|
2864
2892
|
// identical at second granularity and the dep stays stable.
|
|
2865
|
-
jti:
|
|
2866
|
-
iat:
|
|
2867
|
-
exp:
|
|
2893
|
+
jti: z29.string().uuid(),
|
|
2894
|
+
iat: z29.number().int(),
|
|
2895
|
+
exp: z29.number().int()
|
|
2868
2896
|
});
|
|
2869
|
-
var NotificationsChangedMessageSchema =
|
|
2870
|
-
type:
|
|
2897
|
+
var NotificationsChangedMessageSchema = z29.object({
|
|
2898
|
+
type: z29.literal("changed")
|
|
2871
2899
|
});
|
|
2872
2900
|
var NotificationsServerMessageSchema = NotificationsChangedMessageSchema;
|
|
2873
2901
|
|
|
2874
2902
|
// src/contracts/notification.ts
|
|
2875
|
-
var NotificationInvalidRequestErrorSchema =
|
|
2876
|
-
error:
|
|
2877
|
-
code:
|
|
2878
|
-
message:
|
|
2903
|
+
var NotificationInvalidRequestErrorSchema = z30.object({
|
|
2904
|
+
error: z30.object({
|
|
2905
|
+
code: z30.literal("INVALID_REQUEST"),
|
|
2906
|
+
message: z30.string()
|
|
2879
2907
|
})
|
|
2880
2908
|
});
|
|
2881
2909
|
var listNotificationsRoute = createRoute16({
|
|
@@ -3011,25 +3039,59 @@ var notificationRoutes = {
|
|
|
3011
3039
|
};
|
|
3012
3040
|
|
|
3013
3041
|
// src/contracts/page.ts
|
|
3014
|
-
import { createRoute as createRoute17, z as
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3042
|
+
import { createRoute as createRoute17, z as z32 } from "@hono/zod-openapi";
|
|
3043
|
+
|
|
3044
|
+
// src/schemas/autocomplete.ts
|
|
3045
|
+
import { z as z31 } from "@hono/zod-openapi";
|
|
3046
|
+
var AutocompleteRequestSchema = z31.object({
|
|
3047
|
+
q: z31.string().min(1).max(128),
|
|
3048
|
+
limit: z31.coerce.number().int().min(1).max(25).optional().default(10),
|
|
3049
|
+
/**
|
|
3050
|
+
* How `q` is matched against the candidate text. `'substring'` (the
|
|
3051
|
+
* default, used by the editor's `@mention` / `[[wikilink]]` pickers)
|
|
3052
|
+
* keeps the historical anywhere-in-string match. `'prefix'` anchors
|
|
3053
|
+
* the match at the start — used by the "create page" modal, where the
|
|
3054
|
+
* user is building a `/`-rooted path and only true prefixes are valid
|
|
3055
|
+
* completions of what they have typed so far.
|
|
3056
|
+
*/
|
|
3057
|
+
anchor: z31.enum(["substring", "prefix"]).optional().default("substring")
|
|
3058
|
+
});
|
|
3059
|
+
var AutocompleteResultSchema = z31.object({
|
|
3060
|
+
id: z31.string(),
|
|
3061
|
+
label: z31.string(),
|
|
3062
|
+
display: z31.string(),
|
|
3063
|
+
avatar: z31.string().nullable().optional(),
|
|
3064
|
+
modifiedAt: z31.string().nullable().optional(),
|
|
3065
|
+
score: z31.number()
|
|
3066
|
+
});
|
|
3067
|
+
var AutocompleteResponseSchema = z31.object({
|
|
3068
|
+
results: z31.array(AutocompleteResultSchema)
|
|
3069
|
+
});
|
|
3070
|
+
var AutocompleteRateLimitErrorSchema = z31.object({
|
|
3071
|
+
error: z31.literal("rate_limited"),
|
|
3072
|
+
message: z31.string(),
|
|
3073
|
+
retryAfterSeconds: z31.number()
|
|
3074
|
+
});
|
|
3075
|
+
|
|
3076
|
+
// src/contracts/page.ts
|
|
3077
|
+
var PageBadRequestErrorSchema = z32.object({
|
|
3078
|
+
error: z32.object({
|
|
3079
|
+
code: z32.string(),
|
|
3080
|
+
message: z32.string()
|
|
3019
3081
|
})
|
|
3020
3082
|
});
|
|
3021
|
-
var DeletePageRequestSchema =
|
|
3022
|
-
page_id:
|
|
3023
|
-
revision_id:
|
|
3024
|
-
completely:
|
|
3083
|
+
var DeletePageRequestSchema = z32.object({
|
|
3084
|
+
page_id: z32.string(),
|
|
3085
|
+
revision_id: z32.string().optional(),
|
|
3086
|
+
completely: z32.boolean().optional()
|
|
3025
3087
|
});
|
|
3026
|
-
var RevertDeletedPageRequestSchema =
|
|
3027
|
-
page_id:
|
|
3088
|
+
var RevertDeletedPageRequestSchema = z32.object({
|
|
3089
|
+
page_id: z32.string()
|
|
3028
3090
|
});
|
|
3029
|
-
var PageIdBodySchema =
|
|
3030
|
-
page_id:
|
|
3091
|
+
var PageIdBodySchema = z32.object({
|
|
3092
|
+
page_id: z32.string()
|
|
3031
3093
|
});
|
|
3032
|
-
var PageResponseSchema =
|
|
3094
|
+
var PageResponseSchema = z32.object({ page: PageSchema });
|
|
3033
3095
|
var getPageRoute = createRoute17({
|
|
3034
3096
|
method: "get",
|
|
3035
3097
|
path: "/pages",
|
|
@@ -3055,6 +3117,15 @@ var getPageRoute = createRoute17({
|
|
|
3055
3117
|
404: {
|
|
3056
3118
|
description: "Page not found",
|
|
3057
3119
|
content: { "application/json": { schema: PageNotFoundErrorSchema } }
|
|
3120
|
+
},
|
|
3121
|
+
// feature-live-page-sync-reconcile — separates a genuine unknown-error
|
|
3122
|
+
// 500 (e.g. a transient render-artifact / renderer failure) from the
|
|
3123
|
+
// not-found/not-granted 404/403 branches above, so a reconcile head-GET
|
|
3124
|
+
// can tell "page is really gone/forbidden" from "read failed, try
|
|
3125
|
+
// again later" (see `packages/api/src/hono/handlers/page.ts`'s split catch).
|
|
3126
|
+
500: {
|
|
3127
|
+
description: "Internal server error",
|
|
3128
|
+
content: { "application/json": { schema: InternalServerErrorSchema } }
|
|
3058
3129
|
}
|
|
3059
3130
|
}
|
|
3060
3131
|
});
|
|
@@ -3306,6 +3377,52 @@ var unlikePageRoute = createRoute17({
|
|
|
3306
3377
|
}
|
|
3307
3378
|
}
|
|
3308
3379
|
});
|
|
3380
|
+
var claimPageLinkAccessRoute = createRoute17({
|
|
3381
|
+
method: "post",
|
|
3382
|
+
path: "/pages/link-access",
|
|
3383
|
+
tags: ["page"],
|
|
3384
|
+
security: [{ bearerAuth: [] }],
|
|
3385
|
+
summary: "Resolve a page by id, granting first-time link-share access to GRANT_RESTRICTED pages",
|
|
3386
|
+
request: {
|
|
3387
|
+
body: {
|
|
3388
|
+
content: { "application/json": { schema: PageIdBodySchema } }
|
|
3389
|
+
}
|
|
3390
|
+
},
|
|
3391
|
+
responses: {
|
|
3392
|
+
200: {
|
|
3393
|
+
description: "The resolved page, with `granted` telling whether this call just added the caller to grantedUsers",
|
|
3394
|
+
content: { "application/json": { schema: ClaimPageLinkAccessResponseSchema } }
|
|
3395
|
+
},
|
|
3396
|
+
400: {
|
|
3397
|
+
description: "Invalid page_id",
|
|
3398
|
+
content: { "application/json": { schema: InvalidPageIdErrorSchema } }
|
|
3399
|
+
},
|
|
3400
|
+
401: {
|
|
3401
|
+
description: "Authentication required",
|
|
3402
|
+
content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
|
|
3403
|
+
},
|
|
3404
|
+
403: {
|
|
3405
|
+
description: "The caller has no access to the page (isGrantedFor is false) or lacks scope / is a non-web session \u2014 403 is about the caller lacking access, never about the page grant type per se",
|
|
3406
|
+
content: {
|
|
3407
|
+
"application/json": {
|
|
3408
|
+
schema: z32.union([PageNotGrantedErrorSchema, InsufficientScopeErrorSchema])
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
},
|
|
3412
|
+
404: {
|
|
3413
|
+
description: "Page not found",
|
|
3414
|
+
content: { "application/json": { schema: PageNotFoundErrorSchema } }
|
|
3415
|
+
},
|
|
3416
|
+
// Per-user rate limit (30 req/min) — same wire shape as autocomplete's
|
|
3417
|
+
// 429 (`{ error: 'rate_limited', message, retryAfterSeconds }`), reused
|
|
3418
|
+
// rather than duplicated (see the `AutocompleteRateLimitErrorSchema`
|
|
3419
|
+
// import above).
|
|
3420
|
+
429: {
|
|
3421
|
+
description: "Rate limit exceeded for POST /pages/link-access (per-user). Same wire shape as autocomplete rate limiting.",
|
|
3422
|
+
content: { "application/json": { schema: AutocompleteRateLimitErrorSchema } }
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
});
|
|
3309
3426
|
var getWatchStatusRoute = createRoute17({
|
|
3310
3427
|
method: "get",
|
|
3311
3428
|
path: "/pages/watch",
|
|
@@ -3478,7 +3595,7 @@ var renamePageRoute = createRoute17({
|
|
|
3478
3595
|
description: "PAGE_INVALID_NAME / PAGE_EXISTS / PAGE_RENAME_FAILED / PAGE_RENAME_TREE_FAILED",
|
|
3479
3596
|
content: {
|
|
3480
3597
|
"application/json": {
|
|
3481
|
-
schema:
|
|
3598
|
+
schema: z32.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
|
|
3482
3599
|
}
|
|
3483
3600
|
}
|
|
3484
3601
|
},
|
|
@@ -3516,7 +3633,7 @@ var renameSubtreeRoute = createRoute17({
|
|
|
3516
3633
|
description: "PAGE_INVALID_NAME / PAGE_RENAME_TREE_FAILED (collisions, nothing to move, or partial failure)",
|
|
3517
3634
|
content: {
|
|
3518
3635
|
"application/json": {
|
|
3519
|
-
schema:
|
|
3636
|
+
schema: z32.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
|
|
3520
3637
|
}
|
|
3521
3638
|
}
|
|
3522
3639
|
},
|
|
@@ -3547,6 +3664,8 @@ var pageRoutes = {
|
|
|
3547
3664
|
likePageRoute,
|
|
3548
3665
|
// POST /pages/unlike — unlikePage
|
|
3549
3666
|
unlikePageRoute,
|
|
3667
|
+
// POST /pages/link-access — claimPageLinkAccess (grant-on-first-access)
|
|
3668
|
+
claimPageLinkAccessRoute,
|
|
3550
3669
|
// GET /pages/watch — getWatchStatus
|
|
3551
3670
|
getWatchStatusRoute,
|
|
3552
3671
|
// PUT /pages/watch — setWatchStatus
|
|
@@ -3567,12 +3686,12 @@ var pageRoutes = {
|
|
|
3567
3686
|
import { createRoute as createRoute18 } from "@hono/zod-openapi";
|
|
3568
3687
|
|
|
3569
3688
|
// src/schemas/page-preview.ts
|
|
3570
|
-
import { z as
|
|
3571
|
-
var PreviewPageRequestSchema =
|
|
3572
|
-
body:
|
|
3689
|
+
import { z as z33 } from "@hono/zod-openapi";
|
|
3690
|
+
var PreviewPageRequestSchema = z33.object({
|
|
3691
|
+
body: z33.string()
|
|
3573
3692
|
});
|
|
3574
|
-
var PreviewPageResponseSchema =
|
|
3575
|
-
renderedAst:
|
|
3693
|
+
var PreviewPageResponseSchema = z33.object({
|
|
3694
|
+
renderedAst: z33.unknown()
|
|
3576
3695
|
});
|
|
3577
3696
|
|
|
3578
3697
|
// src/contracts/page-preview.ts
|
|
@@ -3607,9 +3726,9 @@ var pagePreviewRoutes = {
|
|
|
3607
3726
|
};
|
|
3608
3727
|
|
|
3609
3728
|
// src/contracts/page-collab.ts
|
|
3610
|
-
import { createRoute as createRoute19, z as
|
|
3611
|
-
var PageIdPathParamsSchema =
|
|
3612
|
-
id:
|
|
3729
|
+
import { createRoute as createRoute19, z as z34 } from "@hono/zod-openapi";
|
|
3730
|
+
var PageIdPathParamsSchema = z34.object({
|
|
3731
|
+
id: z34.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
|
|
3613
3732
|
});
|
|
3614
3733
|
var getYjsTokenRoute = createRoute19({
|
|
3615
3734
|
method: "get",
|
|
@@ -3648,77 +3767,77 @@ var pageCollabRoutes = {
|
|
|
3648
3767
|
};
|
|
3649
3768
|
|
|
3650
3769
|
// src/contracts/presence.ts
|
|
3651
|
-
import { createRoute as createRoute20, z as
|
|
3770
|
+
import { createRoute as createRoute20, z as z36 } from "@hono/zod-openapi";
|
|
3652
3771
|
|
|
3653
3772
|
// src/schemas/presence.ts
|
|
3654
|
-
import { z as
|
|
3655
|
-
var PresenceTokenResponseSchema =
|
|
3656
|
-
token:
|
|
3657
|
-
pageId:
|
|
3658
|
-
selfUserId:
|
|
3659
|
-
expiresAt:
|
|
3660
|
-
});
|
|
3661
|
-
var PresenceTokenPayloadSchema =
|
|
3662
|
-
userId:
|
|
3663
|
-
pageId:
|
|
3664
|
-
iat:
|
|
3665
|
-
exp:
|
|
3666
|
-
});
|
|
3667
|
-
var PresenceViewerSchema =
|
|
3668
|
-
userId:
|
|
3669
|
-
username:
|
|
3670
|
-
displayName:
|
|
3671
|
-
avatarUrl:
|
|
3672
|
-
isEditing:
|
|
3673
|
-
joinedAt:
|
|
3674
|
-
});
|
|
3675
|
-
var PresenceHeartbeatMessageSchema =
|
|
3676
|
-
type:
|
|
3773
|
+
import { z as z35 } from "@hono/zod-openapi";
|
|
3774
|
+
var PresenceTokenResponseSchema = z35.object({
|
|
3775
|
+
token: z35.string(),
|
|
3776
|
+
pageId: z35.string(),
|
|
3777
|
+
selfUserId: z35.string(),
|
|
3778
|
+
expiresAt: z35.string()
|
|
3779
|
+
});
|
|
3780
|
+
var PresenceTokenPayloadSchema = z35.object({
|
|
3781
|
+
userId: z35.string(),
|
|
3782
|
+
pageId: z35.string(),
|
|
3783
|
+
iat: z35.number().int(),
|
|
3784
|
+
exp: z35.number().int()
|
|
3785
|
+
});
|
|
3786
|
+
var PresenceViewerSchema = z35.object({
|
|
3787
|
+
userId: z35.string(),
|
|
3788
|
+
username: z35.string(),
|
|
3789
|
+
displayName: z35.string(),
|
|
3790
|
+
avatarUrl: z35.string().nullable(),
|
|
3791
|
+
isEditing: z35.boolean(),
|
|
3792
|
+
joinedAt: z35.number().int()
|
|
3793
|
+
});
|
|
3794
|
+
var PresenceHeartbeatMessageSchema = z35.object({
|
|
3795
|
+
type: z35.literal("heartbeat")
|
|
3677
3796
|
});
|
|
3678
3797
|
var PresenceClientMessageSchema = PresenceHeartbeatMessageSchema;
|
|
3679
|
-
var PresenceViewersMessageSchema =
|
|
3680
|
-
type:
|
|
3681
|
-
viewers:
|
|
3682
|
-
});
|
|
3683
|
-
var PresencePageUpdatedMessageSchema =
|
|
3684
|
-
type:
|
|
3685
|
-
pageId:
|
|
3686
|
-
revisionId:
|
|
3687
|
-
editorUserId:
|
|
3688
|
-
editorDisplayName:
|
|
3689
|
-
});
|
|
3690
|
-
var PresenceCommentChangedMessageSchema =
|
|
3691
|
-
type:
|
|
3692
|
-
pageId:
|
|
3693
|
-
changeType:
|
|
3694
|
-
commentId:
|
|
3695
|
-
actorUserId:
|
|
3696
|
-
});
|
|
3697
|
-
var PresenceServerMessageSchema =
|
|
3798
|
+
var PresenceViewersMessageSchema = z35.object({
|
|
3799
|
+
type: z35.literal("viewers"),
|
|
3800
|
+
viewers: z35.array(PresenceViewerSchema)
|
|
3801
|
+
});
|
|
3802
|
+
var PresencePageUpdatedMessageSchema = z35.object({
|
|
3803
|
+
type: z35.literal("page-updated"),
|
|
3804
|
+
pageId: z35.string(),
|
|
3805
|
+
revisionId: z35.string(),
|
|
3806
|
+
editorUserId: z35.string(),
|
|
3807
|
+
editorDisplayName: z35.string()
|
|
3808
|
+
});
|
|
3809
|
+
var PresenceCommentChangedMessageSchema = z35.object({
|
|
3810
|
+
type: z35.literal("comment-changed"),
|
|
3811
|
+
pageId: z35.string(),
|
|
3812
|
+
changeType: z35.enum(["added", "removed"]),
|
|
3813
|
+
commentId: z35.string(),
|
|
3814
|
+
actorUserId: z35.string().optional()
|
|
3815
|
+
});
|
|
3816
|
+
var PresenceServerMessageSchema = z35.discriminatedUnion("type", [
|
|
3698
3817
|
PresenceViewersMessageSchema,
|
|
3699
3818
|
PresencePageUpdatedMessageSchema,
|
|
3700
3819
|
PresenceCommentChangedMessageSchema
|
|
3701
3820
|
]);
|
|
3702
|
-
var LikerSchema =
|
|
3703
|
-
id:
|
|
3704
|
-
username:
|
|
3705
|
-
displayName:
|
|
3706
|
-
avatarUrl:
|
|
3707
|
-
likedAt:
|
|
3708
|
-
});
|
|
3709
|
-
var LikersResponseSchema =
|
|
3710
|
-
users:
|
|
3711
|
-
totalCount:
|
|
3712
|
-
});
|
|
3713
|
-
var GetLikersRequestSchema =
|
|
3821
|
+
var LikerSchema = z35.object({
|
|
3822
|
+
id: z35.string(),
|
|
3823
|
+
username: z35.string(),
|
|
3824
|
+
displayName: z35.string(),
|
|
3825
|
+
avatarUrl: z35.string().nullable(),
|
|
3826
|
+
likedAt: z35.string().nullable()
|
|
3827
|
+
});
|
|
3828
|
+
var LikersResponseSchema = z35.object({
|
|
3829
|
+
users: z35.array(LikerSchema),
|
|
3830
|
+
totalCount: z35.number().int().nonnegative()
|
|
3831
|
+
});
|
|
3832
|
+
var GetLikersRequestSchema = z35.object({
|
|
3714
3833
|
// Optional cap on returned `users`. `totalCount` always reflects the
|
|
3715
3834
|
// full count regardless of `limit`. Omit for the full list.
|
|
3716
|
-
limit:
|
|
3835
|
+
limit: z35.coerce.number().int().positive().optional()
|
|
3717
3836
|
});
|
|
3718
3837
|
|
|
3719
3838
|
// src/contracts/presence.ts
|
|
3720
|
-
var PageIdPathParamsSchema2 =
|
|
3721
|
-
id:
|
|
3839
|
+
var PageIdPathParamsSchema2 = z36.object({
|
|
3840
|
+
id: z36.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
|
|
3722
3841
|
});
|
|
3723
3842
|
var getPresenceTokenRoute = createRoute20({
|
|
3724
3843
|
method: "get",
|
|
@@ -3791,48 +3910,48 @@ var presenceRoutes = {
|
|
|
3791
3910
|
};
|
|
3792
3911
|
|
|
3793
3912
|
// src/contracts/draft.ts
|
|
3794
|
-
import { createRoute as createRoute21, z as
|
|
3913
|
+
import { createRoute as createRoute21, z as z38 } from "@hono/zod-openapi";
|
|
3795
3914
|
|
|
3796
3915
|
// src/schemas/draft.ts
|
|
3797
|
-
import { z as
|
|
3798
|
-
var CreateDraftRequestSchema =
|
|
3799
|
-
path:
|
|
3800
|
-
initialBody:
|
|
3916
|
+
import { z as z37 } from "@hono/zod-openapi";
|
|
3917
|
+
var CreateDraftRequestSchema = z37.object({
|
|
3918
|
+
path: z37.string().min(1),
|
|
3919
|
+
initialBody: z37.string().optional()
|
|
3801
3920
|
});
|
|
3802
|
-
var CreateDraftResponseSchema =
|
|
3803
|
-
pageId:
|
|
3921
|
+
var CreateDraftResponseSchema = z37.object({
|
|
3922
|
+
pageId: z37.string()
|
|
3804
3923
|
});
|
|
3805
|
-
var DraftConflictOwnerSchema =
|
|
3806
|
-
id:
|
|
3807
|
-
username:
|
|
3808
|
-
displayName:
|
|
3924
|
+
var DraftConflictOwnerSchema = z37.object({
|
|
3925
|
+
id: z37.string(),
|
|
3926
|
+
username: z37.string(),
|
|
3927
|
+
displayName: z37.string()
|
|
3809
3928
|
});
|
|
3810
|
-
var DraftPathConflictErrorSchema =
|
|
3811
|
-
error:
|
|
3929
|
+
var DraftPathConflictErrorSchema = z37.object({
|
|
3930
|
+
error: z37.literal("path_taken_by_draft"),
|
|
3812
3931
|
owner: DraftConflictOwnerSchema,
|
|
3813
|
-
message:
|
|
3932
|
+
message: z37.string()
|
|
3814
3933
|
});
|
|
3815
|
-
var DraftBadRequestErrorSchema =
|
|
3816
|
-
error:
|
|
3817
|
-
message:
|
|
3934
|
+
var DraftBadRequestErrorSchema = z37.object({
|
|
3935
|
+
error: z37.enum(["invalid_path", "path_taken"]),
|
|
3936
|
+
message: z37.string()
|
|
3818
3937
|
});
|
|
3819
|
-
var DraftNotFoundErrorSchema =
|
|
3820
|
-
error:
|
|
3821
|
-
message:
|
|
3938
|
+
var DraftNotFoundErrorSchema = z37.object({
|
|
3939
|
+
error: z37.literal("draft_not_found"),
|
|
3940
|
+
message: z37.string()
|
|
3822
3941
|
});
|
|
3823
|
-
var DraftSummarySchema =
|
|
3824
|
-
pageId:
|
|
3825
|
-
path:
|
|
3826
|
-
createdAt:
|
|
3827
|
-
updatedAt:
|
|
3942
|
+
var DraftSummarySchema = z37.object({
|
|
3943
|
+
pageId: z37.string(),
|
|
3944
|
+
path: z37.string(),
|
|
3945
|
+
createdAt: z37.string(),
|
|
3946
|
+
updatedAt: z37.string()
|
|
3828
3947
|
});
|
|
3829
|
-
var ListDraftsResponseSchema =
|
|
3830
|
-
drafts:
|
|
3948
|
+
var ListDraftsResponseSchema = z37.object({
|
|
3949
|
+
drafts: z37.array(DraftSummarySchema)
|
|
3831
3950
|
});
|
|
3832
3951
|
|
|
3833
3952
|
// src/contracts/draft.ts
|
|
3834
|
-
var DraftIdPathParamsSchema =
|
|
3835
|
-
id:
|
|
3953
|
+
var DraftIdPathParamsSchema = z38.object({
|
|
3954
|
+
id: z38.string().openapi({ description: "Draft page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
|
|
3836
3955
|
});
|
|
3837
3956
|
var createDraftRoute = createRoute21({
|
|
3838
3957
|
method: "post",
|
|
@@ -3913,40 +4032,6 @@ var draftRoutes = {
|
|
|
3913
4032
|
|
|
3914
4033
|
// src/contracts/autocomplete.ts
|
|
3915
4034
|
import { createRoute as createRoute22 } from "@hono/zod-openapi";
|
|
3916
|
-
|
|
3917
|
-
// src/schemas/autocomplete.ts
|
|
3918
|
-
import { z as z37 } from "@hono/zod-openapi";
|
|
3919
|
-
var AutocompleteRequestSchema = z37.object({
|
|
3920
|
-
q: z37.string().min(1).max(128),
|
|
3921
|
-
limit: z37.coerce.number().int().min(1).max(25).optional().default(10),
|
|
3922
|
-
/**
|
|
3923
|
-
* How `q` is matched against the candidate text. `'substring'` (the
|
|
3924
|
-
* default, used by the editor's `@mention` / `[[wikilink]]` pickers)
|
|
3925
|
-
* keeps the historical anywhere-in-string match. `'prefix'` anchors
|
|
3926
|
-
* the match at the start — used by the "create page" modal, where the
|
|
3927
|
-
* user is building a `/`-rooted path and only true prefixes are valid
|
|
3928
|
-
* completions of what they have typed so far.
|
|
3929
|
-
*/
|
|
3930
|
-
anchor: z37.enum(["substring", "prefix"]).optional().default("substring")
|
|
3931
|
-
});
|
|
3932
|
-
var AutocompleteResultSchema = z37.object({
|
|
3933
|
-
id: z37.string(),
|
|
3934
|
-
label: z37.string(),
|
|
3935
|
-
display: z37.string(),
|
|
3936
|
-
avatar: z37.string().nullable().optional(),
|
|
3937
|
-
modifiedAt: z37.string().nullable().optional(),
|
|
3938
|
-
score: z37.number()
|
|
3939
|
-
});
|
|
3940
|
-
var AutocompleteResponseSchema = z37.object({
|
|
3941
|
-
results: z37.array(AutocompleteResultSchema)
|
|
3942
|
-
});
|
|
3943
|
-
var AutocompleteRateLimitErrorSchema = z37.object({
|
|
3944
|
-
error: z37.literal("rate_limited"),
|
|
3945
|
-
message: z37.string(),
|
|
3946
|
-
retryAfterSeconds: z37.number()
|
|
3947
|
-
});
|
|
3948
|
-
|
|
3949
|
-
// src/contracts/autocomplete.ts
|
|
3950
4035
|
var autocompleteUsersRoute = createRoute22({
|
|
3951
4036
|
method: "get",
|
|
3952
4037
|
path: "/users/autocomplete",
|
|
@@ -4009,50 +4094,50 @@ var autocompleteRoutes = {
|
|
|
4009
4094
|
};
|
|
4010
4095
|
|
|
4011
4096
|
// src/contracts/attachment.ts
|
|
4012
|
-
import { createRoute as createRoute23, z as
|
|
4097
|
+
import { createRoute as createRoute23, z as z40 } from "@hono/zod-openapi";
|
|
4013
4098
|
|
|
4014
4099
|
// src/schemas/attachment.ts
|
|
4015
|
-
import { z as
|
|
4016
|
-
var AttachmentSchema =
|
|
4017
|
-
_id:
|
|
4018
|
-
page:
|
|
4100
|
+
import { z as z39 } from "@hono/zod-openapi";
|
|
4101
|
+
var AttachmentSchema = z39.object({
|
|
4102
|
+
_id: z39.string(),
|
|
4103
|
+
page: z39.string(),
|
|
4019
4104
|
creator: UserPublicSchema,
|
|
4020
|
-
filePath:
|
|
4021
|
-
fileName:
|
|
4022
|
-
originalName:
|
|
4023
|
-
fileFormat:
|
|
4024
|
-
fileSize:
|
|
4025
|
-
createdAt:
|
|
4026
|
-
url:
|
|
4027
|
-
inUse:
|
|
4105
|
+
filePath: z39.string(),
|
|
4106
|
+
fileName: z39.string(),
|
|
4107
|
+
originalName: z39.string(),
|
|
4108
|
+
fileFormat: z39.string(),
|
|
4109
|
+
fileSize: z39.number(),
|
|
4110
|
+
createdAt: z39.string(),
|
|
4111
|
+
url: z39.string(),
|
|
4112
|
+
inUse: z39.boolean()
|
|
4028
4113
|
});
|
|
4029
4114
|
var AttachmentMetaSchema = AttachmentSchema.omit({ inUse: true });
|
|
4030
|
-
var ListAttachmentsResponseSchema =
|
|
4031
|
-
attachments:
|
|
4115
|
+
var ListAttachmentsResponseSchema = z39.object({
|
|
4116
|
+
attachments: z39.array(AttachmentSchema)
|
|
4032
4117
|
});
|
|
4033
|
-
var PastAttachmentUsageSchema =
|
|
4118
|
+
var PastAttachmentUsageSchema = z39.object({
|
|
4034
4119
|
attachment: AttachmentSchema,
|
|
4035
|
-
referencingRevisions:
|
|
4036
|
-
|
|
4037
|
-
revisionId:
|
|
4038
|
-
createdAt:
|
|
4120
|
+
referencingRevisions: z39.array(
|
|
4121
|
+
z39.object({
|
|
4122
|
+
revisionId: z39.string(),
|
|
4123
|
+
createdAt: z39.string(),
|
|
4039
4124
|
author: UserPublicSchema
|
|
4040
4125
|
})
|
|
4041
4126
|
)
|
|
4042
4127
|
});
|
|
4043
|
-
var AttachmentUsageResponseSchema =
|
|
4044
|
-
pagePath:
|
|
4045
|
-
latest:
|
|
4046
|
-
past:
|
|
4128
|
+
var AttachmentUsageResponseSchema = z39.object({
|
|
4129
|
+
pagePath: z39.string(),
|
|
4130
|
+
latest: z39.array(AttachmentSchema),
|
|
4131
|
+
past: z39.array(PastAttachmentUsageSchema)
|
|
4047
4132
|
});
|
|
4048
|
-
var AddAttachmentResponseSchema =
|
|
4133
|
+
var AddAttachmentResponseSchema = z39.object({
|
|
4049
4134
|
attachment: AttachmentSchema,
|
|
4050
|
-
url:
|
|
4135
|
+
url: z39.string()
|
|
4051
4136
|
});
|
|
4052
|
-
var RemoveAttachmentResponseSchema =
|
|
4053
|
-
success:
|
|
4137
|
+
var RemoveAttachmentResponseSchema = z39.object({
|
|
4138
|
+
success: z39.literal(true)
|
|
4054
4139
|
});
|
|
4055
|
-
var AttachmentErrorCodeSchema =
|
|
4140
|
+
var AttachmentErrorCodeSchema = z39.enum([
|
|
4056
4141
|
"INVALID_PAGE_ID",
|
|
4057
4142
|
"PAGE_NOT_FOUND",
|
|
4058
4143
|
"FILE_MISSING",
|
|
@@ -4064,41 +4149,41 @@ var AttachmentErrorCodeSchema = z38.enum([
|
|
|
4064
4149
|
"UPLOAD_FAILED",
|
|
4065
4150
|
"REMOVE_FAILED"
|
|
4066
4151
|
]);
|
|
4067
|
-
var AttachmentErrorSchema =
|
|
4068
|
-
error:
|
|
4152
|
+
var AttachmentErrorSchema = z39.object({
|
|
4153
|
+
error: z39.object({
|
|
4069
4154
|
code: AttachmentErrorCodeSchema,
|
|
4070
|
-
message:
|
|
4155
|
+
message: z39.string()
|
|
4071
4156
|
})
|
|
4072
4157
|
});
|
|
4073
|
-
var UploadAttachmentResponseSchema =
|
|
4074
|
-
url:
|
|
4075
|
-
filename:
|
|
4076
|
-
mimeType:
|
|
4077
|
-
sizeBytes:
|
|
4158
|
+
var UploadAttachmentResponseSchema = z39.object({
|
|
4159
|
+
url: z39.string(),
|
|
4160
|
+
filename: z39.string(),
|
|
4161
|
+
mimeType: z39.string(),
|
|
4162
|
+
sizeBytes: z39.number()
|
|
4078
4163
|
});
|
|
4079
|
-
var UploadAttachmentErrorCodeSchema =
|
|
4080
|
-
var UploadAttachmentErrorSchema =
|
|
4164
|
+
var UploadAttachmentErrorCodeSchema = z39.enum(["too_large", "disallowed_type", "rate_limited", "no_permission"]);
|
|
4165
|
+
var UploadAttachmentErrorSchema = z39.object({
|
|
4081
4166
|
error: UploadAttachmentErrorCodeSchema,
|
|
4082
|
-
message:
|
|
4083
|
-
details:
|
|
4167
|
+
message: z39.string(),
|
|
4168
|
+
details: z39.record(z39.string(), z39.unknown()).optional()
|
|
4084
4169
|
});
|
|
4085
4170
|
var IMAGE_UPLOAD_MIME = ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"];
|
|
4086
4171
|
var DND_EXTRA_UPLOAD_MIME = ["application/pdf", "text/plain", "text/markdown", "text/csv", "application/zip"];
|
|
4087
4172
|
|
|
4088
4173
|
// src/contracts/attachment.ts
|
|
4089
|
-
var PageIdPathParamsSchema3 =
|
|
4090
|
-
pageId:
|
|
4174
|
+
var PageIdPathParamsSchema3 = z40.object({
|
|
4175
|
+
pageId: z40.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
|
|
4091
4176
|
});
|
|
4092
|
-
var AttachmentIdPathParamsSchema =
|
|
4093
|
-
id:
|
|
4177
|
+
var AttachmentIdPathParamsSchema = z40.object({
|
|
4178
|
+
id: z40.string().openapi({ description: "Attachment id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
|
|
4094
4179
|
});
|
|
4095
|
-
var AddAttachmentBodySchema =
|
|
4096
|
-
file:
|
|
4180
|
+
var AddAttachmentBodySchema = z40.object({
|
|
4181
|
+
file: z40.any().openapi({ type: "string", format: "binary" }).optional()
|
|
4097
4182
|
});
|
|
4098
|
-
var UploadAttachmentBodySchema =
|
|
4099
|
-
file:
|
|
4100
|
-
pageId:
|
|
4101
|
-
intent:
|
|
4183
|
+
var UploadAttachmentBodySchema = z40.object({
|
|
4184
|
+
file: z40.any().openapi({ type: "string", format: "binary" }).optional(),
|
|
4185
|
+
pageId: z40.string().optional(),
|
|
4186
|
+
intent: z40.string().optional().openapi({ enum: ["paste", "dnd"] })
|
|
4102
4187
|
});
|
|
4103
4188
|
var listAttachmentsRoute = createRoute23({
|
|
4104
4189
|
method: "get",
|
|
@@ -4335,30 +4420,30 @@ var attachmentRoutes = {
|
|
|
4335
4420
|
import { createRoute as createRoute24 } from "@hono/zod-openapi";
|
|
4336
4421
|
|
|
4337
4422
|
// src/schemas/search.ts
|
|
4338
|
-
import { z as
|
|
4339
|
-
var SearchPageTypeSchema =
|
|
4340
|
-
var SearchPagesRequestSchema =
|
|
4341
|
-
q:
|
|
4342
|
-
tree:
|
|
4423
|
+
import { z as z41 } from "@hono/zod-openapi";
|
|
4424
|
+
var SearchPageTypeSchema = z41.enum(["portal", "public", "user"]);
|
|
4425
|
+
var SearchPagesRequestSchema = z41.object({
|
|
4426
|
+
q: z41.string().min(1),
|
|
4427
|
+
tree: z41.string().optional(),
|
|
4343
4428
|
type: SearchPageTypeSchema.optional(),
|
|
4344
|
-
page:
|
|
4345
|
-
limit:
|
|
4346
|
-
});
|
|
4347
|
-
var SearchHitSchema =
|
|
4348
|
-
pageId:
|
|
4349
|
-
path:
|
|
4350
|
-
score:
|
|
4351
|
-
snippet:
|
|
4352
|
-
bookmarkCount:
|
|
4429
|
+
page: z41.coerce.number().int().min(1).default(1),
|
|
4430
|
+
limit: z41.coerce.number().int().min(1).max(100).default(50)
|
|
4431
|
+
});
|
|
4432
|
+
var SearchHitSchema = z41.object({
|
|
4433
|
+
pageId: z41.string(),
|
|
4434
|
+
path: z41.string(),
|
|
4435
|
+
score: z41.number().optional(),
|
|
4436
|
+
snippet: z41.string().optional(),
|
|
4437
|
+
bookmarkCount: z41.number(),
|
|
4353
4438
|
page: PageSchema
|
|
4354
4439
|
});
|
|
4355
|
-
var SearchPagesResponseSchema =
|
|
4356
|
-
meta:
|
|
4357
|
-
took:
|
|
4358
|
-
total:
|
|
4359
|
-
results:
|
|
4440
|
+
var SearchPagesResponseSchema = z41.object({
|
|
4441
|
+
meta: z41.object({
|
|
4442
|
+
took: z41.number().optional(),
|
|
4443
|
+
total: z41.number(),
|
|
4444
|
+
results: z41.number()
|
|
4360
4445
|
}),
|
|
4361
|
-
data:
|
|
4446
|
+
data: z41.array(SearchHitSchema)
|
|
4362
4447
|
});
|
|
4363
4448
|
|
|
4364
4449
|
// src/contracts/search.ts
|
|
@@ -4402,31 +4487,31 @@ var searchRoutes = {
|
|
|
4402
4487
|
import { createRoute as createRoute25 } from "@hono/zod-openapi";
|
|
4403
4488
|
|
|
4404
4489
|
// src/schemas/adminCrypto.ts
|
|
4405
|
-
import { z as
|
|
4406
|
-
var SensitiveConfigEntrySchema =
|
|
4407
|
-
ns:
|
|
4408
|
-
key:
|
|
4409
|
-
present:
|
|
4410
|
-
encrypted:
|
|
4411
|
-
});
|
|
4412
|
-
var CryptoStatusResponseSchema =
|
|
4490
|
+
import { z as z42 } from "@hono/zod-openapi";
|
|
4491
|
+
var SensitiveConfigEntrySchema = z42.object({
|
|
4492
|
+
ns: z42.string(),
|
|
4493
|
+
key: z42.string(),
|
|
4494
|
+
present: z42.boolean(),
|
|
4495
|
+
encrypted: z42.boolean()
|
|
4496
|
+
});
|
|
4497
|
+
var CryptoStatusResponseSchema = z42.object({
|
|
4413
4498
|
/** False when CROWI_ENCRYPTION_KEY is not configured — UI shows a setup hint. */
|
|
4414
|
-
encryptionConfigured:
|
|
4415
|
-
unencryptedCount:
|
|
4416
|
-
encryptedCount:
|
|
4417
|
-
entries:
|
|
4499
|
+
encryptionConfigured: z42.boolean(),
|
|
4500
|
+
unencryptedCount: z42.number().int().min(0),
|
|
4501
|
+
encryptedCount: z42.number().int().min(0),
|
|
4502
|
+
entries: z42.array(SensitiveConfigEntrySchema)
|
|
4418
4503
|
});
|
|
4419
|
-
var ReencryptResponseSchema =
|
|
4420
|
-
rewritten:
|
|
4504
|
+
var ReencryptResponseSchema = z42.object({
|
|
4505
|
+
rewritten: z42.number().int().min(0),
|
|
4421
4506
|
/** Already encrypted, skipped on this run. */
|
|
4422
|
-
alreadyEncrypted:
|
|
4507
|
+
alreadyEncrypted: z42.number().int().min(0),
|
|
4423
4508
|
/** Sensitive registry entries that had no row in the DB at all. */
|
|
4424
|
-
missing:
|
|
4509
|
+
missing: z42.number().int().min(0)
|
|
4425
4510
|
});
|
|
4426
|
-
var EncryptionNotConfiguredErrorSchema =
|
|
4427
|
-
error:
|
|
4428
|
-
code:
|
|
4429
|
-
message:
|
|
4511
|
+
var EncryptionNotConfiguredErrorSchema = z42.object({
|
|
4512
|
+
error: z42.object({
|
|
4513
|
+
code: z42.literal("ENCRYPTION_NOT_CONFIGURED"),
|
|
4514
|
+
message: z42.string()
|
|
4430
4515
|
})
|
|
4431
4516
|
});
|
|
4432
4517
|
|
|
@@ -4494,53 +4579,53 @@ var adminCryptoRoutes = {
|
|
|
4494
4579
|
import { createRoute as createRoute26 } from "@hono/zod-openapi";
|
|
4495
4580
|
|
|
4496
4581
|
// src/schemas/admin/app.ts
|
|
4497
|
-
import { z as
|
|
4498
|
-
var GetAppSettingsResponseSchema =
|
|
4499
|
-
app:
|
|
4500
|
-
title:
|
|
4501
|
-
confidential:
|
|
4582
|
+
import { z as z44 } from "@hono/zod-openapi";
|
|
4583
|
+
var GetAppSettingsResponseSchema = z44.object({
|
|
4584
|
+
app: z44.object({
|
|
4585
|
+
title: z44.string(),
|
|
4586
|
+
confidential: z44.string()
|
|
4502
4587
|
}),
|
|
4503
4588
|
/**
|
|
4504
4589
|
* Whether a storage driver is registered (i.e. uploads are wired up).
|
|
4505
4590
|
* Sourced from `Config.isUploadable()` which now consults PluginManager.
|
|
4506
4591
|
*/
|
|
4507
|
-
isUploadable:
|
|
4592
|
+
isUploadable: z44.boolean(),
|
|
4508
4593
|
/**
|
|
4509
4594
|
* The Open / Restricted / Closed → open / restricted / closed mapping the
|
|
4510
4595
|
* legacy admin controller exposed. Useful for the UI to render the current
|
|
4511
4596
|
* registration mode label without knowing the internal capitalisation.
|
|
4512
4597
|
*/
|
|
4513
|
-
registrationMode:
|
|
4598
|
+
registrationMode: z44.record(z44.string(), z44.string()),
|
|
4514
4599
|
/**
|
|
4515
4600
|
* Whether the admin has dismissed the initial-setup checklist on the
|
|
4516
4601
|
* dashboard. Persisted server-side (`app:setupChecklistDismissed`) so the
|
|
4517
4602
|
* dismissal holds across browsers and devices, not just one localStorage.
|
|
4518
4603
|
*/
|
|
4519
|
-
setupChecklistDismissed:
|
|
4604
|
+
setupChecklistDismissed: z44.boolean()
|
|
4520
4605
|
});
|
|
4521
|
-
var UpdateAppSettingsRequestSchema =
|
|
4522
|
-
app:
|
|
4523
|
-
title:
|
|
4524
|
-
confidential:
|
|
4606
|
+
var UpdateAppSettingsRequestSchema = z44.object({
|
|
4607
|
+
app: z44.object({
|
|
4608
|
+
title: z44.string().trim().min(1).max(100).optional(),
|
|
4609
|
+
confidential: z44.string().max(500).optional()
|
|
4525
4610
|
}).optional(),
|
|
4526
4611
|
/**
|
|
4527
4612
|
* Toggle the dashboard initial-setup checklist's dismissed state. Sent on
|
|
4528
4613
|
* its own (without the `app` block) when the admin clicks "mark as done".
|
|
4529
4614
|
*/
|
|
4530
|
-
setupChecklistDismissed:
|
|
4615
|
+
setupChecklistDismissed: z44.boolean().optional()
|
|
4531
4616
|
}).strict();
|
|
4532
|
-
var UpdateAppSettingsResponseSchema =
|
|
4533
|
-
ok:
|
|
4534
|
-
});
|
|
4535
|
-
var AppSettingsValidationErrorSchema =
|
|
4536
|
-
bodyResult:
|
|
4537
|
-
issues:
|
|
4538
|
-
|
|
4539
|
-
path:
|
|
4540
|
-
message:
|
|
4617
|
+
var UpdateAppSettingsResponseSchema = z44.object({
|
|
4618
|
+
ok: z44.literal(true)
|
|
4619
|
+
});
|
|
4620
|
+
var AppSettingsValidationErrorSchema = z44.object({
|
|
4621
|
+
bodyResult: z44.object({
|
|
4622
|
+
issues: z44.array(
|
|
4623
|
+
z44.object({
|
|
4624
|
+
path: z44.array(z44.union([z44.string(), z44.number()])),
|
|
4625
|
+
message: z44.string()
|
|
4541
4626
|
})
|
|
4542
4627
|
),
|
|
4543
|
-
name:
|
|
4628
|
+
name: z44.string().optional()
|
|
4544
4629
|
})
|
|
4545
4630
|
});
|
|
4546
4631
|
|
|
@@ -4622,18 +4707,18 @@ var adminAppRoutes = {
|
|
|
4622
4707
|
import { createRoute as createRoute27 } from "@hono/zod-openapi";
|
|
4623
4708
|
|
|
4624
4709
|
// src/schemas/admin/auth.ts
|
|
4625
|
-
import { z as
|
|
4626
|
-
var AuthSettingsSchema =
|
|
4627
|
-
requireThirdPartyAuth:
|
|
4628
|
-
disablePasswordAuth:
|
|
4710
|
+
import { z as z45 } from "@hono/zod-openapi";
|
|
4711
|
+
var AuthSettingsSchema = z45.object({
|
|
4712
|
+
requireThirdPartyAuth: z45.boolean(),
|
|
4713
|
+
disablePasswordAuth: z45.boolean()
|
|
4629
4714
|
});
|
|
4630
4715
|
var UpdateAuthSettingsRequestSchema = AuthSettingsSchema;
|
|
4631
4716
|
var GetAuthSettingsResponseSchema = AuthSettingsSchema;
|
|
4632
4717
|
var UpdateAuthSettingsResponseSchema = AuthSettingsSchema;
|
|
4633
|
-
var ThirdPartyAuthUnavailableErrorSchema =
|
|
4634
|
-
error:
|
|
4635
|
-
code:
|
|
4636
|
-
message:
|
|
4718
|
+
var ThirdPartyAuthUnavailableErrorSchema = z45.object({
|
|
4719
|
+
error: z45.object({
|
|
4720
|
+
code: z45.literal("THIRD_PARTY_AUTH_UNAVAILABLE"),
|
|
4721
|
+
message: z45.string()
|
|
4637
4722
|
})
|
|
4638
4723
|
});
|
|
4639
4724
|
|
|
@@ -4706,41 +4791,41 @@ var adminAuthRoutes = {
|
|
|
4706
4791
|
import { createRoute as createRoute28 } from "@hono/zod-openapi";
|
|
4707
4792
|
|
|
4708
4793
|
// src/schemas/admin/mail.ts
|
|
4709
|
-
import { z as
|
|
4710
|
-
var GetMailSettingsResponseSchema =
|
|
4711
|
-
from:
|
|
4712
|
-
activeDriver:
|
|
4794
|
+
import { z as z46 } from "@hono/zod-openapi";
|
|
4795
|
+
var GetMailSettingsResponseSchema = z46.object({
|
|
4796
|
+
from: z46.string(),
|
|
4797
|
+
activeDriver: z46.string(),
|
|
4713
4798
|
/** npm name of the plugin that registered the active driver, for
|
|
4714
4799
|
* linking to its config page. Empty when no sender is active. */
|
|
4715
|
-
activePlugin:
|
|
4800
|
+
activePlugin: z46.string()
|
|
4716
4801
|
});
|
|
4717
|
-
var UpdateMailSettingsRequestSchema =
|
|
4718
|
-
from:
|
|
4802
|
+
var UpdateMailSettingsRequestSchema = z46.object({
|
|
4803
|
+
from: z46.string().trim().max(254).optional()
|
|
4719
4804
|
});
|
|
4720
|
-
var UpdateMailSettingsResponseSchema =
|
|
4721
|
-
ok:
|
|
4805
|
+
var UpdateMailSettingsResponseSchema = z46.object({
|
|
4806
|
+
ok: z46.literal(true)
|
|
4722
4807
|
});
|
|
4723
|
-
var SendTestMailRequestSchema =
|
|
4724
|
-
var SendTestMailResponseSchema =
|
|
4725
|
-
ok:
|
|
4808
|
+
var SendTestMailRequestSchema = z46.object({}).optional();
|
|
4809
|
+
var SendTestMailResponseSchema = z46.object({
|
|
4810
|
+
ok: z46.literal(true),
|
|
4726
4811
|
/** Address the test mail was dispatched to (= the calling admin's email). */
|
|
4727
|
-
to:
|
|
4812
|
+
to: z46.string()
|
|
4728
4813
|
});
|
|
4729
|
-
var SendTestMailErrorSchema =
|
|
4730
|
-
error:
|
|
4731
|
-
code:
|
|
4732
|
-
message:
|
|
4814
|
+
var SendTestMailErrorSchema = z46.object({
|
|
4815
|
+
error: z46.object({
|
|
4816
|
+
code: z46.literal("MAIL_TEST_FAILED"),
|
|
4817
|
+
message: z46.string()
|
|
4733
4818
|
})
|
|
4734
4819
|
});
|
|
4735
|
-
var MailSettingsValidationErrorSchema =
|
|
4736
|
-
bodyResult:
|
|
4737
|
-
issues:
|
|
4738
|
-
|
|
4739
|
-
path:
|
|
4740
|
-
message:
|
|
4820
|
+
var MailSettingsValidationErrorSchema = z46.object({
|
|
4821
|
+
bodyResult: z46.object({
|
|
4822
|
+
issues: z46.array(
|
|
4823
|
+
z46.object({
|
|
4824
|
+
path: z46.array(z46.union([z46.string(), z46.number()])),
|
|
4825
|
+
message: z46.string()
|
|
4741
4826
|
})
|
|
4742
4827
|
),
|
|
4743
|
-
name:
|
|
4828
|
+
name: z46.string().optional()
|
|
4744
4829
|
})
|
|
4745
4830
|
});
|
|
4746
4831
|
|
|
@@ -4855,30 +4940,30 @@ var adminMailRoutes = {
|
|
|
4855
4940
|
};
|
|
4856
4941
|
|
|
4857
4942
|
// src/contracts/admin/plugins.ts
|
|
4858
|
-
import { createRoute as createRoute29, z as
|
|
4943
|
+
import { createRoute as createRoute29, z as z48 } from "@hono/zod-openapi";
|
|
4859
4944
|
|
|
4860
4945
|
// src/schemas/admin/plugins.ts
|
|
4861
|
-
import { z as
|
|
4862
|
-
var PluginFieldSchema =
|
|
4863
|
-
name:
|
|
4946
|
+
import { z as z47 } from "@hono/zod-openapi";
|
|
4947
|
+
var PluginFieldSchema = z47.object({
|
|
4948
|
+
name: z47.string(),
|
|
4864
4949
|
/**
|
|
4865
4950
|
* Localized display label. Falls back to `name` in the form when absent.
|
|
4866
4951
|
* Filled from the plugin's `configI18n[locale]` overlay by the admin API.
|
|
4867
4952
|
*/
|
|
4868
|
-
label:
|
|
4869
|
-
kind:
|
|
4870
|
-
description:
|
|
4871
|
-
defaultValue:
|
|
4872
|
-
options:
|
|
4873
|
-
action:
|
|
4874
|
-
label:
|
|
4875
|
-
method:
|
|
4876
|
-
path:
|
|
4953
|
+
label: z47.string().optional(),
|
|
4954
|
+
kind: z47.enum(["string", "secret", "number", "boolean", "enum", "string-array"]),
|
|
4955
|
+
description: z47.string().optional(),
|
|
4956
|
+
defaultValue: z47.unknown().optional(),
|
|
4957
|
+
options: z47.array(z47.string()).optional(),
|
|
4958
|
+
action: z47.object({
|
|
4959
|
+
label: z47.string(),
|
|
4960
|
+
method: z47.string(),
|
|
4961
|
+
path: z47.string()
|
|
4877
4962
|
}).optional(),
|
|
4878
|
-
optional:
|
|
4963
|
+
optional: z47.boolean()
|
|
4879
4964
|
});
|
|
4880
|
-
var AdminSidebarSection =
|
|
4881
|
-
var PluginAdminPlacementSchema =
|
|
4965
|
+
var AdminSidebarSection = z47.enum(["settings", "shared", "storage", "mail", "notification", "auth", "search", "renderer", "platform"]);
|
|
4966
|
+
var PluginAdminPlacementSchema = z47.object({
|
|
4882
4967
|
/**
|
|
4883
4968
|
* Sidebar section to surface this plugin under. The runtime fills
|
|
4884
4969
|
* this in — it's either declared by the plugin via `adminPlacement`
|
|
@@ -4887,21 +4972,28 @@ var PluginAdminPlacementSchema = z46.object({
|
|
|
4887
4972
|
*/
|
|
4888
4973
|
section: AdminSidebarSection,
|
|
4889
4974
|
/** Display label (defaults to the plugin's npm name). */
|
|
4890
|
-
label:
|
|
4975
|
+
label: z47.string(),
|
|
4891
4976
|
/** Lucide icon name from a fixed allow-list. */
|
|
4892
|
-
icon:
|
|
4977
|
+
icon: z47.string().optional()
|
|
4893
4978
|
});
|
|
4894
|
-
var PluginInfoSchema =
|
|
4895
|
-
name:
|
|
4896
|
-
version:
|
|
4897
|
-
requires:
|
|
4979
|
+
var PluginInfoSchema = z47.object({
|
|
4980
|
+
name: z47.string(),
|
|
4981
|
+
version: z47.string(),
|
|
4982
|
+
requires: z47.array(z47.string()).optional(),
|
|
4983
|
+
/**
|
|
4984
|
+
* Core Mongoose model names this plugin declared in its
|
|
4985
|
+
* `CrowiPlugin.modelAccess` allow-list — the only models it may
|
|
4986
|
+
* reach via `ctx.model(name)`. Surfaced so an admin can audit which
|
|
4987
|
+
* plugins touch which core collections.
|
|
4988
|
+
*/
|
|
4989
|
+
modelAccess: z47.array(z47.string()).optional(),
|
|
4898
4990
|
/** Has a configSchema (= showable config form). */
|
|
4899
|
-
hasConfig:
|
|
4991
|
+
hasConfig: z47.boolean(),
|
|
4900
4992
|
/**
|
|
4901
4993
|
* Driver-registry slots this plugin currently fills. Useful for the
|
|
4902
4994
|
* admin "this plugin is the active storage driver" badge.
|
|
4903
4995
|
*/
|
|
4904
|
-
registers:
|
|
4996
|
+
registers: z47.array(z47.string()),
|
|
4905
4997
|
/**
|
|
4906
4998
|
* Where the plugin appears in the admin sidebar. The server always
|
|
4907
4999
|
* populates this even when the plugin didn't declare its own
|
|
@@ -4914,21 +5006,32 @@ var PluginInfoSchema = z46.object({
|
|
|
4914
5006
|
* still apply their config on the next server restart; plugins with
|
|
4915
5007
|
* it apply config changes live.
|
|
4916
5008
|
*/
|
|
4917
|
-
supportsHotReload:
|
|
5009
|
+
supportsHotReload: z47.boolean(),
|
|
5010
|
+
/**
|
|
5011
|
+
* `'failed'` means the plugin's `activate()` call threw during boot
|
|
5012
|
+
* (see `PluginManager.getFailedPlugins()`) — it is not in the loaded
|
|
5013
|
+
* set, has no live driver registration, and its config form is not
|
|
5014
|
+
* reachable. `'active'` (the default) is every plugin that activated
|
|
5015
|
+
* successfully. Defaults to `'active'` for wire back-compat with
|
|
5016
|
+
* responses that predate this field.
|
|
5017
|
+
*/
|
|
5018
|
+
status: z47.enum(["active", "failed"]).default("active"),
|
|
5019
|
+
/** Present only when `status: 'failed'` — the activation error message. */
|
|
5020
|
+
error: z47.string().optional()
|
|
4918
5021
|
});
|
|
4919
|
-
var ListPluginsResponseSchema =
|
|
4920
|
-
plugins:
|
|
5022
|
+
var ListPluginsResponseSchema = z47.object({
|
|
5023
|
+
plugins: z47.array(PluginInfoSchema)
|
|
4921
5024
|
});
|
|
4922
|
-
var PluginConfigResponseSchema =
|
|
4923
|
-
name:
|
|
4924
|
-
fields:
|
|
4925
|
-
values:
|
|
5025
|
+
var PluginConfigResponseSchema = z47.object({
|
|
5026
|
+
name: z47.string(),
|
|
5027
|
+
fields: z47.array(PluginFieldSchema),
|
|
5028
|
+
values: z47.record(z47.string(), z47.unknown())
|
|
4926
5029
|
});
|
|
4927
|
-
var UpdatePluginConfigRequestSchema =
|
|
4928
|
-
values:
|
|
5030
|
+
var UpdatePluginConfigRequestSchema = z47.object({
|
|
5031
|
+
values: z47.record(z47.string(), z47.unknown())
|
|
4929
5032
|
});
|
|
4930
|
-
var UpdatePluginConfigResponseSchema =
|
|
4931
|
-
ok:
|
|
5033
|
+
var UpdatePluginConfigResponseSchema = z47.object({
|
|
5034
|
+
ok: z47.literal(true),
|
|
4932
5035
|
/**
|
|
4933
5036
|
* Whether at least one plugin's `reconfigure` hook ran successfully
|
|
4934
5037
|
* for this save. `true` means the new values are already live on
|
|
@@ -4938,43 +5041,43 @@ var UpdatePluginConfigResponseSchema = z46.object({
|
|
|
4938
5041
|
* "saved, but apply failed" warning in that case via the response
|
|
4939
5042
|
* `reconfigureFailed` flag.
|
|
4940
5043
|
*/
|
|
4941
|
-
hotReloaded:
|
|
5044
|
+
hotReloaded: z47.boolean(),
|
|
4942
5045
|
/**
|
|
4943
5046
|
* True when at least one plugin's `reconfigure` was attempted and
|
|
4944
5047
|
* threw. The save itself succeeded (Mongo + cache are updated) so
|
|
4945
5048
|
* the next process boot will see the new values, but the *running*
|
|
4946
5049
|
* process couldn't apply them. UI surfaces a warning toast.
|
|
4947
5050
|
*/
|
|
4948
|
-
reconfigureFailed:
|
|
5051
|
+
reconfigureFailed: z47.boolean()
|
|
4949
5052
|
});
|
|
4950
|
-
var PluginNotFoundErrorSchema =
|
|
4951
|
-
error:
|
|
4952
|
-
code:
|
|
4953
|
-
message:
|
|
5053
|
+
var PluginNotFoundErrorSchema = z47.object({
|
|
5054
|
+
error: z47.object({
|
|
5055
|
+
code: z47.literal("PLUGIN_NOT_FOUND"),
|
|
5056
|
+
message: z47.string()
|
|
4954
5057
|
})
|
|
4955
5058
|
});
|
|
4956
|
-
var PluginConfigValidationErrorSchema =
|
|
4957
|
-
error:
|
|
4958
|
-
code:
|
|
4959
|
-
message:
|
|
4960
|
-
issues:
|
|
4961
|
-
|
|
4962
|
-
path:
|
|
4963
|
-
message:
|
|
5059
|
+
var PluginConfigValidationErrorSchema = z47.object({
|
|
5060
|
+
error: z47.object({
|
|
5061
|
+
code: z47.literal("PLUGIN_CONFIG_VALIDATION_FAILED"),
|
|
5062
|
+
message: z47.string(),
|
|
5063
|
+
issues: z47.array(
|
|
5064
|
+
z47.object({
|
|
5065
|
+
path: z47.array(z47.union([z47.string(), z47.number()])),
|
|
5066
|
+
message: z47.string()
|
|
4964
5067
|
})
|
|
4965
5068
|
)
|
|
4966
5069
|
})
|
|
4967
5070
|
});
|
|
4968
|
-
var ClearRenderCacheResponseSchema =
|
|
4969
|
-
ok:
|
|
4970
|
-
clearedAt:
|
|
5071
|
+
var ClearRenderCacheResponseSchema = z47.object({
|
|
5072
|
+
ok: z47.literal(true),
|
|
5073
|
+
clearedAt: z47.string(),
|
|
4971
5074
|
/** Number of cache rows removed. */
|
|
4972
|
-
removedCount:
|
|
5075
|
+
removedCount: z47.number().int().min(0)
|
|
4973
5076
|
});
|
|
4974
5077
|
|
|
4975
5078
|
// src/contracts/admin/plugins.ts
|
|
4976
|
-
var PluginNameQuerySchema =
|
|
4977
|
-
var PluginConfigQuerySchema =
|
|
5079
|
+
var PluginNameQuerySchema = z48.object({ name: z48.string() });
|
|
5080
|
+
var PluginConfigQuerySchema = z48.object({ name: z48.string(), locale: z48.string().optional() });
|
|
4978
5081
|
var listPluginsRoute = createRoute29({
|
|
4979
5082
|
method: "get",
|
|
4980
5083
|
path: "/admin/plugins",
|
|
@@ -5071,7 +5174,7 @@ var updatePluginConfigRoute = createRoute29({
|
|
|
5071
5174
|
}
|
|
5072
5175
|
}
|
|
5073
5176
|
});
|
|
5074
|
-
var ClearRenderCacheBodySchema =
|
|
5177
|
+
var ClearRenderCacheBodySchema = z48.object({}).optional();
|
|
5075
5178
|
var clearRenderCacheAllRoute = createRoute29({
|
|
5076
5179
|
method: "post",
|
|
5077
5180
|
path: "/admin/plugins/render-cache/clear-all",
|
|
@@ -5149,21 +5252,21 @@ var adminPluginsRoutes = {
|
|
|
5149
5252
|
import { createRoute as createRoute30 } from "@hono/zod-openapi";
|
|
5150
5253
|
|
|
5151
5254
|
// src/schemas/admin/search.ts
|
|
5152
|
-
import { z as
|
|
5153
|
-
var SearchDriverEntrySchema =
|
|
5154
|
-
driverName:
|
|
5155
|
-
pluginName:
|
|
5156
|
-
isActive:
|
|
5157
|
-
supportsRebuild:
|
|
5158
|
-
});
|
|
5159
|
-
var ActiveSearchDriverSchema =
|
|
5160
|
-
driverName:
|
|
5161
|
-
pluginName:
|
|
5162
|
-
supportsRebuild:
|
|
5163
|
-
});
|
|
5164
|
-
var GetSearchStatusResponseSchema =
|
|
5255
|
+
import { z as z49 } from "@hono/zod-openapi";
|
|
5256
|
+
var SearchDriverEntrySchema = z49.object({
|
|
5257
|
+
driverName: z49.string(),
|
|
5258
|
+
pluginName: z49.string(),
|
|
5259
|
+
isActive: z49.boolean(),
|
|
5260
|
+
supportsRebuild: z49.boolean()
|
|
5261
|
+
});
|
|
5262
|
+
var ActiveSearchDriverSchema = z49.object({
|
|
5263
|
+
driverName: z49.string(),
|
|
5264
|
+
pluginName: z49.string(),
|
|
5265
|
+
supportsRebuild: z49.boolean()
|
|
5266
|
+
});
|
|
5267
|
+
var GetSearchStatusResponseSchema = z49.object({
|
|
5165
5268
|
active: ActiveSearchDriverSchema.nullable(),
|
|
5166
|
-
drivers:
|
|
5269
|
+
drivers: z49.array(SearchDriverEntrySchema)
|
|
5167
5270
|
});
|
|
5168
5271
|
|
|
5169
5272
|
// src/contracts/admin/search.ts
|
|
@@ -5200,11 +5303,11 @@ var adminSearchRoutes = {
|
|
|
5200
5303
|
import { createRoute as createRoute31 } from "@hono/zod-openapi";
|
|
5201
5304
|
|
|
5202
5305
|
// src/schemas/admin/security.ts
|
|
5203
|
-
import { z as
|
|
5204
|
-
var RegistrationModeSchema =
|
|
5205
|
-
var SecuritySettingsSchema =
|
|
5306
|
+
import { z as z50 } from "@hono/zod-openapi";
|
|
5307
|
+
var RegistrationModeSchema = z50.enum(["Open", "Resricted", "Closed"]);
|
|
5308
|
+
var SecuritySettingsSchema = z50.object({
|
|
5206
5309
|
registrationMode: RegistrationModeSchema,
|
|
5207
|
-
registrationWhiteList:
|
|
5310
|
+
registrationWhiteList: z50.array(z50.string())
|
|
5208
5311
|
});
|
|
5209
5312
|
var UpdateSecuritySettingsRequestSchema = SecuritySettingsSchema;
|
|
5210
5313
|
var GetSecuritySettingsResponseSchema = SecuritySettingsSchema;
|
|
@@ -5275,19 +5378,19 @@ var adminSecurityRoutes = {
|
|
|
5275
5378
|
import { createRoute as createRoute32 } from "@hono/zod-openapi";
|
|
5276
5379
|
|
|
5277
5380
|
// src/schemas/admin/storage.ts
|
|
5278
|
-
import { z as
|
|
5279
|
-
var StorageDriverEntrySchema =
|
|
5280
|
-
driverName:
|
|
5281
|
-
pluginName:
|
|
5282
|
-
isActive:
|
|
5381
|
+
import { z as z51 } from "@hono/zod-openapi";
|
|
5382
|
+
var StorageDriverEntrySchema = z51.object({
|
|
5383
|
+
driverName: z51.string(),
|
|
5384
|
+
pluginName: z51.string(),
|
|
5385
|
+
isActive: z51.boolean()
|
|
5283
5386
|
});
|
|
5284
|
-
var ActiveStorageDriverSchema =
|
|
5285
|
-
driverName:
|
|
5286
|
-
pluginName:
|
|
5387
|
+
var ActiveStorageDriverSchema = z51.object({
|
|
5388
|
+
driverName: z51.string(),
|
|
5389
|
+
pluginName: z51.string()
|
|
5287
5390
|
});
|
|
5288
|
-
var GetStorageStatusResponseSchema =
|
|
5391
|
+
var GetStorageStatusResponseSchema = z51.object({
|
|
5289
5392
|
active: ActiveStorageDriverSchema.nullable(),
|
|
5290
|
-
drivers:
|
|
5393
|
+
drivers: z51.array(StorageDriverEntrySchema)
|
|
5291
5394
|
});
|
|
5292
5395
|
|
|
5293
5396
|
// src/contracts/admin/storage.ts
|
|
@@ -5324,87 +5427,87 @@ var adminStorageRoutes = {
|
|
|
5324
5427
|
import { createRoute as createRoute33 } from "@hono/zod-openapi";
|
|
5325
5428
|
|
|
5326
5429
|
// src/schemas/admin/users.ts
|
|
5327
|
-
import { z as
|
|
5430
|
+
import { z as z53 } from "@hono/zod-openapi";
|
|
5328
5431
|
|
|
5329
5432
|
// src/schemas/admin/_pager.ts
|
|
5330
|
-
import { z as
|
|
5331
|
-
var AdminPagerSchema =
|
|
5332
|
-
page:
|
|
5333
|
-
pagesCount:
|
|
5334
|
-
pages:
|
|
5335
|
-
total:
|
|
5336
|
-
previous:
|
|
5337
|
-
previousDots:
|
|
5338
|
-
next:
|
|
5339
|
-
nextDots:
|
|
5433
|
+
import { z as z52 } from "@hono/zod-openapi";
|
|
5434
|
+
var AdminPagerSchema = z52.object({
|
|
5435
|
+
page: z52.number(),
|
|
5436
|
+
pagesCount: z52.number(),
|
|
5437
|
+
pages: z52.array(z52.number()),
|
|
5438
|
+
total: z52.number(),
|
|
5439
|
+
previous: z52.number().nullable(),
|
|
5440
|
+
previousDots: z52.boolean(),
|
|
5441
|
+
next: z52.number().nullable(),
|
|
5442
|
+
nextDots: z52.boolean()
|
|
5340
5443
|
});
|
|
5341
5444
|
|
|
5342
5445
|
// src/schemas/admin/users.ts
|
|
5343
|
-
var ListAdminUsersRequestSchema =
|
|
5344
|
-
q:
|
|
5446
|
+
var ListAdminUsersRequestSchema = z53.object({
|
|
5447
|
+
q: z53.string().optional(),
|
|
5345
5448
|
/**
|
|
5346
5449
|
* Optional numeric user-status filter (see `UserStatusEnum`). When set, only
|
|
5347
5450
|
* users in that status are returned — used by the "user approval" queue
|
|
5348
5451
|
* screen to list `REGISTERED` (= awaiting admin approval) users.
|
|
5349
5452
|
*/
|
|
5350
|
-
status:
|
|
5351
|
-
page:
|
|
5352
|
-
limit:
|
|
5453
|
+
status: z53.coerce.number().int().optional(),
|
|
5454
|
+
page: z53.coerce.number().int().min(1).optional().default(1),
|
|
5455
|
+
limit: z53.coerce.number().int().min(1).max(100).optional().default(50)
|
|
5353
5456
|
});
|
|
5354
|
-
var ListAdminUsersResponseSchema =
|
|
5355
|
-
users:
|
|
5457
|
+
var ListAdminUsersResponseSchema = z53.object({
|
|
5458
|
+
users: z53.array(UserPublicSchema),
|
|
5356
5459
|
pager: AdminPagerSchema
|
|
5357
5460
|
});
|
|
5358
|
-
var SearchAdminUsersByEmailRequestSchema =
|
|
5359
|
-
email:
|
|
5461
|
+
var SearchAdminUsersByEmailRequestSchema = z53.object({
|
|
5462
|
+
email: z53.string().min(1)
|
|
5360
5463
|
});
|
|
5361
|
-
var SearchAdminUsersByEmailResponseSchema =
|
|
5362
|
-
users:
|
|
5464
|
+
var SearchAdminUsersByEmailResponseSchema = z53.object({
|
|
5465
|
+
users: z53.array(UserPublicSchema)
|
|
5363
5466
|
});
|
|
5364
|
-
var AdminUserIdParamSchema =
|
|
5365
|
-
id:
|
|
5467
|
+
var AdminUserIdParamSchema = z53.object({
|
|
5468
|
+
id: z53.string()
|
|
5366
5469
|
});
|
|
5367
|
-
var InviteUsersRequestSchema =
|
|
5368
|
-
emailList:
|
|
5369
|
-
sendEmail:
|
|
5470
|
+
var InviteUsersRequestSchema = z53.object({
|
|
5471
|
+
emailList: z53.array(z53.string().email()).min(1),
|
|
5472
|
+
sendEmail: z53.boolean().optional().default(false)
|
|
5370
5473
|
});
|
|
5371
|
-
var InvitedUserResultSchema =
|
|
5372
|
-
|
|
5373
|
-
email:
|
|
5374
|
-
status:
|
|
5375
|
-
userId:
|
|
5474
|
+
var InvitedUserResultSchema = z53.discriminatedUnion("status", [
|
|
5475
|
+
z53.object({
|
|
5476
|
+
email: z53.string(),
|
|
5477
|
+
status: z53.literal("created"),
|
|
5478
|
+
userId: z53.string()
|
|
5376
5479
|
}),
|
|
5377
|
-
|
|
5378
|
-
email:
|
|
5379
|
-
status:
|
|
5480
|
+
z53.object({
|
|
5481
|
+
email: z53.string(),
|
|
5482
|
+
status: z53.literal("exists")
|
|
5380
5483
|
}),
|
|
5381
|
-
|
|
5382
|
-
email:
|
|
5383
|
-
status:
|
|
5484
|
+
z53.object({
|
|
5485
|
+
email: z53.string(),
|
|
5486
|
+
status: z53.literal("failed")
|
|
5384
5487
|
})
|
|
5385
5488
|
]);
|
|
5386
|
-
var InviteUsersResponseSchema =
|
|
5387
|
-
results:
|
|
5489
|
+
var InviteUsersResponseSchema = z53.object({
|
|
5490
|
+
results: z53.array(InvitedUserResultSchema)
|
|
5388
5491
|
});
|
|
5389
|
-
var EditAdminUserRequestSchema =
|
|
5390
|
-
name:
|
|
5391
|
-
email:
|
|
5492
|
+
var EditAdminUserRequestSchema = z53.object({
|
|
5493
|
+
name: z53.string().min(1),
|
|
5494
|
+
email: z53.string().email()
|
|
5392
5495
|
});
|
|
5393
|
-
var AdminUserMutationResponseSchema =
|
|
5496
|
+
var AdminUserMutationResponseSchema = z53.object({
|
|
5394
5497
|
user: UserPublicSchema
|
|
5395
5498
|
});
|
|
5396
|
-
var ResetPasswordResponseSchema =
|
|
5499
|
+
var ResetPasswordResponseSchema = z53.object({
|
|
5397
5500
|
user: UserPublicSchema,
|
|
5398
|
-
newPassword:
|
|
5501
|
+
newPassword: z53.string()
|
|
5399
5502
|
});
|
|
5400
|
-
var UpdateAdminUserEmailRequestSchema =
|
|
5401
|
-
email:
|
|
5503
|
+
var UpdateAdminUserEmailRequestSchema = z53.object({
|
|
5504
|
+
email: z53.string().email()
|
|
5402
5505
|
});
|
|
5403
|
-
var DeleteAdminUserResponseSchema =
|
|
5404
|
-
deletedId:
|
|
5506
|
+
var DeleteAdminUserResponseSchema = z53.object({
|
|
5507
|
+
deletedId: z53.string()
|
|
5405
5508
|
});
|
|
5406
|
-
var PendingUsersCountResponseSchema =
|
|
5407
|
-
count:
|
|
5509
|
+
var PendingUsersCountResponseSchema = z53.object({
|
|
5510
|
+
count: z53.number().int().nonnegative()
|
|
5408
5511
|
});
|
|
5409
5512
|
|
|
5410
5513
|
// src/contracts/admin/users.ts
|
|
@@ -6166,7 +6269,7 @@ var appAuthMeUserChain = new OpenAPIHono().openapi(
|
|
|
6166
6269
|
)
|
|
6167
6270
|
).openapi(meRoutes.getProfileRoute, (c) => c.json(stubProfile, 200)).openapi(meRoutes.updateProfileRoute, (c) => c.json(stubProfile, 200)).openapi(meRoutes.updateThemeRoute, (c) => c.json({ status: "ok", theme: "system" }, 200)).openapi(meRoutes.uploadPictureRoute, (c) => c.json({ status: true }, 200)).openapi(meRoutes.deletePictureRoute, (c) => c.json({ status: "ok" }, 200)).openapi(meRoutes.updatePasswordRoute, (c) => c.json({ status: "ok", message: "" }, 200)).openapi(meRoutes.recentlyViewedPagesRoute, (c) => c.json({ pages: [] }, 200)).openapi(accessTokenRoutes.listAccessTokensRoute, (c) => c.json({ accessTokens: [] }, 200)).openapi(accessTokenRoutes.createAccessTokenRoute, (c) => c.json(stubCreateAccessToken, 201)).openapi(accessTokenRoutes.deleteAccessTokenRoute, (c) => c.json(stubAccessToken, 200)).openapi(userRoutes.getUserPageRoute, (c) => c.json(stubUserPage, 200)).openapi(userRoutes.getUserBookmarksRoute, (c) => c.json(stubUserBookmarks, 200)).openapi(userRoutes.getUserPagesRoute, (c) => c.json(stubUserPages, 200)).openapi(userRoutes.listMembersRoute, (c) => c.json(stubListUsers, 200));
|
|
6168
6271
|
var bookmarkBacklinkCommentRevisionChain = new OpenAPIHono().openapi(bookmarkRoutes.getBookmarkRoute, (c) => c.json(stubBookmarkResponse, 200)).openapi(bookmarkRoutes.listMyBookmarksRoute, (c) => c.json(stubListMyBookmarks, 200)).openapi(bookmarkRoutes.addBookmarkRoute, (c) => c.json(stubBookmarkResponse, 200)).openapi(bookmarkRoutes.removeBookmarkRoute, (c) => c.json(stubRemoveBookmark, 200)).openapi(backlinkRoutes.getBacklinksRoute, (c) => c.json(stubBacklinks, 200)).openapi(commentRoutes.listCommentsRoute, (c) => c.json(stubListComments, 200)).openapi(commentRoutes.addCommentRoute, (c) => c.json(stubAddComment, 200)).openapi(commentRoutes.deleteCommentRoute, (c) => c.json(stubDeleteComment, 200)).openapi(revisionRoutes.listRevisionsRoute, (c) => c.json(stubListRevisions, 200)).openapi(revisionRoutes.getRevisionsRoute, (c) => c.json(stubGetRevisions, 200)).openapi(revisionRoutes.getRevisionRoute, (c) => c.json(stubGetRevision, 200));
|
|
6169
|
-
var pageChain = new OpenAPIHono().openapi(pageRoutes.getPageRoute, (c) => c.json(stubPageWithRevision, 200)).openapi(pageRoutes.listPagesRoute, (c) => c.json(stubListPages, 200)).openapi(pageRoutes.listPageChildrenRoute, (c) => c.json(stubListPageChildren, 200)).openapi(pageRoutes.createPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.updatePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.setPageGrantRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.seenPageRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.getSeenUsersRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.likePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.unlikePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.getWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.setWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.deletePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertDeletedPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertToRevisionRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.renamePageRoute, (c) => c.json({ ...stubPageResponse, renamed_count: 1 }, 200)).openapi(pageRoutes.renameSubtreeRoute, (c) => c.json({ renamed_count: 0 }, 200)).openapi(pagePreviewRoutes.previewPageRoute, (c) => c.json(stubPreview, 200)).openapi(pageCollabRoutes.getYjsTokenRoute, (c) => c.json(stubWsToken, 200)).openapi(presenceRoutes.getPresenceTokenRoute, (c) => c.json(stubPresenceToken, 200)).openapi(presenceRoutes.getLikersRoute, (c) => c.json(stubLikers, 200));
|
|
6272
|
+
var pageChain = new OpenAPIHono().openapi(pageRoutes.getPageRoute, (c) => c.json(stubPageWithRevision, 200)).openapi(pageRoutes.listPagesRoute, (c) => c.json(stubListPages, 200)).openapi(pageRoutes.listPageChildrenRoute, (c) => c.json(stubListPageChildren, 200)).openapi(pageRoutes.createPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.updatePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.setPageGrantRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.seenPageRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.getSeenUsersRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.likePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.unlikePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.claimPageLinkAccessRoute, (c) => c.json({ ...stubPageWithRevision, granted: false }, 200)).openapi(pageRoutes.getWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.setWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.deletePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertDeletedPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertToRevisionRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.renamePageRoute, (c) => c.json({ ...stubPageResponse, renamed_count: 1 }, 200)).openapi(pageRoutes.renameSubtreeRoute, (c) => c.json({ renamed_count: 0 }, 200)).openapi(pagePreviewRoutes.previewPageRoute, (c) => c.json(stubPreview, 200)).openapi(pageCollabRoutes.getYjsTokenRoute, (c) => c.json(stubWsToken, 200)).openapi(presenceRoutes.getPresenceTokenRoute, (c) => c.json(stubPresenceToken, 200)).openapi(presenceRoutes.getLikersRoute, (c) => c.json(stubLikers, 200));
|
|
6170
6273
|
var lateContractApp = new OpenAPIHono().openapi(draftRoutes.createDraftRoute, (c) => c.json(stubCreateDraft, 201)).openapi(draftRoutes.listDraftsRoute, (c) => c.json(stubListDrafts, 200)).openapi(draftRoutes.cancelDraftRoute, (c) => c.json(stubCreateDraft, 200)).openapi(autocompleteRoutes.autocompleteUsersRoute, (c) => c.json(stubAutocomplete, 200)).openapi(autocompleteRoutes.autocompletePagesRoute, (c) => c.json(stubAutocomplete, 200)).openapi(attachmentRoutes.getAttachmentUsageRoute, (c) => c.json(stubAttachmentUsage, 200)).openapi(attachmentRoutes.listAttachmentsRoute, (c) => c.json(stubListAttachments, 200)).openapi(attachmentRoutes.addAttachmentRoute, (c) => c.json(stubAddAttachment, 200)).openapi(attachmentRoutes.uploadAttachmentRoute, (c) => c.json(stubUploadAttachment, 200)).openapi(attachmentRoutes.getAttachmentMetaRoute, (c) => c.json(stubAttachmentMeta, 200)).openapi(attachmentRoutes.removeAttachmentRoute, (c) => c.json(stubRemoveAttachment, 200)).openapi(searchRoutes.searchPagesRoute, (c) => c.json(stubSearchPages, 200)).openapi(adminCryptoRoutes.getCryptoStatusRoute, (c) => c.json(stubCryptoStatus, 200)).openapi(adminCryptoRoutes.reencryptAllRoute, (c) => c.json(stubReencrypt, 200)).openapi(notificationRoutes.listNotificationsRoute, (c) => c.json(stubListNotifications, 200)).openapi(notificationRoutes.markAllAsReadRoute, (c) => c.json(stubMarkAllAsRead, 200)).openapi(notificationRoutes.getNotificationsTokenRoute, (c) => c.json(stubNotificationsToken, 200)).openapi(notificationRoutes.getUnreadCountRoute, (c) => c.json(stubNotificationStatus, 200)).openapi(notificationRoutes.openNotificationRoute, (c) => c.json(stubOpenNotification, 200));
|
|
6171
6274
|
var adminSettingsContractApp = new OpenAPIHono().openapi(adminAppRoutes.getAppSettingsRoute, (c) => c.json(stubGetAppSettings, 200)).openapi(adminAppRoutes.updateAppSettingsRoute, (c) => c.json(stubUpdateAppSettings, 200)).openapi(adminAuthRoutes.getAuthSettingsRoute, (c) => c.json(stubAuthSettings, 200)).openapi(adminAuthRoutes.updateAuthSettingsRoute, (c) => c.json(stubAuthSettings, 200)).openapi(adminSecurityRoutes.getSecuritySettingsRoute, (c) => c.json(stubSecuritySettings, 200)).openapi(adminSecurityRoutes.updateSecuritySettingsRoute, (c) => c.json(stubSecuritySettings, 200)).openapi(adminMailRoutes.getMailSettingsRoute, (c) => c.json(stubMailSettings, 200)).openapi(adminMailRoutes.updateMailSettingsRoute, (c) => c.json(stubUpdateMailSettings, 200)).openapi(adminMailRoutes.sendTestMailRoute, (c) => c.json(stubSendTestMail, 200)).openapi(adminStorageRoutes.getStorageStatusRoute, (c) => c.json(stubStorageStatus, 200)).openapi(adminSearchRoutes.getSearchStatusRoute, (c) => c.json(stubSearchStatus, 200));
|
|
6172
6275
|
var adminUsersPluginsContractApp = new OpenAPIHono().openapi(adminUsersRoutes.listUsersRoute, (c) => c.json(stubListAdminUsers, 200)).openapi(adminUsersRoutes.searchUsersByEmailRoute, (c) => c.json(stubSearchAdminUsersByEmail, 200)).openapi(adminUsersRoutes.pendingUsersCountRoute, (c) => c.json(stubPendingUsersCount, 200)).openapi(adminUsersRoutes.inviteUsersRoute, (c) => c.json(stubInviteUsers, 200)).openapi(adminUsersRoutes.editUserRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.makeAdminRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.removeFromAdminRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.activateUserRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.suspendUserRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.resetPasswordRoute, (c) => c.json(stubResetPassword, 200)).openapi(adminUsersRoutes.resendInviteRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.updateUserEmailRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.deleteUserRoute, (c) => c.json(stubDeleteAdminUser, 200)).openapi(adminPluginsRoutes.listPluginsRoute, (c) => c.json(stubListPlugins, 200)).openapi(adminPluginsRoutes.getPluginConfigRoute, (c) => c.json(stubPluginConfig, 200)).openapi(adminPluginsRoutes.updatePluginConfigRoute, (c) => c.json(stubUpdatePluginConfig, 200)).openapi(adminPluginsRoutes.clearRenderCacheAllRoute, (c) => c.json(stubClearRenderCache, 200)).openapi(adminPluginsRoutes.clearRenderCachePluginRoute, (c) => c.json(stubClearRenderCache, 200));
|
|
@@ -6176,42 +6279,26 @@ var createClient = (baseUrl, options = {}) => hc(baseUrl, {
|
|
|
6176
6279
|
fetch: options.fetch
|
|
6177
6280
|
});
|
|
6178
6281
|
|
|
6179
|
-
// src/schemas/app-capabilities.ts
|
|
6180
|
-
var STATIC_CAPABILITIES = [
|
|
6181
|
-
"oauth",
|
|
6182
|
-
// The oauth:* tags mirror GRANT_TYPES_SUPPORTED + the S256 PKCE method
|
|
6183
|
-
// (schemas/oauth-endpoints.ts / the RFC 8414 discovery doc). Keep in sync.
|
|
6184
|
-
"oauth:auth-code",
|
|
6185
|
-
"oauth:device",
|
|
6186
|
-
"oauth:pkce",
|
|
6187
|
-
"pat",
|
|
6188
|
-
"pages",
|
|
6189
|
-
"comments",
|
|
6190
|
-
"bookmarks",
|
|
6191
|
-
"attachments",
|
|
6192
|
-
"notifications"
|
|
6193
|
-
];
|
|
6194
|
-
var API_SURFACE_VERSION = "v2";
|
|
6195
|
-
|
|
6196
6282
|
// src/schemas/mail-token.ts
|
|
6197
|
-
import { z as
|
|
6198
|
-
var MailTokenPurposeSchema =
|
|
6199
|
-
var MailTokenPayloadSchema =
|
|
6283
|
+
import { z as z55 } from "@hono/zod-openapi";
|
|
6284
|
+
var MailTokenPurposeSchema = z55.enum(["invite", "activate", "reset", "email-change"]);
|
|
6285
|
+
var MailTokenPayloadSchema = z55.object({
|
|
6200
6286
|
purpose: MailTokenPurposeSchema,
|
|
6201
|
-
userId:
|
|
6287
|
+
userId: z55.string(),
|
|
6202
6288
|
/** Target address. For `email-change` this is the NEW address. */
|
|
6203
|
-
email:
|
|
6289
|
+
email: z55.string().email(),
|
|
6204
6290
|
/**
|
|
6205
6291
|
* For `email-change`: the account's email at issue time. The confirm
|
|
6206
6292
|
* endpoint rejects the token unless it still matches, making the token
|
|
6207
6293
|
* single-use (a stale token cannot revert a later change).
|
|
6208
6294
|
*/
|
|
6209
|
-
fromEmail:
|
|
6295
|
+
fromEmail: z55.string().email().optional(),
|
|
6210
6296
|
// iat / exp are injected and verified by the JWT layer.
|
|
6211
|
-
iat:
|
|
6212
|
-
exp:
|
|
6297
|
+
iat: z55.number().optional(),
|
|
6298
|
+
exp: z55.number().optional()
|
|
6213
6299
|
});
|
|
6214
6300
|
export {
|
|
6301
|
+
ALL_CAPABILITIES,
|
|
6215
6302
|
ALL_SCOPES,
|
|
6216
6303
|
API_SURFACE_VERSION,
|
|
6217
6304
|
AccessTokenSchema,
|
|
@@ -6250,6 +6337,8 @@ export {
|
|
|
6250
6337
|
BacklinkSchema,
|
|
6251
6338
|
BookmarkResponseSchema,
|
|
6252
6339
|
BookmarkSchema,
|
|
6340
|
+
CapabilitySchema,
|
|
6341
|
+
ClaimPageLinkAccessResponseSchema,
|
|
6253
6342
|
ClearRenderCacheResponseSchema,
|
|
6254
6343
|
CollabForceReloadMessageSchema,
|
|
6255
6344
|
CollabSaveErrorSchema,
|
|
@@ -6273,6 +6362,7 @@ export {
|
|
|
6273
6362
|
DEVICE_CODE_GRANT_TYPE,
|
|
6274
6363
|
DISCOVERY_SCOPES_SUPPORTED,
|
|
6275
6364
|
DND_EXTRA_UPLOAD_MIME,
|
|
6365
|
+
DYNAMIC_CAPABILITIES,
|
|
6276
6366
|
DeleteAdminUserResponseSchema,
|
|
6277
6367
|
DeleteCommentRequestSchema,
|
|
6278
6368
|
DeleteCommentResponseSchema,
|
|
@@ -6526,6 +6616,7 @@ export {
|
|
|
6526
6616
|
backlinkRoutes,
|
|
6527
6617
|
bookmarkRoutes,
|
|
6528
6618
|
cancelDraftRoute,
|
|
6619
|
+
claimPageLinkAccessRoute,
|
|
6529
6620
|
clearRenderCacheAllRoute,
|
|
6530
6621
|
clearRenderCachePluginRoute,
|
|
6531
6622
|
commentRoutes,
|