@kubun/hub 0.17.2 → 0.17.3

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.
@@ -11,6 +11,12 @@ const DEFAULT_RETENTION_INTERVAL_SECONDS = 3600;
11
11
  const DEFAULT_SUBSCRIPTION_RETENTION_SECONDS = 90 * 24 * 60 * 60;
12
12
  const DEFAULT_MAX_RETENTION_SECONDS = 30 * 24 * 60 * 60;
13
13
  const DEFAULT_MAX_DEPTH = 1000;
14
+ // Raised from `@enkaku/http-serve`'s own 1 MiB: a relay exists to carry sync
15
+ // frames, and a full-scope merkle reconciliation of a modest graph (~1.5 MiB
16
+ // observed) already exceeds 1 MiB. 8 MiB clears realistic reconciliations with
17
+ // headroom while still bounding a single request.
18
+ const DEFAULT_MAX_REQUEST_BODY_SIZE = 8 * 1024 * 1024;
19
+ const DEFAULT_MAX_SESSION_BUFFER_BYTES = 8 * 1024 * 1024;
14
20
  function resolveAccessRules(auth) {
15
21
  if (auth == null) return {};
16
22
  switch(auth.mode){
@@ -86,7 +92,9 @@ export async function createRelayInternal(options) {
86
92
  }
87
93
  const allowedOrigin = resolveAllowedOrigin(options.allowedOrigin);
88
94
  const transport = new ServerTransport({
89
- allowedOrigin
95
+ allowedOrigin,
96
+ maxRequestBodySize: options.maxRequestBodySize ?? DEFAULT_MAX_REQUEST_BODY_SIZE,
97
+ maxSessionBufferBytes: options.maxSessionBufferBytes ?? DEFAULT_MAX_SESSION_BUFFER_BYTES
90
98
  });
91
99
  const accessRules = resolveAccessRules(options.auth);
92
100
  // `@kumiai/hub-server` assembles the handlers, registry, and Enkaku server for
@@ -229,6 +237,8 @@ export async function createRelay(options) {
229
237
  authorize: options.authorize,
230
238
  allowedOrigin: options.allowedOrigin,
231
239
  rateLimits: options.rateLimits,
240
+ maxRequestBodySize: options.maxRequestBodySize,
241
+ maxSessionBufferBytes: options.maxSessionBufferBytes,
232
242
  retention: options.retention,
233
243
  defaultRetention: options.defaultRetention,
234
244
  maxRetention: options.maxRetention,
package/lib/index.js CHANGED
@@ -15,6 +15,8 @@ export async function createHub(options) {
15
15
  auth: options.auth,
16
16
  allowedOrigin: options.allowedOrigin,
17
17
  rateLimits: options.rateLimits,
18
+ maxRequestBodySize: options.maxRequestBodySize,
19
+ maxSessionBufferBytes: options.maxSessionBufferBytes,
18
20
  retention: options.retention,
19
21
  observers: options.observers,
20
22
  ownsKysely: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/hub",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "license": "see LICENSE.md",
5
5
  "sideEffects": false,
6
6
  "type": "module",