@crowi/api-contract 2.0.0-alpha.19 → 2.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2912,7 +2912,6 @@ var PageSchema = z24.object({
2912
2912
  grantedUsers: z24.array(z24.string()).optional(),
2913
2913
  creator: z24.union([z24.string(), PageUserSchema]).nullable().optional(),
2914
2914
  lastUpdateUser: z24.union([z24.string(), PageUserSchema]).nullable().optional(),
2915
- liker: z24.array(z24.string()).optional(),
2916
2915
  commentCount: z24.number().default(0),
2917
2916
  extended: PageExtendedSchema,
2918
2917
  createdAt: z24.string(),
@@ -2928,8 +2927,15 @@ var PageSchema = z24.object({
2928
2927
  yjsCheckpointAt: z24.string().nullable().optional(),
2929
2928
  // dynamic fields
2930
2929
  latestRevision: z24.string().optional(),
2931
- likerCount: z24.number().optional(),
2932
- seenUsersCount: z24.number().optional()
2930
+ // feature-page-relations-collections D-2 — Like / Seen are independent
2931
+ // relation collections now; the wire no longer carries the full liker
2932
+ // ID array (removed above), only these derived, viewer-scoped fields.
2933
+ // Required (not optional): every response path routes through
2934
+ // `populatePageRelationData` before serialising a Page, so these are
2935
+ // always present.
2936
+ likerCount: z24.number().int().nonnegative(),
2937
+ seenUsersCount: z24.number().int().nonnegative(),
2938
+ isLiked: z24.boolean()
2933
2939
  });
2934
2940
  var PageWithRevisionSchema = PageSchema.extend({
2935
2941
  revision: RevisionSchema,
@@ -3027,10 +3033,20 @@ var PageChildSegmentSchema = z24.object({
3027
3033
  var ListPageChildrenRequestSchema = z24.object({
3028
3034
  // Portal path to list children of. Trailing slash optional — the
3029
3035
  // handler normalises it. '/' lists the top-level segments.
3030
- path: z24.string()
3036
+ path: z24.string(),
3037
+ // How many levels below `path` to return (default 1 — immediate children
3038
+ // only, the original behaviour). The server scans the whole subtree
3039
+ // either way, so a deeper request costs no extra query; it only widens
3040
+ // what is grouped into the response. The sidebar asks for 2 at a
3041
+ // `YYYY/MM/` node so it can open every day of the month at once.
3042
+ depth: z24.coerce.number().int().min(1).max(2).optional()
3031
3043
  });
3032
3044
  var ListPageChildrenResponseSchema = z24.object({
3033
- // Sorted alphabetically by segment.
3045
+ // Depth-first, siblings sorted alphabetically by segment — so a node is
3046
+ // immediately followed by its own subtree. With the default `depth` of 1
3047
+ // this is simply the alphabetical first-level listing. Deeper levels are
3048
+ // NOT nested: every row sits in this one flat array and carries its full
3049
+ // `path`, which is what places it in the tree.
3034
3050
  children: z24.array(PageChildSegmentSchema)
3035
3051
  });
3036
3052
  var CreatePageRequestSchema = z24.object({
@@ -3207,6 +3223,15 @@ var GetBookmarkRequestSchema = z25.object({
3207
3223
  var BookmarkResponseSchema = z25.object({
3208
3224
  bookmark: BookmarkSchema.nullable()
3209
3225
  });
3226
+ var GetBookmarkSchema = z25.object({
3227
+ _id: z25.string(),
3228
+ page: z25.string().nullable(),
3229
+ user: z25.union([z25.string(), UserPublicSchema]),
3230
+ createdAt: z25.string()
3231
+ });
3232
+ var GetBookmarkResponseSchema = z25.object({
3233
+ bookmark: GetBookmarkSchema.nullable()
3234
+ });
3210
3235
  var ListMyBookmarksResponseSchema = z25.object({
3211
3236
  bookmarks: z25.array(BookmarkSchema),
3212
3237
  pager: PagerSchema,
@@ -3259,10 +3284,14 @@ var UserPageResponseSchema = z26.object({
3259
3284
  createdPagesCount: z26.number(),
3260
3285
  bookmarksCount: z26.number(),
3261
3286
  // feature-profile-stats-and-page-total — the target user's OWN actions:
3262
- // pages they liked (`Page.liker` contains their id) and comments they
3263
- // wrote (`Comment.creator` is their id). NOT activity their own pages
3264
- // received from others, and not re-filtered by the viewer's grants —
3265
- // see the spec's "プロフィール統計の主語と API 契約" section.
3287
+ // pages they liked and comments they wrote (`Comment.creator` is their
3288
+ // id). NOT activity their own pages received from others, and not
3289
+ // re-filtered by the viewer's grants — see the spec's "プロフィール統計の
3290
+ // 主語と API 契約" section. feature-page-relations-collections D-6:
3291
+ // `likesCount` is the count of `likes` relation rows whose Page still
3292
+ // exists (an existence-filtered aggregate, not a raw row count) — a
3293
+ // best-effort post-delete cleanup failure can leave an orphaned `likes`
3294
+ // row, and that row must not inflate this number.
3266
3295
  likesCount: z26.number(),
3267
3296
  commentsCount: z26.number(),
3268
3297
  // Optionally include recent items for initial display
@@ -3298,8 +3327,8 @@ var getBookmarkRoute = createRoute14({
3298
3327
  },
3299
3328
  responses: {
3300
3329
  200: {
3301
- description: "Bookmark for the page (or null when not bookmarked)",
3302
- content: { "application/json": { schema: BookmarkResponseSchema } }
3330
+ description: "Bookmark for the page (or null when not bookmarked). `page` is a bare page id \u2014 this route never populates the page (feature-page-relations-collections D-2).",
3331
+ content: { "application/json": { schema: GetBookmarkResponseSchema } }
3303
3332
  },
3304
3333
  400: {
3305
3334
  description: "Invalid page_id",
@@ -5015,13 +5044,13 @@ var listPageChildrenRoute = createRoute24({
5015
5044
  path: "/pages/children",
5016
5045
  tags: ["page"],
5017
5046
  security: [{ bearerAuth: [] }],
5018
- summary: "List immediate child segments under a portal path (sidebar tree)",
5047
+ summary: "List child segments under a portal path, up to `depth` levels (sidebar tree)",
5019
5048
  request: {
5020
5049
  query: ListPageChildrenRequestSchema
5021
5050
  },
5022
5051
  responses: {
5023
5052
  200: {
5024
- description: "First-level child segments (alphabetical) under the path",
5053
+ description: "Child segments under the path, depth-first with siblings alphabetical, spanning `depth` levels (default 1). Flat \u2014 a row's own `path` places it in the tree.",
5025
5054
  content: { "application/json": { schema: ListPageChildrenResponseSchema } }
5026
5055
  },
5027
5056
  401: {
@@ -5183,7 +5212,7 @@ var likePageRoute = createRoute24({
5183
5212
  path: "/pages/like",
5184
5213
  tags: ["page"],
5185
5214
  security: [{ bearerAuth: [] }],
5186
- summary: "Add the current user to the page liker list",
5215
+ summary: "Add the current user to the page like relation",
5187
5216
  request: {
5188
5217
  body: {
5189
5218
  content: { "application/json": { schema: PageIdBodySchema } }
@@ -5191,7 +5220,7 @@ var likePageRoute = createRoute24({
5191
5220
  },
5192
5221
  responses: {
5193
5222
  200: {
5194
- description: "The page with the updated liker list",
5223
+ description: "The page, viewer-scoped: `likerCount` / `seenUsersCount` are the current relation counts (not a liker ID array \u2014 feature-page-relations-collections D-2), `isLiked` reflects the caller's own membership as of this response.",
5195
5224
  content: { "application/json": { schema: PageResponseSchema } }
5196
5225
  },
5197
5226
  400: {
@@ -5213,7 +5242,7 @@ var unlikePageRoute = createRoute24({
5213
5242
  path: "/pages/unlike",
5214
5243
  tags: ["page"],
5215
5244
  security: [{ bearerAuth: [] }],
5216
- summary: "Remove the current user from the page liker list",
5245
+ summary: "Remove the current user from the page like relation",
5217
5246
  request: {
5218
5247
  body: {
5219
5248
  content: { "application/json": { schema: PageIdBodySchema } }
@@ -5221,7 +5250,7 @@ var unlikePageRoute = createRoute24({
5221
5250
  },
5222
5251
  responses: {
5223
5252
  200: {
5224
- description: "The page with the updated liker list",
5253
+ description: "The page, viewer-scoped: `likerCount` / `seenUsersCount` are the current relation counts (not a liker ID array \u2014 feature-page-relations-collections D-2), `isLiked` reflects the caller's own membership as of this response.",
5225
5254
  content: { "application/json": { schema: PageResponseSchema } }
5226
5255
  },
5227
5256
  400: {
@@ -5755,7 +5784,7 @@ var getLikersRoute = createRoute26({
5755
5784
  },
5756
5785
  responses: {
5757
5786
  200: {
5758
- description: "Liker list (newest-liked first when known) with full totalCount",
5787
+ description: "Liker list (newest-liked first when known) with full totalCount. Sourced from the `likes` relation collection; `likedAt` falls back to a best-effort `ACTION_LIKE` Activity join only for a migrated row with a null relation timestamp (feature-page-relations-collections D-1/D-3).",
5759
5788
  content: { "application/json": { schema: LikersResponseSchema } }
5760
5789
  },
5761
5790
  400: {
@@ -7461,6 +7490,7 @@ var stubListUsers = {
7461
7490
  total: 0
7462
7491
  };
7463
7492
  var stubBookmarkResponse = { bookmark: null };
7493
+ var stubGetBookmarkResponse = { bookmark: null };
7464
7494
  var stubListMyBookmarks = { bookmarks: [], pager: stubPager, total: 0 };
7465
7495
  var stubRemoveBookmark = { ok: true };
7466
7496
  var stubBacklinks = { backlinks: [], hasNext: false };
@@ -7512,7 +7542,10 @@ var stubPage = {
7512
7542
  _id: "",
7513
7543
  path: "",
7514
7544
  commentCount: 0,
7515
- createdAt: ""
7545
+ createdAt: "",
7546
+ likerCount: 0,
7547
+ seenUsersCount: 0,
7548
+ isLiked: false
7516
7549
  };
7517
7550
  var stubPageWithRevision = {
7518
7551
  page: {
@@ -7526,7 +7559,10 @@ var stubPageWithRevision = {
7526
7559
  createdAt: ""
7527
7560
  },
7528
7561
  commentCount: 0,
7529
- createdAt: ""
7562
+ createdAt: "",
7563
+ likerCount: 0,
7564
+ seenUsersCount: 0,
7565
+ isLiked: false
7530
7566
  }
7531
7567
  };
7532
7568
  var stubPageResponse = { page: stubPage };
@@ -7667,7 +7703,7 @@ var appAuthMeUserChain = new OpenAPIHono().openapi(
7667
7703
  meRoutes.updatePasswordRoute,
7668
7704
  (c) => c.json({ status: "ok", message: "", accessToken: "", refreshToken: "", expiresIn: 0 }, 200)
7669
7705
  ).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.getUserSubpagesRoute, (c) => c.json(stubUserPages, 200)).openapi(userRoutes.listMembersRoute, (c) => c.json(stubListUsers, 200));
7670
- 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)).openapi(getPageHistoryRoute, (c) => c.json(stubPageHistory, 200));
7706
+ var bookmarkBacklinkCommentRevisionChain = new OpenAPIHono().openapi(bookmarkRoutes.getBookmarkRoute, (c) => c.json(stubGetBookmarkResponse, 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)).openapi(getPageHistoryRoute, (c) => c.json(stubPageHistory, 200));
7671
7707
  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));
7672
7708
  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(attachmentRoutes.getUploadPolicyRoute, (c) => c.json(stubUploadPolicy, 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));
7673
7709
  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));
@@ -8023,6 +8059,8 @@ export {
8023
8059
  GetBacklinksRequestSchema,
8024
8060
  GetBacklinksResponseSchema,
8025
8061
  GetBookmarkRequestSchema,
8062
+ GetBookmarkResponseSchema,
8063
+ GetBookmarkSchema,
8026
8064
  GetLikersRequestSchema,
8027
8065
  GetMailSettingsResponseSchema,
8028
8066
  GetPageRequestSchema,