@crowi/api 2.0.0-alpha.0 → 2.0.0-alpha.1

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.
Files changed (70) hide show
  1. package/dist/hono/handlers/access-token.d.ts +55 -55
  2. package/dist/hono/handlers/activation.d.ts +27 -27
  3. package/dist/hono/handlers/admin/app.d.ts +26 -26
  4. package/dist/hono/handlers/admin/auth.d.ts +24 -24
  5. package/dist/hono/handlers/admin/mail.d.ts +30 -30
  6. package/dist/hono/handlers/admin/plugins.d.ts +112 -112
  7. package/dist/hono/handlers/admin/search.d.ts +21 -21
  8. package/dist/hono/handlers/admin/security.d.ts +24 -24
  9. package/dist/hono/handlers/admin/storage.d.ts +19 -19
  10. package/dist/hono/handlers/admin/users.d.ts +305 -305
  11. package/dist/hono/handlers/adminCrypto.d.ts +32 -32
  12. package/dist/hono/handlers/app.d.ts +11 -8
  13. package/dist/hono/handlers/app.js +31 -1
  14. package/dist/hono/handlers/app.js.map +1 -1
  15. package/dist/hono/handlers/attachment.d.ts +180 -180
  16. package/dist/hono/handlers/autocomplete.d.ts +45 -45
  17. package/dist/hono/handlers/backlink.d.ts +33 -33
  18. package/dist/hono/handlers/bookmark.d.ts +95 -95
  19. package/dist/hono/handlers/comment.d.ts +55 -55
  20. package/dist/hono/handlers/draft.d.ts +27 -27
  21. package/dist/hono/handlers/emailChange.d.ts +25 -25
  22. package/dist/hono/handlers/installer.d.ts +16 -16
  23. package/dist/hono/handlers/inviteAccept.d.ts +37 -37
  24. package/dist/hono/handlers/me.d.ts +92 -92
  25. package/dist/hono/handlers/notification.d.ts +94 -94
  26. package/dist/hono/handlers/oauth.d.ts +58 -58
  27. package/dist/hono/handlers/page-collab.d.ts +20 -20
  28. package/dist/hono/handlers/page-preview.d.ts +7 -7
  29. package/dist/hono/handlers/page.d.ts +333 -333
  30. package/dist/hono/handlers/passwordReset.d.ts +37 -37
  31. package/dist/hono/handlers/presence.d.ts +44 -44
  32. package/dist/hono/handlers/revision.d.ts +99 -99
  33. package/dist/hono/handlers/search.d.ts +64 -64
  34. package/dist/hono/handlers/tokenAuth.d.ts +80 -80
  35. package/dist/hono/handlers/user.d.ts +102 -102
  36. package/dist/hono/handlers/user.js +15 -5
  37. package/dist/hono/handlers/user.js.map +1 -1
  38. package/dist/hono/index.d.ts +94 -94
  39. package/dist/mcp/result.d.ts +15 -0
  40. package/dist/mcp/result.js +20 -1
  41. package/dist/mcp/result.js.map +1 -1
  42. package/dist/mcp/tools/page.js +9 -4
  43. package/dist/mcp/tools/page.js.map +1 -1
  44. package/dist/migration/migrations/index.js +2 -0
  45. package/dist/migration/migrations/index.js.map +1 -1
  46. package/dist/migration/migrations/relocate-reserved-api-paths.d.ts +3 -0
  47. package/dist/migration/migrations/relocate-reserved-api-paths.js +135 -0
  48. package/dist/migration/migrations/relocate-reserved-api-paths.js.map +1 -0
  49. package/dist/models/page.js +9 -2
  50. package/dist/models/page.js.map +1 -1
  51. package/dist/util/replace-url.d.ts +85 -0
  52. package/dist/util/replace-url.js +251 -0
  53. package/dist/util/replace-url.js.map +1 -0
  54. package/package.json +6 -4
  55. package/public/images/file-not-found.png +0 -0
  56. package/views/mail/activation.mjml +9 -0
  57. package/views/mail/activation.text +13 -0
  58. package/views/mail/adminApprovalPending.mjml +7 -0
  59. package/views/mail/adminApprovalPending.text +11 -0
  60. package/views/mail/emailChange.mjml +9 -0
  61. package/views/mail/emailChange.text +13 -0
  62. package/views/mail/invite.mjml +9 -0
  63. package/views/mail/invite.text +13 -0
  64. package/views/mail/layout.mjml +36 -0
  65. package/views/mail/passwordChanged.mjml +4 -0
  66. package/views/mail/passwordChanged.text +9 -0
  67. package/views/mail/passwordReset.mjml +9 -0
  68. package/views/mail/passwordReset.text +13 -0
  69. package/views/mail/test.mjml +2 -0
  70. package/views/mail/test.text +7 -0
@@ -6,18 +6,13 @@ export declare const registerAdminCryptoRoutes: <E extends OpenAPIHono<CrowiHono
6
6
  $get: {
7
7
  input: {};
8
8
  output: {
9
- encryptionConfigured: boolean;
10
- unencryptedCount: number;
11
- encryptedCount: number;
12
- entries: {
13
- ns: string;
14
- key: string;
15
- present: boolean;
16
- encrypted: boolean;
17
- }[];
9
+ error: {
10
+ code: "INTERNAL_ERROR";
11
+ message: "Internal server error";
12
+ };
18
13
  };
19
14
  outputFormat: "json";
20
- status: 200;
15
+ status: 500;
21
16
  } | {
22
17
  input: {};
23
18
  output: {
@@ -32,24 +27,29 @@ export declare const registerAdminCryptoRoutes: <E extends OpenAPIHono<CrowiHono
32
27
  } | {
33
28
  input: {};
34
29
  output: {
35
- error: {
36
- code: "ADMIN_REQUIRED";
37
- message: "Admin permission required";
38
- redirectTo?: string | undefined;
39
- };
30
+ encryptionConfigured: boolean;
31
+ unencryptedCount: number;
32
+ encryptedCount: number;
33
+ entries: {
34
+ ns: string;
35
+ key: string;
36
+ present: boolean;
37
+ encrypted: boolean;
38
+ }[];
40
39
  };
41
40
  outputFormat: "json";
42
- status: 403;
41
+ status: 200;
43
42
  } | {
44
43
  input: {};
45
44
  output: {
46
45
  error: {
47
- code: "INTERNAL_ERROR";
48
- message: "Internal server error";
46
+ code: "ADMIN_REQUIRED";
47
+ message: "Admin permission required";
48
+ redirectTo?: string | undefined;
49
49
  };
50
50
  };
51
51
  outputFormat: "json";
52
- status: 500;
52
+ status: 403;
53
53
  };
54
54
  };
55
55
  } & {
@@ -57,12 +57,13 @@ export declare const registerAdminCryptoRoutes: <E extends OpenAPIHono<CrowiHono
57
57
  $post: {
58
58
  input: {};
59
59
  output: {
60
- rewritten: number;
61
- alreadyEncrypted: number;
62
- missing: number;
60
+ error: {
61
+ code: "INTERNAL_ERROR";
62
+ message: "Internal server error";
63
+ };
63
64
  };
64
65
  outputFormat: "json";
65
- status: 200;
66
+ status: 500;
66
67
  } | {
67
68
  input: {};
68
69
  output: {
@@ -77,24 +78,23 @@ export declare const registerAdminCryptoRoutes: <E extends OpenAPIHono<CrowiHono
77
78
  } | {
78
79
  input: {};
79
80
  output: {
80
- error: {
81
- code: "ADMIN_REQUIRED";
82
- message: "Admin permission required";
83
- redirectTo?: string | undefined;
84
- };
81
+ rewritten: number;
82
+ alreadyEncrypted: number;
83
+ missing: number;
85
84
  };
86
85
  outputFormat: "json";
87
- status: 403;
86
+ status: 200;
88
87
  } | {
89
88
  input: {};
90
89
  output: {
91
90
  error: {
92
- code: "INTERNAL_ERROR";
93
- message: "Internal server error";
91
+ code: "ADMIN_REQUIRED";
92
+ message: "Admin permission required";
93
+ redirectTo?: string | undefined;
94
94
  };
95
95
  };
96
96
  outputFormat: "json";
97
- status: 500;
97
+ status: 403;
98
98
  } | {
99
99
  input: {};
100
100
  output: {
@@ -4,14 +4,6 @@ import type { CrowiHonoBindings } from '../app';
4
4
  export declare const registerAppRoutes: <E extends OpenAPIHono<CrowiHonoBindings>>(app: E, crowi: Crowi) => OpenAPIHono<CrowiHonoBindings, {
5
5
  "/app/info": {
6
6
  $get: {
7
- input: {};
8
- output: {
9
- title: string | null;
10
- confidential: string | null;
11
- };
12
- outputFormat: "json";
13
- status: 200;
14
- } | {
15
7
  input: {};
16
8
  output: {
17
9
  error: {
@@ -21,6 +13,17 @@ export declare const registerAppRoutes: <E extends OpenAPIHono<CrowiHonoBindings
21
13
  };
22
14
  outputFormat: "json";
23
15
  status: 500;
16
+ } | {
17
+ input: {};
18
+ output: {
19
+ title: string | null;
20
+ confidential: string | null;
21
+ version: string;
22
+ apiVersion: string;
23
+ capabilities: string[];
24
+ };
25
+ outputFormat: "json";
26
+ status: 200;
24
27
  };
25
28
  };
26
29
  }, "/">;
@@ -16,6 +16,27 @@ exports.registerAppRoutes = void 0;
16
16
  * §11).
17
17
  */
18
18
  const api_contract_1 = require("@crowi/api-contract");
19
+ /**
20
+ * Build the coarse capability list advertised at `GET /app/info`. Static
21
+ * always-on subsystems plus cheap, in-memory dynamic probes:
22
+ * - `search` when a search driver is active (`getSearcher() !== null`);
23
+ * otherwise `GET /search` returns 503 and the CLI can pre-empt it.
24
+ * - `collab` always (Hocuspocus is library-attached unconditionally);
25
+ * `collab:redis` additionally when `REDIS_URL` is set so multi-instance
26
+ * pub/sub is wired up.
27
+ * No I/O — both probes read state already held on the Crowi instance.
28
+ */
29
+ const buildCapabilities = (crowi) => {
30
+ const capabilities = [...api_contract_1.STATIC_CAPABILITIES];
31
+ if (crowi.getSearcher() != null) {
32
+ capabilities.push('search');
33
+ }
34
+ capabilities.push('collab');
35
+ if (crowi.redis != null) {
36
+ capabilities.push('collab:redis');
37
+ }
38
+ return capabilities;
39
+ };
19
40
  const registerAppRoutes = (app, crowi) => app.openapi(api_contract_1.getAppInfoRoute, (c) => {
20
41
  const config = crowi.getConfig();
21
42
  const raw = config?.crowi?.['app:title'];
@@ -28,7 +49,16 @@ const registerAppRoutes = (app, crowi) => app.openapi(api_contract_1.getAppInfoR
28
49
  // Empty/missing collapses to null (banner hidden).
29
50
  const confidentialRaw = config?.crowi?.['app:confidential'];
30
51
  const confidential = confidentialRaw ? confidentialRaw : null;
31
- return c.json({ title, confidential }, 200);
52
+ // Version-skew / feature-detection signal for the @crowi/cli end-user
53
+ // CLI (and any other client). `crowi.version` is the @crowi/api
54
+ // package.json version read at boot.
55
+ return c.json({
56
+ title,
57
+ confidential,
58
+ version: crowi.version,
59
+ apiVersion: api_contract_1.API_SURFACE_VERSION,
60
+ capabilities: buildCapabilities(crowi),
61
+ }, 200);
32
62
  });
33
63
  exports.registerAppRoutes = registerAppRoutes;
34
64
  //# sourceMappingURL=app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/hono/handlers/app.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,sDAAsD;AAO/C,MAAM,iBAAiB,GAAG,CAA2C,GAAM,EAAE,KAAY,EAAE,EAAE,CAClG,GAAG,CAAC,OAAO,CAAC,8BAAe,EAAE,CAAC,CAAC,EAAE,EAAE;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAA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