@crowi/api-contract 2.0.0-alpha.12 → 2.0.0-alpha.14

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
@@ -105,8 +105,12 @@ var ERROR_CODES = [
105
105
  "INVALID_CREDENTIALS",
106
106
  "REFRESH_TOKEN_REQUIRED",
107
107
  "REGISTRATION_CLOSED",
108
+ // --- federated sign-in (RFC-0014) ---
109
+ "FEDERATED_HANDOFF_INVALID",
110
+ "FEDERATED_HANDOFF_CONSUMED",
108
111
  // --- admin subsystems ---
109
112
  "ENCRYPTION_NOT_CONFIGURED",
113
+ "MAIL_FROM_NOT_CONFIGURED",
110
114
  "MAIL_TEST_FAILED",
111
115
  "PLUGIN_NOT_FOUND",
112
116
  "PLUGIN_CONFIG_VALIDATION_FAILED"
@@ -387,10 +391,16 @@ var SendTestMailResponseSchema = z5.object({
387
391
  to: z5.string()
388
392
  });
389
393
  var SendTestMailErrorSchema = z5.object({
390
- error: z5.object({
391
- code: z5.literal("MAIL_TEST_FAILED"),
392
- message: z5.string()
393
- })
394
+ error: z5.discriminatedUnion("code", [
395
+ z5.object({
396
+ code: z5.literal("MAIL_FROM_NOT_CONFIGURED"),
397
+ message: z5.literal("The mail sender address is not configured.")
398
+ }),
399
+ z5.object({
400
+ code: z5.literal("MAIL_TEST_FAILED"),
401
+ message: z5.enum(["Failed to send the test email. Check the active mail sender configuration.", "No email address on the calling user"])
402
+ })
403
+ ])
394
404
  });
395
405
  var MailSettingsValidationErrorSchema = z5.object({
396
406
  bodyResult: z5.object({
@@ -503,7 +513,7 @@ var sendTestMailRoute = createRoute3({
503
513
  content: { "application/json": { schema: AdminRequiredErrorSchema } }
504
514
  },
505
515
  502: {
506
- description: "Test mail dispatch failed (SMTP error)",
516
+ description: "Test mail dispatch failed (mail dispatch failure \u2014 e.g. sender/transport error, or the mail sender address is not configured)",
507
517
  content: { "application/json": { schema: SendTestMailErrorSchema } }
508
518
  }
509
519
  }
@@ -653,13 +663,16 @@ var PluginReadinessFieldSchema = z6.object({
653
663
  name: z6.string(),
654
664
  configured: z6.literal(false)
655
665
  });
656
- var PluginReadinessIssueSchema = z6.object({
657
- name: z6.string(),
658
- adminPlacement: PluginAdminPlacementSchema,
666
+ var ConfigReadinessIssueSchema = z6.object({
667
+ /** Stable id — `plugin:<name>` or a core declaration id (e.g. `core:mail`). */
668
+ id: z6.string(),
669
+ source: z6.enum(["plugin", "core"]),
670
+ label: z6.string(),
671
+ href: z6.string(),
659
672
  fields: z6.array(PluginReadinessFieldSchema)
660
673
  });
661
- var PluginReadinessResponseSchema = z6.object({
662
- issues: z6.array(PluginReadinessIssueSchema)
674
+ var ConfigReadinessResponseSchema = z6.object({
675
+ issues: z6.array(ConfigReadinessIssueSchema)
663
676
  });
664
677
 
665
678
  // src/contracts/admin/plugins.ts
@@ -797,11 +810,11 @@ var getPluginReadinessRoute = createRoute4({
797
810
  path: "/admin/plugins/readiness",
798
811
  tags: ["admin.plugins"],
799
812
  security: [{ bearerAuth: [] }],
800
- summary: "List active plugins missing required readiness config fields",
813
+ summary: "List active plugins and core config missing required readiness fields",
801
814
  responses: {
802
815
  200: {
803
- description: "Readiness issues for active plugins (empty when everything is configured)",
804
- content: { "application/json": { schema: PluginReadinessResponseSchema } }
816
+ description: "Readiness issues for active plugins and core config (empty when everything is configured)",
817
+ content: { "application/json": { schema: ConfigReadinessResponseSchema } }
805
818
  },
806
819
  401: {
807
820
  description: "Authentication required",
@@ -1801,6 +1814,17 @@ var UPLOAD_ALLOWED_MIME = [
1801
1814
  // Unknown / unset — see the note above.
1802
1815
  "application/octet-stream"
1803
1816
  ];
1817
+ var UploadPolicyResponseSchema = z17.object({
1818
+ allowedMimeTypes: z17.array(z17.string()),
1819
+ extensionHints: z17.record(z17.string(), z17.string()),
1820
+ maxBytes: z17.object({
1821
+ attachment: z17.number()
1822
+ }),
1823
+ profilePicture: z17.object({
1824
+ allowedMimeTypes: z17.array(z17.string()),
1825
+ maxBytes: z17.number()
1826
+ })
1827
+ });
1804
1828
 
1805
1829
  // src/contracts/attachment.ts
1806
1830
  var PageIdPathParamsSchema = z18.object({
@@ -1814,8 +1838,7 @@ var AddAttachmentBodySchema = z18.object({
1814
1838
  });
1815
1839
  var UploadAttachmentBodySchema = z18.object({
1816
1840
  file: z18.any().openapi({ type: "string", format: "binary" }).optional(),
1817
- pageId: z18.string().optional(),
1818
- intent: z18.string().optional().openapi({ enum: ["paste", "dnd"] })
1841
+ pageId: z18.string().optional()
1819
1842
  });
1820
1843
  var listAttachmentsRoute = createRoute10({
1821
1844
  method: "get",
@@ -1985,7 +2008,7 @@ var uploadAttachmentRoute = createRoute10({
1985
2008
  content: { "application/json": { schema: UploadAttachmentErrorSchema } }
1986
2009
  },
1987
2010
  413: {
1988
- description: "Body exceeds the per-intent size cap",
2011
+ description: "Body exceeds the unified upload size cap",
1989
2012
  content: { "application/json": { schema: UploadAttachmentErrorSchema } }
1990
2013
  },
1991
2014
  415: {
@@ -2038,6 +2061,23 @@ var removeAttachmentRoute = createRoute10({
2038
2061
  }
2039
2062
  }
2040
2063
  });
2064
+ var getUploadPolicyRoute = createRoute10({
2065
+ method: "get",
2066
+ path: "/attachments/upload-policy",
2067
+ tags: ["attachment"],
2068
+ security: [{ bearerAuth: [] }],
2069
+ summary: "Get the server upload policy (allowed MIME types, extension hints, size limits)",
2070
+ responses: {
2071
+ 200: {
2072
+ description: "Current upload policy, derived from server-side constants (never a value maintained separately)",
2073
+ content: { "application/json": { schema: UploadPolicyResponseSchema } }
2074
+ },
2075
+ 401: {
2076
+ description: "Authentication required",
2077
+ content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
2078
+ }
2079
+ }
2080
+ });
2041
2081
  var attachmentRoutes = {
2042
2082
  // `/pages/{pageId}/attachments/usage` MUST register before
2043
2083
  // `/pages/{pageId}/attachments` so the literal `/usage` suffix wins;
@@ -2049,7 +2089,8 @@ var attachmentRoutes = {
2049
2089
  addAttachmentRoute,
2050
2090
  uploadAttachmentRoute,
2051
2091
  getAttachmentMetaRoute,
2052
- removeAttachmentRoute
2092
+ removeAttachmentRoute,
2093
+ getUploadPolicyRoute
2053
2094
  };
2054
2095
 
2055
2096
  // src/contracts/autocomplete.ts
@@ -2401,6 +2442,17 @@ var crowiOpaqueFields = z22.object({
2401
2442
  /** Best-effort diagnostics only — never a rendering hint. Truncated to 64 chars before assignment. */
2402
2443
  originalType: z22.string().max(64).optional()
2403
2444
  });
2445
+ var FRONTMATTER_MAX_ENTRIES = 50;
2446
+ var FRONTMATTER_MAX_KEY_CHARS = 100;
2447
+ var FRONTMATTER_MAX_VALUE_CHARS = 300;
2448
+ var FRONTMATTER_MAX_RAW_BYTES = 8 * 1024;
2449
+ var CrowiFrontmatterEntrySchema = z22.object({
2450
+ key: z22.string().max(FRONTMATTER_MAX_KEY_CHARS),
2451
+ value: z22.string().max(FRONTMATTER_MAX_VALUE_CHARS)
2452
+ });
2453
+ var crowiFrontmatterFields = z22.object({
2454
+ entries: z22.array(CrowiFrontmatterEntrySchema).max(FRONTMATTER_MAX_ENTRIES)
2455
+ });
2404
2456
  var RENDERED_AST_NODE_DEFS = {
2405
2457
  root: { placement: "flow", childModel: "flow", fields: noFields },
2406
2458
  paragraph: { placement: "flow", childModel: "phrasing", fields: noFields },
@@ -2429,10 +2481,12 @@ var RENDERED_AST_NODE_DEFS = {
2429
2481
  footnoteReference: { placement: "phrasing", childModel: "none", fields: footnoteReferenceFields },
2430
2482
  linkReference: { placement: "phrasing", childModel: "phrasing", fields: linkReferenceFields },
2431
2483
  imageReference: { placement: "phrasing", childModel: "none", fields: imageReferenceFields },
2432
- // Crowi-owned types. `crowiFigure` is the only one that also appears
2433
- // in stored ASTs; the other three only exist as projection outputs
2434
- // (or as defensively-validated plugin-injected nodes).
2484
+ // Crowi-owned types. `crowiFigure` / `crowiFrontmatter` are the only
2485
+ // ones that also appear in stored ASTs directly (a core transform
2486
+ // writes them at save time); the other three only exist as projection
2487
+ // outputs (or as defensively-validated plugin-injected nodes).
2435
2488
  crowiFigure: { placement: "flow", childModel: "phrasing", fields: noFields },
2489
+ crowiFrontmatter: { placement: "flow", childModel: "none", fields: crowiFrontmatterFields },
2436
2490
  crowiDiagram: { placement: "flow", childModel: "none", fields: CrowiDiagramSidecarSchema },
2437
2491
  crowiLinkCard: { placement: "flow", childModel: "none", fields: CrowiLinkCardSidecarSchema },
2438
2492
  crowiPlaceholder: { placement: "both", childModel: "none", fields: CrowiPlaceholderSidecarSchema },
@@ -2468,6 +2522,7 @@ var RenderedAstNodeSchema = z22.lazy(
2468
2522
  LinkReferenceNodeSchema,
2469
2523
  ImageReferenceNodeSchema,
2470
2524
  CrowiFigureNodeSchema,
2525
+ CrowiFrontmatterNodeSchema,
2471
2526
  CrowiDiagramNodeSchema,
2472
2527
  CrowiLinkCardNodeSchema,
2473
2528
  CrowiPlaceholderNodeSchema,
@@ -2516,6 +2571,7 @@ var CrowiFigureNodeSchema = z22.object({
2516
2571
  data: HastHintDataSchema.extend({ hName: z22.literal("figure"), hProperties: HPropertiesSchema }),
2517
2572
  children: childrenSchema
2518
2573
  });
2574
+ var CrowiFrontmatterNodeSchema = crowiFrontmatterFields.extend({ type: z22.literal("crowiFrontmatter"), data: dataSchema });
2519
2575
  var CrowiDiagramNodeSchema = CrowiDiagramSidecarSchema.extend({ type: z22.literal("crowiDiagram"), data: dataSchema });
2520
2576
  var CrowiLinkCardNodeSchema = CrowiLinkCardSidecarSchema.extend({ type: z22.literal("crowiLinkCard"), data: dataSchema });
2521
2577
  var CrowiPlaceholderNodeSchema = CrowiPlaceholderSidecarSchema.extend({ type: z22.literal("crowiPlaceholder"), data: dataSchema });
@@ -3518,6 +3574,19 @@ var UserProfileResponseSchema = z31.object({
3518
3574
  introduction: z31.string().optional(),
3519
3575
  hasPassword: z31.boolean(),
3520
3576
  createdAt: z31.string(),
3577
+ /**
3578
+ * True when the account has at least one linked federated identity
3579
+ * (`UserIdentity` row). The email address on a federated account is
3580
+ * fixed to the value the identity provider verified — `PUT /me`
3581
+ * refuses a change and returns `EMAIL_LOCKED_BY_FEDERATED_IDENTITY`
3582
+ * when this is true and a different email is submitted. The web uses
3583
+ * this to disable the email field and point to the Security tab.
3584
+ *
3585
+ * Always reflects the account's current state — on `GET /me` and on
3586
+ * every 200 from `PUT /me`, including a `PUT` that changed only name /
3587
+ * lang.
3588
+ */
3589
+ federated: z31.boolean(),
3521
3590
  /**
3522
3591
  * True when the profile update requested a new email that is awaiting
3523
3592
  * confirmation: the stored `email` is unchanged and a confirmation
@@ -5887,23 +5956,404 @@ var tokenAuthRoutes = {
5887
5956
  tokenMeRoute
5888
5957
  };
5889
5958
 
5959
+ // src/contracts/federated-auth.ts
5960
+ import { createRoute as createRoute29, z as z53 } from "@hono/zod-openapi";
5961
+
5962
+ // src/schemas/federated-auth.ts
5963
+ import { z as z52 } from "@hono/zod-openapi";
5964
+ var FederatedProviderSchema = z52.object({
5965
+ name: z52.string(),
5966
+ buttonLabel: z52.string(),
5967
+ iconUrl: z52.string().optional()
5968
+ });
5969
+ var ProviderListResponseSchema = z52.object({
5970
+ providers: z52.array(FederatedProviderSchema)
5971
+ });
5972
+ var SenderPublicJwkSchema = z52.object({
5973
+ kty: z52.literal("EC"),
5974
+ crv: z52.literal("P-256"),
5975
+ x: z52.string(),
5976
+ y: z52.string()
5977
+ });
5978
+ var SenderProofSchema = z52.object({
5979
+ publicJwk: SenderPublicJwkSchema,
5980
+ /** base64url ES256 signature over the canonical handoff message. */
5981
+ signature: z52.string()
5982
+ });
5983
+ var FederatedHandoffRequestSchema = z52.object({
5984
+ code: z52.string(),
5985
+ proof: SenderProofSchema
5986
+ });
5987
+ var FederatedHandoffResponseSchema = TokenAuthResponseSchema;
5988
+ var LinkedAuthProviderListResponseSchema = z52.object({
5989
+ identities: z52.array(z52.object({ provider: z52.string() }))
5990
+ });
5991
+ var CreateLinkGrantRequestSchema = z52.object({
5992
+ /** RFC 7638 thumbprint of the P-256 public key this browser will use at `/start` — binds the grant to this browser (AC-2). */
5993
+ handoffChallenge: z52.string().min(1)
5994
+ });
5995
+ var CreateLinkGrantResponseSchema = z52.object({
5996
+ linkGrant: z52.string()
5997
+ });
5998
+ var UnlinkAuthProviderErrorSchema = z52.object({
5999
+ error: z52.object({
6000
+ code: z52.enum(["FEDERATED_UNLINK_DISABLED", "PASSWORD_REQUIRED"]),
6001
+ message: z52.string()
6002
+ })
6003
+ });
6004
+
6005
+ // src/contracts/federated-auth.ts
6006
+ var ContinuePathSchema = z53.string().regex(/^\/(?!\/)[^\\\x00-\x1F\x7F]*$/, 'continue must be a local path starting with a single "/" and contain no backslash or control characters').max(2e3, "continue must be at most 2000 characters");
6007
+ var listFederatedProvidersRoute = createRoute29({
6008
+ method: "get",
6009
+ path: "/auth/providers",
6010
+ tags: ["federatedAuth"],
6011
+ summary: "List enabled OAuth2/OIDC federated sign-in providers",
6012
+ responses: {
6013
+ 200: {
6014
+ description: "Enabled providers, in name order",
6015
+ content: { "application/json": { schema: ProviderListResponseSchema } }
6016
+ },
6017
+ 500: {
6018
+ description: "Internal server error",
6019
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6020
+ }
6021
+ }
6022
+ });
6023
+ var startFederatedProviderRoute = createRoute29({
6024
+ method: "get",
6025
+ path: "/auth/providers/{name}/start",
6026
+ tags: ["federatedAuth"],
6027
+ summary: "Top-level navigation that redirects the browser to the named provider",
6028
+ request: {
6029
+ params: z53.object({ name: z53.string() }),
6030
+ query: z53.object({
6031
+ continue: ContinuePathSchema,
6032
+ /** base64url(JSON) of the sender's P-256 public JWK. */
6033
+ handoff_jwk: z53.string().min(1),
6034
+ /** base64url ES256 signature over the start canonical message. */
6035
+ handoff_proof: z53.string().min(1),
6036
+ /**
6037
+ * RFC-0014 phase 3 — `'1'` switches this start into LINK mode: the
6038
+ * request must carry a web-session JWT, and the flow attaches the
6039
+ * resulting identity to that session's user instead of signing
6040
+ * anyone in. Absent (the ordinary sign-in start) the route stays
6041
+ * fully public.
6042
+ */
6043
+ link: z53.literal("1").optional(),
6044
+ /** The opaque id from `POST /auth/providers/{name}/link-grants`. Required when `link=1`, ignored otherwise. */
6045
+ link_grant: z53.string().min(1).optional()
6046
+ })
6047
+ },
6048
+ responses: {
6049
+ 302: { description: "Redirect to the provider authorization endpoint" },
6050
+ 400: {
6051
+ description: "Malformed continue / sender proof, or an invalid/expired/mismatched link grant",
6052
+ content: { "application/json": { schema: ApiErrorSchema } }
6053
+ },
6054
+ 401: {
6055
+ description: "link=1 without a web-session JWT \u2014 never downgraded to the public sign-in start",
6056
+ content: { "application/json": { schema: ApiErrorSchema } }
6057
+ },
6058
+ 403: {
6059
+ description: "link=1 with a non-web credential (PAT / OAuth access token)",
6060
+ content: { "application/json": { schema: ApiErrorSchema } }
6061
+ },
6062
+ 404: {
6063
+ description: "Unknown, unconfigured, or credential-kind provider",
6064
+ content: { "application/json": { schema: ApiErrorSchema } }
6065
+ },
6066
+ 500: {
6067
+ description: "Internal server error",
6068
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6069
+ }
6070
+ }
6071
+ });
6072
+ var listLinkedAuthProvidersRoute = createRoute29({
6073
+ method: "get",
6074
+ path: "/auth/providers/identities",
6075
+ tags: ["federatedAuth"],
6076
+ summary: "List the provider slugs the current user has linked",
6077
+ responses: {
6078
+ 200: {
6079
+ description: "Linked provider slugs, in name order",
6080
+ content: { "application/json": { schema: LinkedAuthProviderListResponseSchema } }
6081
+ },
6082
+ 401: {
6083
+ description: "Authentication required",
6084
+ content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
6085
+ },
6086
+ 500: {
6087
+ description: "Internal server error",
6088
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6089
+ }
6090
+ }
6091
+ });
6092
+ var createAuthProviderLinkGrantRoute = createRoute29({
6093
+ method: "post",
6094
+ path: "/auth/providers/{name}/link-grants",
6095
+ tags: ["federatedAuth"],
6096
+ summary: "Mint a short-lived, opaque grant that authorizes ONE link start for the current web session",
6097
+ request: {
6098
+ params: z53.object({ name: z53.string() }),
6099
+ body: { content: { "application/json": { schema: CreateLinkGrantRequestSchema } } }
6100
+ },
6101
+ responses: {
6102
+ 200: {
6103
+ description: "Opaque single-use grant id",
6104
+ content: { "application/json": { schema: CreateLinkGrantResponseSchema } }
6105
+ },
6106
+ 401: {
6107
+ description: "Authentication required",
6108
+ content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
6109
+ },
6110
+ 403: {
6111
+ description: "Non-web credential (PAT / OAuth access token)",
6112
+ content: { "application/json": { schema: ApiErrorSchema } }
6113
+ },
6114
+ 404: {
6115
+ description: "Unknown, unconfigured, or credential-kind provider",
6116
+ content: { "application/json": { schema: ApiErrorSchema } }
6117
+ },
6118
+ 500: {
6119
+ description: "Internal server error",
6120
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6121
+ }
6122
+ }
6123
+ });
6124
+ var unlinkAuthProviderRoute = createRoute29({
6125
+ method: "delete",
6126
+ path: "/auth/providers/{name}/identity",
6127
+ tags: ["federatedAuth"],
6128
+ summary: "Disconnect the current user's identity for this provider",
6129
+ request: {
6130
+ params: z53.object({ name: z53.string() })
6131
+ },
6132
+ responses: {
6133
+ 204: { description: "Identity removed" },
6134
+ 401: {
6135
+ description: "Authentication required",
6136
+ content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
6137
+ },
6138
+ 403: {
6139
+ description: "Non-web credential (PAT / OAuth access token)",
6140
+ content: { "application/json": { schema: ApiErrorSchema } }
6141
+ },
6142
+ 404: {
6143
+ description: "No identity linked for this provider",
6144
+ content: { "application/json": { schema: ApiErrorSchema } }
6145
+ },
6146
+ 409: {
6147
+ description: "Refused: password auth is disabled instance-wide, or this user has no password set",
6148
+ content: { "application/json": { schema: UnlinkAuthProviderErrorSchema } }
6149
+ },
6150
+ 500: {
6151
+ description: "Internal server error",
6152
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6153
+ }
6154
+ }
6155
+ });
6156
+ var callbackFederatedProviderRoute = createRoute29({
6157
+ method: "get",
6158
+ path: "/auth/providers/{name}/callback",
6159
+ tags: ["federatedAuth"],
6160
+ summary: "Provider redirect target; completes the OAuth2/OIDC exchange",
6161
+ request: {
6162
+ params: z53.object({ name: z53.string() }),
6163
+ query: z53.object({
6164
+ code: z53.string().optional(),
6165
+ state: z53.string().optional(),
6166
+ error: z53.string().optional()
6167
+ })
6168
+ },
6169
+ responses: {
6170
+ 302: {
6171
+ description: "Redirect to the trusted web login/complete page on success, or back to the trusted web /login on failure"
6172
+ },
6173
+ 404: {
6174
+ description: "Unknown or unconfigured provider (also used when trusted origins cannot be resolved)",
6175
+ content: { "application/json": { schema: ApiErrorSchema } }
6176
+ },
6177
+ 500: {
6178
+ description: "Internal server error",
6179
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6180
+ }
6181
+ }
6182
+ });
6183
+ var federatedHandoffRoute = createRoute29({
6184
+ method: "post",
6185
+ path: "/auth/handoff",
6186
+ tags: ["federatedAuth"],
6187
+ summary: "Exchange a sender-constrained federated handoff code for session tokens",
6188
+ request: {
6189
+ body: { content: { "application/json": { schema: FederatedHandoffRequestSchema } } }
6190
+ },
6191
+ responses: {
6192
+ 200: {
6193
+ description: "Session tokens \u2014 same shape as POST /auth/login",
6194
+ content: { "application/json": { schema: FederatedHandoffResponseSchema } }
6195
+ },
6196
+ 401: {
6197
+ description: "Invalid / expired handoff code, or sender proof did not verify",
6198
+ content: { "application/json": { schema: ApiErrorSchema } }
6199
+ },
6200
+ 409: {
6201
+ description: "Handoff code already consumed",
6202
+ content: { "application/json": { schema: ApiErrorSchema } }
6203
+ },
6204
+ 500: {
6205
+ description: "Internal server error",
6206
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6207
+ }
6208
+ }
6209
+ });
6210
+ var federatedAuthRoutes = {
6211
+ listFederatedProvidersRoute,
6212
+ startFederatedProviderRoute,
6213
+ callbackFederatedProviderRoute,
6214
+ federatedHandoffRoute,
6215
+ listLinkedAuthProvidersRoute,
6216
+ createAuthProviderLinkGrantRoute,
6217
+ unlinkAuthProviderRoute
6218
+ };
6219
+
6220
+ // src/contracts/federated-registration.ts
6221
+ import { createRoute as createRoute30, z as z55 } from "@hono/zod-openapi";
6222
+
6223
+ // src/schemas/federated-registration.ts
6224
+ import { z as z54 } from "@hono/zod-openapi";
6225
+ var FederatedRegistrationSnapshotSchema = z54.object({
6226
+ /** IdP-verified email, prefilled read-only on the registration screen. */
6227
+ email: z54.string().email(),
6228
+ /** Driver slug, e.g. `'google'`. */
6229
+ provider: z54.string(),
6230
+ /** Human-friendly provider name (the driver's `buttonLabel`), e.g. `'Google'`. */
6231
+ providerLabel: z54.string(),
6232
+ /**
6233
+ * This grant's registration has already been submitted and is waiting
6234
+ * for an administrator (Restricted mode). The screen must show that
6235
+ * state instead of the username form.
6236
+ *
6237
+ * Deliberately narrow: it is not a general status field, and it never
6238
+ * distinguishes unknown / expired / cancelled / completed grants (those
6239
+ * are all the same 404 — AC-2). It exists because a submitted
6240
+ * registration is still readable by its own grant, and re-offering an
6241
+ * editable username there invites a change that cannot be applied — the
6242
+ * second submit is refused and the typed value silently discarded.
6243
+ */
6244
+ approvalPending: z54.boolean()
6245
+ });
6246
+ var FederatedRegistrationSubmitRequestSchema = z54.object({
6247
+ username: UsernameSchema
6248
+ });
6249
+ var FederatedRegistrationActiveResultSchema = z54.object({
6250
+ status: z54.literal("active"),
6251
+ code: z54.string()
6252
+ });
6253
+ var FederatedRegistrationApprovalResultSchema = z54.object({
6254
+ status: z54.literal("approval_required")
6255
+ });
6256
+ var FederatedRegistrationResultSchema = z54.discriminatedUnion("status", [
6257
+ FederatedRegistrationActiveResultSchema,
6258
+ FederatedRegistrationApprovalResultSchema
6259
+ ]);
6260
+
6261
+ // src/contracts/federated-registration.ts
6262
+ var TokenParamSchema = z55.object({ token: z55.string().min(1) });
6263
+ var getFederatedRegistrationRoute = createRoute30({
6264
+ method: "get",
6265
+ path: "/auth/federated-registration/{token}",
6266
+ tags: ["federatedRegistration"],
6267
+ summary: "Read-only snapshot (email/provider/providerLabel) for a pending federated registration",
6268
+ request: {
6269
+ params: TokenParamSchema
6270
+ },
6271
+ responses: {
6272
+ 200: {
6273
+ description: "Pending registration snapshot",
6274
+ content: { "application/json": { schema: FederatedRegistrationSnapshotSchema } }
6275
+ },
6276
+ 404: {
6277
+ description: "Grant is unknown, expired, or cancelled",
6278
+ content: { "application/json": { schema: ApiErrorSchema } }
6279
+ },
6280
+ 500: {
6281
+ description: "Internal server error",
6282
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6283
+ }
6284
+ }
6285
+ });
6286
+ var submitFederatedRegistrationRoute = createRoute30({
6287
+ method: "post",
6288
+ path: "/auth/federated-registration/{token}",
6289
+ tags: ["federatedRegistration"],
6290
+ summary: "Submit the chosen username; provisions the User (JIT) and activates or queues approval",
6291
+ request: {
6292
+ params: TokenParamSchema,
6293
+ body: { content: { "application/json": { schema: FederatedRegistrationSubmitRequestSchema } } }
6294
+ },
6295
+ responses: {
6296
+ 200: {
6297
+ description: "Open: account is active \u2014 a Phase 1 handoff code, redeemed via POST /auth/handoff. Restricted: awaiting admin approval.",
6298
+ content: { "application/json": { schema: FederatedRegistrationResultSchema } }
6299
+ },
6300
+ 400: {
6301
+ description: "Username fails the shared username contract",
6302
+ content: { "application/json": { schema: ApiErrorSchema } }
6303
+ },
6304
+ 404: {
6305
+ description: "Grant is unknown, expired, or cancelled",
6306
+ content: { "application/json": { schema: ApiErrorSchema } }
6307
+ },
6308
+ 409: {
6309
+ description: "Username/email already taken, or the identity is already linked to a different user",
6310
+ content: { "application/json": { schema: ApiErrorSchema } }
6311
+ },
6312
+ 500: {
6313
+ description: "Internal server error",
6314
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6315
+ }
6316
+ }
6317
+ });
6318
+ var logoutFederatedRegistrationRoute = createRoute30({
6319
+ method: "post",
6320
+ path: "/auth/federated-registration/{token}/logout",
6321
+ tags: ["federatedRegistration"],
6322
+ summary: "Cancel a pending federated registration and invalidate the grant",
6323
+ request: {
6324
+ params: TokenParamSchema
6325
+ },
6326
+ responses: {
6327
+ 204: { description: "Grant cancelled (or was already inactive) \u2014 idempotent" },
6328
+ 500: {
6329
+ description: "Internal server error",
6330
+ content: { "application/json": { schema: InternalServerErrorSchema } }
6331
+ }
6332
+ }
6333
+ });
6334
+ var federatedRegistrationRoutes = {
6335
+ getFederatedRegistrationRoute,
6336
+ submitFederatedRegistrationRoute,
6337
+ logoutFederatedRegistrationRoute
6338
+ };
6339
+
5890
6340
  // src/contracts/invite-accept.ts
5891
- import { createRoute as createRoute29 } from "@hono/zod-openapi";
6341
+ import { createRoute as createRoute31 } from "@hono/zod-openapi";
5892
6342
 
5893
6343
  // src/schemas/invite-accept.ts
5894
- import { z as z52 } from "@hono/zod-openapi";
5895
- var InviteAcceptRequestSchema = z52.object({
5896
- token: z52.string(),
6344
+ import { z as z56 } from "@hono/zod-openapi";
6345
+ var InviteAcceptRequestSchema = z56.object({
6346
+ token: z56.string(),
5897
6347
  username: UsernameSchema,
5898
- name: z52.string().min(1),
5899
- password: z52.string().min(6)
6348
+ name: z56.string().min(1),
6349
+ password: z56.string().min(6)
5900
6350
  });
5901
- var InvitePreviewResponseSchema = z52.object({
5902
- email: z52.string().email()
6351
+ var InvitePreviewResponseSchema = z56.object({
6352
+ email: z56.string().email()
5903
6353
  });
5904
6354
 
5905
6355
  // src/contracts/invite-accept.ts
5906
- var invitePreviewRoute = createRoute29({
6356
+ var invitePreviewRoute = createRoute31({
5907
6357
  method: "get",
5908
6358
  path: "/invite/accept",
5909
6359
  tags: ["inviteAccept"],
@@ -5930,7 +6380,7 @@ var invitePreviewRoute = createRoute29({
5930
6380
  }
5931
6381
  }
5932
6382
  });
5933
- var acceptInviteRoute = createRoute29({
6383
+ var acceptInviteRoute = createRoute31({
5934
6384
  method: "post",
5935
6385
  path: "/invite/accept",
5936
6386
  tags: ["inviteAccept"],
@@ -5973,23 +6423,23 @@ var inviteAcceptRoutes = {
5973
6423
  };
5974
6424
 
5975
6425
  // src/contracts/password-reset.ts
5976
- import { createRoute as createRoute30 } from "@hono/zod-openapi";
6426
+ import { createRoute as createRoute32 } from "@hono/zod-openapi";
5977
6427
 
5978
6428
  // src/schemas/password-reset.ts
5979
- import { z as z53 } from "@hono/zod-openapi";
5980
- var ForgotPasswordRequestSchema = z53.object({
5981
- email: z53.string().email()
6429
+ import { z as z57 } from "@hono/zod-openapi";
6430
+ var ForgotPasswordRequestSchema = z57.object({
6431
+ email: z57.string().email()
5982
6432
  });
5983
- var ForgotPasswordResponseSchema = z53.object({
5984
- ok: z53.literal(true)
6433
+ var ForgotPasswordResponseSchema = z57.object({
6434
+ ok: z57.literal(true)
5985
6435
  });
5986
- var ResetPasswordRequestSchema = z53.object({
5987
- token: z53.string(),
5988
- password: z53.string().min(6)
6436
+ var ResetPasswordRequestSchema = z57.object({
6437
+ token: z57.string(),
6438
+ password: z57.string().min(6)
5989
6439
  });
5990
6440
 
5991
6441
  // src/contracts/password-reset.ts
5992
- var forgotPasswordRoute = createRoute30({
6442
+ var forgotPasswordRoute = createRoute32({
5993
6443
  method: "post",
5994
6444
  path: "/auth/forgot-password",
5995
6445
  tags: ["passwordReset"],
@@ -6014,7 +6464,7 @@ var forgotPasswordRoute = createRoute30({
6014
6464
  }
6015
6465
  }
6016
6466
  });
6017
- var validateResetTokenRoute = createRoute30({
6467
+ var validateResetTokenRoute = createRoute32({
6018
6468
  method: "get",
6019
6469
  path: "/auth/reset-password",
6020
6470
  tags: ["passwordReset"],
@@ -6037,7 +6487,7 @@ var validateResetTokenRoute = createRoute30({
6037
6487
  }
6038
6488
  }
6039
6489
  });
6040
- var selfResetPasswordRoute = createRoute30({
6490
+ var selfResetPasswordRoute = createRoute32({
6041
6491
  method: "post",
6042
6492
  path: "/auth/reset-password",
6043
6493
  tags: ["passwordReset"],
@@ -6077,19 +6527,19 @@ var passwordResetRoutes = {
6077
6527
  };
6078
6528
 
6079
6529
  // src/contracts/activation.ts
6080
- import { createRoute as createRoute31 } from "@hono/zod-openapi";
6530
+ import { createRoute as createRoute33 } from "@hono/zod-openapi";
6081
6531
 
6082
6532
  // src/schemas/activation.ts
6083
- import { z as z54 } from "@hono/zod-openapi";
6084
- var ActivateRequestSchema = z54.object({
6085
- token: z54.string()
6533
+ import { z as z58 } from "@hono/zod-openapi";
6534
+ var ActivateRequestSchema = z58.object({
6535
+ token: z58.string()
6086
6536
  });
6087
- var ActivateValidationResponseSchema = z54.object({
6088
- ok: z54.literal(true)
6537
+ var ActivateValidationResponseSchema = z58.object({
6538
+ ok: z58.literal(true)
6089
6539
  });
6090
6540
 
6091
6541
  // src/contracts/activation.ts
6092
- var validateActivationTokenRoute = createRoute31({
6542
+ var validateActivationTokenRoute = createRoute33({
6093
6543
  method: "get",
6094
6544
  path: "/auth/activate",
6095
6545
  tags: ["activation"],
@@ -6112,7 +6562,7 @@ var validateActivationTokenRoute = createRoute31({
6112
6562
  }
6113
6563
  }
6114
6564
  });
6115
- var activateAccountRoute = createRoute31({
6565
+ var activateAccountRoute = createRoute33({
6116
6566
  method: "post",
6117
6567
  path: "/auth/activate",
6118
6568
  tags: ["activation"],
@@ -6147,21 +6597,21 @@ var activationRoutes = {
6147
6597
  };
6148
6598
 
6149
6599
  // src/contracts/email-change.ts
6150
- import { createRoute as createRoute32 } from "@hono/zod-openapi";
6600
+ import { createRoute as createRoute34 } from "@hono/zod-openapi";
6151
6601
 
6152
6602
  // src/schemas/email-change.ts
6153
- import { z as z55 } from "@hono/zod-openapi";
6154
- var ConfirmEmailChangeRequestSchema = z55.object({
6155
- token: z55.string()
6603
+ import { z as z59 } from "@hono/zod-openapi";
6604
+ var ConfirmEmailChangeRequestSchema = z59.object({
6605
+ token: z59.string()
6156
6606
  });
6157
- var ConfirmEmailChangeResponseSchema = z55.object({
6158
- ok: z55.literal(true),
6607
+ var ConfirmEmailChangeResponseSchema = z59.object({
6608
+ ok: z59.literal(true),
6159
6609
  /** The newly-confirmed email address. */
6160
- email: z55.string().email()
6610
+ email: z59.string().email()
6161
6611
  });
6162
6612
 
6163
6613
  // src/contracts/email-change.ts
6164
- var validateEmailChangeTokenRoute = createRoute32({
6614
+ var validateEmailChangeTokenRoute = createRoute34({
6165
6615
  method: "get",
6166
6616
  path: "/auth/confirm-email-change",
6167
6617
  tags: ["emailChange"],
@@ -6184,7 +6634,7 @@ var validateEmailChangeTokenRoute = createRoute32({
6184
6634
  }
6185
6635
  }
6186
6636
  });
6187
- var confirmEmailChangeRoute = createRoute32({
6637
+ var confirmEmailChangeRoute = createRoute34({
6188
6638
  method: "post",
6189
6639
  path: "/auth/confirm-email-change",
6190
6640
  tags: ["emailChange"],
@@ -6223,9 +6673,9 @@ var emailChangeRoutes = {
6223
6673
  };
6224
6674
 
6225
6675
  // src/contracts/user.ts
6226
- import { createRoute as createRoute33, z as z56 } from "@hono/zod-openapi";
6227
- var UsernameParamSchema = z56.object({ username: z56.string() });
6228
- var getUserPageRoute = createRoute33({
6676
+ import { createRoute as createRoute35, z as z60 } from "@hono/zod-openapi";
6677
+ var UsernameParamSchema = z60.object({ username: z60.string() });
6678
+ var getUserPageRoute = createRoute35({
6229
6679
  method: "get",
6230
6680
  path: "/user/{username}",
6231
6681
  tags: ["user"],
@@ -6253,7 +6703,7 @@ var getUserPageRoute = createRoute33({
6253
6703
  }
6254
6704
  }
6255
6705
  });
6256
- var getUserBookmarksRoute = createRoute33({
6706
+ var getUserBookmarksRoute = createRoute35({
6257
6707
  method: "get",
6258
6708
  path: "/user/{username}/bookmarks",
6259
6709
  tags: ["user"],
@@ -6282,7 +6732,7 @@ var getUserBookmarksRoute = createRoute33({
6282
6732
  }
6283
6733
  }
6284
6734
  });
6285
- var getUserPagesRoute = createRoute33({
6735
+ var getUserPagesRoute = createRoute35({
6286
6736
  method: "get",
6287
6737
  path: "/user/{username}/pages",
6288
6738
  tags: ["user"],
@@ -6311,7 +6761,7 @@ var getUserPagesRoute = createRoute33({
6311
6761
  }
6312
6762
  }
6313
6763
  });
6314
- var getUserSubpagesRoute = createRoute33({
6764
+ var getUserSubpagesRoute = createRoute35({
6315
6765
  method: "get",
6316
6766
  path: "/user/{username}/subpages",
6317
6767
  tags: ["user"],
@@ -6348,7 +6798,7 @@ var getUserSubpagesRoute = createRoute33({
6348
6798
  }
6349
6799
  }
6350
6800
  });
6351
- var listMembersRoute = createRoute33({
6801
+ var listMembersRoute = createRoute35({
6352
6802
  method: "get",
6353
6803
  path: "/users",
6354
6804
  tags: ["user"],
@@ -6394,6 +6844,13 @@ var stubTokens = {
6394
6844
  expiresIn: 0,
6395
6845
  user: stubUser
6396
6846
  };
6847
+ var stubProviderList = { providers: [] };
6848
+ var stubFederatedRegistrationSnapshot = {
6849
+ email: "stub@example.com",
6850
+ provider: "",
6851
+ providerLabel: "",
6852
+ approvalPending: false
6853
+ };
6397
6854
  var stubProfile = {
6398
6855
  id: "",
6399
6856
  username: "",
@@ -6403,7 +6860,8 @@ var stubProfile = {
6403
6860
  theme: "system",
6404
6861
  image: null,
6405
6862
  hasPassword: false,
6406
- createdAt: ""
6863
+ createdAt: "",
6864
+ federated: false
6407
6865
  };
6408
6866
  var stubAccessToken = {
6409
6867
  id: "",
@@ -6592,6 +7050,12 @@ var stubAttachmentMeta = (() => {
6592
7050
  })();
6593
7051
  var stubUploadAttachment = { url: "", filename: "", mimeType: "", sizeBytes: 0 };
6594
7052
  var stubRemoveAttachment = { success: true };
7053
+ var stubUploadPolicy = {
7054
+ allowedMimeTypes: [],
7055
+ extensionHints: {},
7056
+ maxBytes: { attachment: 0 },
7057
+ profilePicture: { allowedMimeTypes: [], maxBytes: 0 }
7058
+ };
6595
7059
  var stubSearchPages = { meta: { total: 0, results: 0 }, data: [] };
6596
7060
  var stubCryptoStatus = {
6597
7061
  encryptionConfigured: false,
@@ -6680,29 +7144,31 @@ var appAuthMeUserChain = new OpenAPIHono().openapi(
6680
7144
  ).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));
6681
7145
  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));
6682
7146
  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));
6683
- 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));
7147
+ 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));
6684
7148
  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));
6685
7149
  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.getPluginReadinessRoute, (c) => c.json(stubPluginReadiness, 200)).openapi(adminPluginsRoutes.clearRenderCacheAllRoute, (c) => c.json(stubClearRenderCache, 200)).openapi(adminPluginsRoutes.clearRenderCachePluginRoute, (c) => c.json(stubClearRenderCache, 200));
6686
7150
  var oauthContractApp = new OpenAPIHono().openapi(oauthRoutes.authorizeRoute, (c) => c.json(stubAuthorize, 200)).openapi(oauthRoutes.tokenRoute, (c) => c.json(stubToken, 200)).openapi(oauthRoutes.revokeRoute, (c) => c.json(stubRevoke, 200)).openapi(oauthRoutes.discoveryRoute, (c) => c.json(stubDiscovery, 200)).openapi(oauthRoutes.deviceAuthorizeRoute, (c) => c.json(stubDeviceAuthorize, 200)).openapi(oauthRoutes.deviceInfoRoute, (c) => c.json(stubDeviceInfo, 200)).openapi(oauthRoutes.deviceVerifyRoute, (c) => c.json(stubDeviceVerify, 200)).openapi(oauthRoutes.clientInfoRoute, (c) => c.json(stubClientInfo, 200));
7151
+ var federatedAuthContractApp = new OpenAPIHono().openapi(federatedAuthRoutes.listFederatedProvidersRoute, (c) => c.json(stubProviderList, 200)).openapi(federatedAuthRoutes.startFederatedProviderRoute, (c) => c.redirect("", 302)).openapi(federatedAuthRoutes.callbackFederatedProviderRoute, (c) => c.redirect("", 302)).openapi(federatedAuthRoutes.federatedHandoffRoute, (c) => c.json(stubTokens, 200)).openapi(federatedAuthRoutes.listLinkedAuthProvidersRoute, (c) => c.json({ identities: [] }, 200)).openapi(federatedAuthRoutes.createAuthProviderLinkGrantRoute, (c) => c.json({ linkGrant: "" }, 200)).openapi(federatedAuthRoutes.unlinkAuthProviderRoute, (c) => c.body(null, 204));
7152
+ var federatedRegistrationContractApp = new OpenAPIHono().openapi(federatedRegistrationRoutes.getFederatedRegistrationRoute, (c) => c.json(stubFederatedRegistrationSnapshot, 200)).openapi(federatedRegistrationRoutes.submitFederatedRegistrationRoute, (c) => c.json({ status: "approval_required" }, 200)).openapi(federatedRegistrationRoutes.logoutFederatedRegistrationRoute, (c) => c.body(null, 204));
6687
7153
  var createClient = (baseUrl, options = {}) => hc(baseUrl, {
6688
7154
  headers: options.headers,
6689
7155
  fetch: options.fetch
6690
7156
  });
6691
7157
 
6692
7158
  // src/schemas/mail-token.ts
6693
- import { z as z57 } from "@hono/zod-openapi";
6694
- var MailTokenPurposeSchema = z57.enum(["invite", "activate", "reset", "email-change"]);
6695
- var MailTokenPayloadSchema = z57.object({
7159
+ import { z as z61 } from "@hono/zod-openapi";
7160
+ var MailTokenPurposeSchema = z61.enum(["invite", "activate", "reset", "email-change"]);
7161
+ var MailTokenPayloadSchema = z61.object({
6696
7162
  purpose: MailTokenPurposeSchema,
6697
- userId: z57.string(),
7163
+ userId: z61.string(),
6698
7164
  /** Target address. For `email-change` this is the NEW address. */
6699
- email: z57.string().email(),
7165
+ email: z61.string().email(),
6700
7166
  /**
6701
7167
  * For `email-change`: the account's email at issue time. The confirm
6702
7168
  * endpoint rejects the token unless it still matches, making the token
6703
7169
  * single-use (a stale token cannot revert a later change).
6704
7170
  */
6705
- fromEmail: z57.string().email().optional(),
7171
+ fromEmail: z61.string().email().optional(),
6706
7172
  /**
6707
7173
  * For `reset`: the account's `passwordResetGeneration` at issue time.
6708
7174
  * Consuming the link increments that counter, so the token only matches
@@ -6711,7 +7177,7 @@ var MailTokenPayloadSchema = z57.object({
6711
7177
  * schema because the other purposes don't carry it (and links minted
6712
7178
  * before the claim existed simply no longer match).
6713
7179
  */
6714
- resetGeneration: z57.number().int().nonnegative().optional(),
7180
+ resetGeneration: z61.number().int().nonnegative().optional(),
6715
7181
  /**
6716
7182
  * For `email-change`: the account's `authVersion` at issue time. The
6717
7183
  * confirm endpoint requires it to still match, so a pending address change
@@ -6723,7 +7189,7 @@ var MailTokenPayloadSchema = z57.object({
6723
7189
  * semantics wanted are exactly "the session that asked for this is gone",
6724
7190
  * and that is what every bump of it already means.
6725
7191
  */
6726
- authVersion: z57.number().int().nonnegative().optional(),
7192
+ authVersion: z61.number().int().nonnegative().optional(),
6727
7193
  /**
6728
7194
  * For `email-change`: the account's `emailChangeGeneration` at issue time.
6729
7195
  * Requesting a change increments it, so asking for a different address
@@ -6735,10 +7201,10 @@ var MailTokenPayloadSchema = z57.object({
6735
7201
  * Optional in the schema for the same reason as the others — links minted
6736
7202
  * before the claim existed simply no longer match.
6737
7203
  */
6738
- emailChangeGeneration: z57.number().int().nonnegative().optional(),
7204
+ emailChangeGeneration: z61.number().int().nonnegative().optional(),
6739
7205
  // iat / exp are injected and verified by the JWT layer.
6740
- iat: z57.number().optional(),
6741
- exp: z57.number().optional()
7206
+ iat: z61.number().optional(),
7207
+ exp: z61.number().optional()
6742
7208
  });
6743
7209
 
6744
7210
  // src/util/html-elements.ts
@@ -6953,6 +7419,8 @@ export {
6953
7419
  CommentInvalidRequestErrorSchema,
6954
7420
  CommentNotFoundErrorSchema,
6955
7421
  CommentSchema,
7422
+ ConfigReadinessIssueSchema,
7423
+ ConfigReadinessResponseSchema,
6956
7424
  ConfirmEmailChangeRequestSchema,
6957
7425
  ConfirmEmailChangeResponseSchema,
6958
7426
  ConflictErrorSchema,
@@ -6963,11 +7431,14 @@ export {
6963
7431
  CreateAdminResponseSchema,
6964
7432
  CreateDraftRequestSchema,
6965
7433
  CreateDraftResponseSchema,
7434
+ CreateLinkGrantRequestSchema,
7435
+ CreateLinkGrantResponseSchema,
6966
7436
  CreatePageRequestSchema,
6967
7437
  CrowiCodeSidecarSchema,
6968
7438
  CrowiDiagramNodeSchema,
6969
7439
  CrowiDiagramSidecarSchema,
6970
7440
  CrowiDimensionSchema,
7441
+ CrowiFrontmatterEntrySchema,
6971
7442
  CrowiImagePayloadSchema,
6972
7443
  CrowiLinkCardNodeSchema,
6973
7444
  CrowiLinkCardSidecarSchema,
@@ -6998,6 +7469,18 @@ export {
6998
7469
  EditAdminUserRequestSchema,
6999
7470
  EncryptionNotConfiguredErrorSchema,
7000
7471
  ErrorCodeSchema,
7472
+ FRONTMATTER_MAX_ENTRIES,
7473
+ FRONTMATTER_MAX_KEY_CHARS,
7474
+ FRONTMATTER_MAX_RAW_BYTES,
7475
+ FRONTMATTER_MAX_VALUE_CHARS,
7476
+ FederatedHandoffRequestSchema,
7477
+ FederatedHandoffResponseSchema,
7478
+ FederatedProviderSchema,
7479
+ FederatedRegistrationActiveResultSchema,
7480
+ FederatedRegistrationApprovalResultSchema,
7481
+ FederatedRegistrationResultSchema,
7482
+ FederatedRegistrationSnapshotSchema,
7483
+ FederatedRegistrationSubmitRequestSchema,
7001
7484
  ForbiddenErrorSchema,
7002
7485
  ForgotPasswordRequestSchema,
7003
7486
  ForgotPasswordResponseSchema,
@@ -7039,6 +7522,7 @@ export {
7039
7522
  LanguageSchema,
7040
7523
  LikerSchema,
7041
7524
  LikersResponseSchema,
7525
+ LinkedAuthProviderListResponseSchema,
7042
7526
  ListAccessTokensResponseSchema,
7043
7527
  ListAdminUsersRequestSchema,
7044
7528
  ListAdminUsersResponseSchema,
@@ -7111,8 +7595,6 @@ export {
7111
7595
  PluginInfoSchema,
7112
7596
  PluginNotFoundErrorSchema,
7113
7597
  PluginReadinessFieldSchema,
7114
- PluginReadinessIssueSchema,
7115
- PluginReadinessResponseSchema,
7116
7598
  PresenceClientMessageSchema,
7117
7599
  PresenceCommentChangedMessageSchema,
7118
7600
  PresenceHeartbeatMessageSchema,
@@ -7125,6 +7607,7 @@ export {
7125
7607
  PreviewPageRequestSchema,
7126
7608
  PreviewPageResponseSchema,
7127
7609
  ProfileErrorResponseSchema,
7610
+ ProviderListResponseSchema,
7128
7611
  RENDERED_AST_NODE_DEFS,
7129
7612
  RecentlyViewedPagesResponseSchema,
7130
7613
  ReencryptResponseSchema,
@@ -7173,6 +7656,8 @@ export {
7173
7656
  SendTestMailErrorSchema,
7174
7657
  SendTestMailRequestSchema,
7175
7658
  SendTestMailResponseSchema,
7659
+ SenderProofSchema,
7660
+ SenderPublicJwkSchema,
7176
7661
  SensitiveConfigEntrySchema,
7177
7662
  ServiceUnavailableErrorSchema,
7178
7663
  SetPageGrantRequestSchema,
@@ -7193,6 +7678,7 @@ export {
7193
7678
  TokenRequestSchema,
7194
7679
  TokenResponseSchema,
7195
7680
  UPLOAD_ALLOWED_MIME,
7681
+ UnlinkAuthProviderErrorSchema,
7196
7682
  UpdateAdminUserEmailRequestSchema,
7197
7683
  UpdateAppSettingsRequestSchema,
7198
7684
  UpdateAppSettingsResponseSchema,
@@ -7211,6 +7697,7 @@ export {
7211
7697
  UploadAttachmentErrorCodeSchema,
7212
7698
  UploadAttachmentErrorSchema,
7213
7699
  UploadAttachmentResponseSchema,
7700
+ UploadPolicyResponseSchema,
7214
7701
  UserBookmarksResponseSchema,
7215
7702
  UserLanguageSchema,
7216
7703
  UserListItemSchema,
@@ -7256,6 +7743,7 @@ export {
7256
7743
  autocompleteUsersRoute,
7257
7744
  backlinkRoutes,
7258
7745
  bookmarkRoutes,
7746
+ callbackFederatedProviderRoute,
7259
7747
  cancelDraftRoute,
7260
7748
  claimPageLinkAccessRoute,
7261
7749
  clearRenderCacheAllRoute,
@@ -7265,6 +7753,7 @@ export {
7265
7753
  confirmEmailChangeRoute,
7266
7754
  createAccessTokenRoute,
7267
7755
  createAdminRoute,
7756
+ createAuthProviderLinkGrantRoute,
7268
7757
  createClient,
7269
7758
  createDraftRoute,
7270
7759
  createPageRoute,
@@ -7280,6 +7769,9 @@ export {
7280
7769
  draftRoutes,
7281
7770
  editUserRoute,
7282
7771
  emailChangeRoutes,
7772
+ federatedAuthRoutes,
7773
+ federatedHandoffRoute,
7774
+ federatedRegistrationRoutes,
7283
7775
  forgotPasswordRoute,
7284
7776
  getAppInfoRoute,
7285
7777
  getAppSettingsRoute,
@@ -7289,6 +7781,7 @@ export {
7289
7781
  getBacklinksRoute,
7290
7782
  getBookmarkRoute,
7291
7783
  getCryptoStatusRoute,
7784
+ getFederatedRegistrationRoute,
7292
7785
  getInstallerStatusRoute,
7293
7786
  getLikersRoute,
7294
7787
  getMailSettingsRoute,
@@ -7305,6 +7798,7 @@ export {
7305
7798
  getSeenUsersRoute,
7306
7799
  getStorageStatusRoute,
7307
7800
  getUnreadCountRoute,
7801
+ getUploadPolicyRoute,
7308
7802
  getUserBookmarksRoute,
7309
7803
  getUserPageRoute,
7310
7804
  getUserPagesRoute,
@@ -7322,6 +7816,8 @@ export {
7322
7816
  listAttachmentsRoute,
7323
7817
  listCommentsRoute,
7324
7818
  listDraftsRoute,
7819
+ listFederatedProvidersRoute,
7820
+ listLinkedAuthProvidersRoute,
7325
7821
  listMembersRoute,
7326
7822
  listMyBookmarksRoute,
7327
7823
  listNotificationsRoute,
@@ -7330,6 +7826,7 @@ export {
7330
7826
  listPluginsRoute,
7331
7827
  listRevisionsRoute,
7332
7828
  listUsersRoute,
7829
+ logoutFederatedRegistrationRoute,
7333
7830
  makeAdminRoute,
7334
7831
  markAllAsReadRoute,
7335
7832
  meRoutes,
@@ -7366,7 +7863,9 @@ export {
7366
7863
  sendTestMailRoute,
7367
7864
  setPageGrantRoute,
7368
7865
  setWatchStatusRoute,
7866
+ startFederatedProviderRoute,
7369
7867
  stripKnownHtmlTags,
7868
+ submitFederatedRegistrationRoute,
7370
7869
  suspendUserRoute,
7371
7870
  tokenAuthRoutes,
7372
7871
  tokenLoginRoute,
@@ -7376,6 +7875,7 @@ export {
7376
7875
  tokenRegisterRoute,
7377
7876
  tokenRoute,
7378
7877
  unlikePageRoute,
7878
+ unlinkAuthProviderRoute,
7379
7879
  unwrapRenderedAst,
7380
7880
  updateAppSettingsRoute,
7381
7881
  updateAuthSettingsRoute,