@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.js CHANGED
@@ -153,6 +153,8 @@ __export(index_exports, {
153
153
  GetBacklinksRequestSchema: () => GetBacklinksRequestSchema,
154
154
  GetBacklinksResponseSchema: () => GetBacklinksResponseSchema,
155
155
  GetBookmarkRequestSchema: () => GetBookmarkRequestSchema,
156
+ GetBookmarkResponseSchema: () => GetBookmarkResponseSchema,
157
+ GetBookmarkSchema: () => GetBookmarkSchema,
156
158
  GetLikersRequestSchema: () => GetLikersRequestSchema,
157
159
  GetMailSettingsResponseSchema: () => GetMailSettingsResponseSchema,
158
160
  GetPageRequestSchema: () => GetPageRequestSchema,
@@ -3512,7 +3514,6 @@ var PageSchema = import_zod_openapi32.z.object({
3512
3514
  grantedUsers: import_zod_openapi32.z.array(import_zod_openapi32.z.string()).optional(),
3513
3515
  creator: import_zod_openapi32.z.union([import_zod_openapi32.z.string(), PageUserSchema]).nullable().optional(),
3514
3516
  lastUpdateUser: import_zod_openapi32.z.union([import_zod_openapi32.z.string(), PageUserSchema]).nullable().optional(),
3515
- liker: import_zod_openapi32.z.array(import_zod_openapi32.z.string()).optional(),
3516
3517
  commentCount: import_zod_openapi32.z.number().default(0),
3517
3518
  extended: PageExtendedSchema,
3518
3519
  createdAt: import_zod_openapi32.z.string(),
@@ -3528,8 +3529,15 @@ var PageSchema = import_zod_openapi32.z.object({
3528
3529
  yjsCheckpointAt: import_zod_openapi32.z.string().nullable().optional(),
3529
3530
  // dynamic fields
3530
3531
  latestRevision: import_zod_openapi32.z.string().optional(),
3531
- likerCount: import_zod_openapi32.z.number().optional(),
3532
- seenUsersCount: import_zod_openapi32.z.number().optional()
3532
+ // feature-page-relations-collections D-2 — Like / Seen are independent
3533
+ // relation collections now; the wire no longer carries the full liker
3534
+ // ID array (removed above), only these derived, viewer-scoped fields.
3535
+ // Required (not optional): every response path routes through
3536
+ // `populatePageRelationData` before serialising a Page, so these are
3537
+ // always present.
3538
+ likerCount: import_zod_openapi32.z.number().int().nonnegative(),
3539
+ seenUsersCount: import_zod_openapi32.z.number().int().nonnegative(),
3540
+ isLiked: import_zod_openapi32.z.boolean()
3533
3541
  });
3534
3542
  var PageWithRevisionSchema = PageSchema.extend({
3535
3543
  revision: RevisionSchema,
@@ -3627,10 +3635,20 @@ var PageChildSegmentSchema = import_zod_openapi32.z.object({
3627
3635
  var ListPageChildrenRequestSchema = import_zod_openapi32.z.object({
3628
3636
  // Portal path to list children of. Trailing slash optional — the
3629
3637
  // handler normalises it. '/' lists the top-level segments.
3630
- path: import_zod_openapi32.z.string()
3638
+ path: import_zod_openapi32.z.string(),
3639
+ // How many levels below `path` to return (default 1 — immediate children
3640
+ // only, the original behaviour). The server scans the whole subtree
3641
+ // either way, so a deeper request costs no extra query; it only widens
3642
+ // what is grouped into the response. The sidebar asks for 2 at a
3643
+ // `YYYY/MM/` node so it can open every day of the month at once.
3644
+ depth: import_zod_openapi32.z.coerce.number().int().min(1).max(2).optional()
3631
3645
  });
3632
3646
  var ListPageChildrenResponseSchema = import_zod_openapi32.z.object({
3633
- // Sorted alphabetically by segment.
3647
+ // Depth-first, siblings sorted alphabetically by segment — so a node is
3648
+ // immediately followed by its own subtree. With the default `depth` of 1
3649
+ // this is simply the alphabetical first-level listing. Deeper levels are
3650
+ // NOT nested: every row sits in this one flat array and carries its full
3651
+ // `path`, which is what places it in the tree.
3634
3652
  children: import_zod_openapi32.z.array(PageChildSegmentSchema)
3635
3653
  });
3636
3654
  var CreatePageRequestSchema = import_zod_openapi32.z.object({
@@ -3807,6 +3825,15 @@ var GetBookmarkRequestSchema = import_zod_openapi34.z.object({
3807
3825
  var BookmarkResponseSchema = import_zod_openapi34.z.object({
3808
3826
  bookmark: BookmarkSchema.nullable()
3809
3827
  });
3828
+ var GetBookmarkSchema = import_zod_openapi34.z.object({
3829
+ _id: import_zod_openapi34.z.string(),
3830
+ page: import_zod_openapi34.z.string().nullable(),
3831
+ user: import_zod_openapi34.z.union([import_zod_openapi34.z.string(), UserPublicSchema]),
3832
+ createdAt: import_zod_openapi34.z.string()
3833
+ });
3834
+ var GetBookmarkResponseSchema = import_zod_openapi34.z.object({
3835
+ bookmark: GetBookmarkSchema.nullable()
3836
+ });
3810
3837
  var ListMyBookmarksResponseSchema = import_zod_openapi34.z.object({
3811
3838
  bookmarks: import_zod_openapi34.z.array(BookmarkSchema),
3812
3839
  pager: PagerSchema,
@@ -3859,10 +3886,14 @@ var UserPageResponseSchema = import_zod_openapi35.z.object({
3859
3886
  createdPagesCount: import_zod_openapi35.z.number(),
3860
3887
  bookmarksCount: import_zod_openapi35.z.number(),
3861
3888
  // feature-profile-stats-and-page-total — the target user's OWN actions:
3862
- // pages they liked (`Page.liker` contains their id) and comments they
3863
- // wrote (`Comment.creator` is their id). NOT activity their own pages
3864
- // received from others, and not re-filtered by the viewer's grants —
3865
- // see the spec's "プロフィール統計の主語と API 契約" section.
3889
+ // pages they liked and comments they wrote (`Comment.creator` is their
3890
+ // id). NOT activity their own pages received from others, and not
3891
+ // re-filtered by the viewer's grants — see the spec's "プロフィール統計の
3892
+ // 主語と API 契約" section. feature-page-relations-collections D-6:
3893
+ // `likesCount` is the count of `likes` relation rows whose Page still
3894
+ // exists (an existence-filtered aggregate, not a raw row count) — a
3895
+ // best-effort post-delete cleanup failure can leave an orphaned `likes`
3896
+ // row, and that row must not inflate this number.
3866
3897
  likesCount: import_zod_openapi35.z.number(),
3867
3898
  commentsCount: import_zod_openapi35.z.number(),
3868
3899
  // Optionally include recent items for initial display
@@ -3898,8 +3929,8 @@ var getBookmarkRoute = (0, import_zod_openapi36.createRoute)({
3898
3929
  },
3899
3930
  responses: {
3900
3931
  200: {
3901
- description: "Bookmark for the page (or null when not bookmarked)",
3902
- content: { "application/json": { schema: BookmarkResponseSchema } }
3932
+ 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).",
3933
+ content: { "application/json": { schema: GetBookmarkResponseSchema } }
3903
3934
  },
3904
3935
  400: {
3905
3936
  description: "Invalid page_id",
@@ -5615,13 +5646,13 @@ var listPageChildrenRoute = (0, import_zod_openapi56.createRoute)({
5615
5646
  path: "/pages/children",
5616
5647
  tags: ["page"],
5617
5648
  security: [{ bearerAuth: [] }],
5618
- summary: "List immediate child segments under a portal path (sidebar tree)",
5649
+ summary: "List child segments under a portal path, up to `depth` levels (sidebar tree)",
5619
5650
  request: {
5620
5651
  query: ListPageChildrenRequestSchema
5621
5652
  },
5622
5653
  responses: {
5623
5654
  200: {
5624
- description: "First-level child segments (alphabetical) under the path",
5655
+ 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.",
5625
5656
  content: { "application/json": { schema: ListPageChildrenResponseSchema } }
5626
5657
  },
5627
5658
  401: {
@@ -5783,7 +5814,7 @@ var likePageRoute = (0, import_zod_openapi56.createRoute)({
5783
5814
  path: "/pages/like",
5784
5815
  tags: ["page"],
5785
5816
  security: [{ bearerAuth: [] }],
5786
- summary: "Add the current user to the page liker list",
5817
+ summary: "Add the current user to the page like relation",
5787
5818
  request: {
5788
5819
  body: {
5789
5820
  content: { "application/json": { schema: PageIdBodySchema } }
@@ -5791,7 +5822,7 @@ var likePageRoute = (0, import_zod_openapi56.createRoute)({
5791
5822
  },
5792
5823
  responses: {
5793
5824
  200: {
5794
- description: "The page with the updated liker list",
5825
+ 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.",
5795
5826
  content: { "application/json": { schema: PageResponseSchema } }
5796
5827
  },
5797
5828
  400: {
@@ -5813,7 +5844,7 @@ var unlikePageRoute = (0, import_zod_openapi56.createRoute)({
5813
5844
  path: "/pages/unlike",
5814
5845
  tags: ["page"],
5815
5846
  security: [{ bearerAuth: [] }],
5816
- summary: "Remove the current user from the page liker list",
5847
+ summary: "Remove the current user from the page like relation",
5817
5848
  request: {
5818
5849
  body: {
5819
5850
  content: { "application/json": { schema: PageIdBodySchema } }
@@ -5821,7 +5852,7 @@ var unlikePageRoute = (0, import_zod_openapi56.createRoute)({
5821
5852
  },
5822
5853
  responses: {
5823
5854
  200: {
5824
- description: "The page with the updated liker list",
5855
+ 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.",
5825
5856
  content: { "application/json": { schema: PageResponseSchema } }
5826
5857
  },
5827
5858
  400: {
@@ -6355,7 +6386,7 @@ var getLikersRoute = (0, import_zod_openapi60.createRoute)({
6355
6386
  },
6356
6387
  responses: {
6357
6388
  200: {
6358
- description: "Liker list (newest-liked first when known) with full totalCount",
6389
+ 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).",
6359
6390
  content: { "application/json": { schema: LikersResponseSchema } }
6360
6391
  },
6361
6392
  400: {
@@ -8061,6 +8092,7 @@ var stubListUsers = {
8061
8092
  total: 0
8062
8093
  };
8063
8094
  var stubBookmarkResponse = { bookmark: null };
8095
+ var stubGetBookmarkResponse = { bookmark: null };
8064
8096
  var stubListMyBookmarks = { bookmarks: [], pager: stubPager, total: 0 };
8065
8097
  var stubRemoveBookmark = { ok: true };
8066
8098
  var stubBacklinks = { backlinks: [], hasNext: false };
@@ -8112,7 +8144,10 @@ var stubPage = {
8112
8144
  _id: "",
8113
8145
  path: "",
8114
8146
  commentCount: 0,
8115
- createdAt: ""
8147
+ createdAt: "",
8148
+ likerCount: 0,
8149
+ seenUsersCount: 0,
8150
+ isLiked: false
8116
8151
  };
8117
8152
  var stubPageWithRevision = {
8118
8153
  page: {
@@ -8126,7 +8161,10 @@ var stubPageWithRevision = {
8126
8161
  createdAt: ""
8127
8162
  },
8128
8163
  commentCount: 0,
8129
- createdAt: ""
8164
+ createdAt: "",
8165
+ likerCount: 0,
8166
+ seenUsersCount: 0,
8167
+ isLiked: false
8130
8168
  }
8131
8169
  };
8132
8170
  var stubPageResponse = { page: stubPage };
@@ -8267,7 +8305,7 @@ var appAuthMeUserChain = new import_zod_openapi84.OpenAPIHono().openapi(
8267
8305
  meRoutes.updatePasswordRoute,
8268
8306
  (c) => c.json({ status: "ok", message: "", accessToken: "", refreshToken: "", expiresIn: 0 }, 200)
8269
8307
  ).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));
8270
- var bookmarkBacklinkCommentRevisionChain = new import_zod_openapi84.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));
8308
+ var bookmarkBacklinkCommentRevisionChain = new import_zod_openapi84.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));
8271
8309
  var pageChain = new import_zod_openapi84.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));
8272
8310
  var lateContractApp = new import_zod_openapi84.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));
8273
8311
  var adminSettingsContractApp = new import_zod_openapi84.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));
@@ -8624,6 +8662,8 @@ var WS_CLOSE_CODES = {
8624
8662
  GetBacklinksRequestSchema,
8625
8663
  GetBacklinksResponseSchema,
8626
8664
  GetBookmarkRequestSchema,
8665
+ GetBookmarkResponseSchema,
8666
+ GetBookmarkSchema,
8627
8667
  GetLikersRequestSchema,
8628
8668
  GetMailSettingsResponseSchema,
8629
8669
  GetPageRequestSchema,