@celljs/ta-sync 4.21.0 → 4.23.0

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 (2) hide show
  1. package/host/index.mjs +18 -3
  2. package/package.json +4 -4
package/host/index.mjs CHANGED
@@ -2562,9 +2562,12 @@ var RELAY_HUB_MAX_KEYS = 4096;
2562
2562
  var RELAY_HUB_MAX_STATE = 3 * 1024 * 1024;
2563
2563
  var RELAY_PICTURE_MAX_CHARS = 16 * 1024;
2564
2564
  var RELAY_HUB_IDLE_DAYS = 90;
2565
+ var RELAY_HUB_LOG_CHARS = 4 * 1024 * 1024;
2565
2566
 
2566
2567
  // ../ta-relay/esm/common/relay-info.js
2567
2568
  var RELAY_INFO_PATH = "/v1/info";
2569
+ var RELAY_MEDIA_MAX = { days: 30, bytes: 2 * 1024 * 1024 };
2570
+ var RELAY_MEDIA_DEFAULT_DAYS = 1;
2568
2571
  var RELAY_LEGACY_INFO = {
2569
2572
  v: 1,
2570
2573
  capabilities: ["tunnel", "hub", "store", "pages"],
@@ -2581,10 +2584,20 @@ var RELAY_LEGACY_INFO = {
2581
2584
  };
2582
2585
  var RelayInfoUtil;
2583
2586
  (function(RelayInfoUtil2) {
2584
- function of(persistent) {
2585
- return { ...RELAY_LEGACY_INFO, persistent };
2587
+ function of(persistent, media2) {
2588
+ return { ...RELAY_LEGACY_INFO, persistent, ...media2 ? { media: media2 } : {} };
2586
2589
  }
2587
2590
  RelayInfoUtil2.of = of;
2591
+ function media(days, megabytes) {
2592
+ const set = days !== undefined && days !== null && String(days).trim() !== "";
2593
+ const kept = Math.min(Math.floor(set ? Number(days) || 0 : RELAY_MEDIA_DEFAULT_DAYS), RELAY_MEDIA_MAX.days);
2594
+ if (!(kept > 0)) {
2595
+ return;
2596
+ }
2597
+ const bytes = Number(megabytes) > 0 ? Math.floor(Number(megabytes) * 1024 * 1024) : RELAY_MEDIA_MAX.bytes;
2598
+ return { days: kept, bytes: Math.min(bytes, RELAY_MEDIA_MAX.bytes) };
2599
+ }
2600
+ RelayInfoUtil2.media = media;
2588
2601
  function response(info) {
2589
2602
  return new Response(JSON.stringify(info), {
2590
2603
  headers: { "content-type": "application/json", "access-control-allow-origin": "*", "cache-control": "no-store" }
@@ -2639,11 +2652,13 @@ var RelayInfoUtil;
2639
2652
  limits[key] = given;
2640
2653
  }
2641
2654
  }
2655
+ const kept = info.media && media(info.media.days, (Number(info.media.bytes) || 0) / (1024 * 1024));
2642
2656
  return {
2643
2657
  v: 1,
2644
2658
  capabilities: info.capabilities.filter((capability) => known.includes(capability)),
2645
2659
  limits,
2646
- persistent: info.persistent !== false
2660
+ persistent: info.persistent !== false,
2661
+ ...kept ? { media: kept } : {}
2647
2662
  };
2648
2663
  }
2649
2664
  RelayInfoUtil2.parse = parse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-sync",
3
- "version": "4.21.0",
3
+ "version": "4.23.0",
4
4
  "description": "A pi package for Ta: the user's settings, instructions, skills, extensions and the data extensions declare, the same on each of their computers, through a room of the relay sealed end to end, without an account",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -26,9 +26,9 @@
26
26
  "watch": "tsc -b -w --preserveWatchOutput"
27
27
  },
28
28
  "devDependencies": {
29
- "@celljs/ta-protocol": "4.21.0",
30
- "@celljs/ta-relay": "4.21.0",
31
- "@celljs/ta-web": "4.21.0",
29
+ "@celljs/ta-protocol": "4.23.0",
30
+ "@celljs/ta-relay": "4.23.0",
31
+ "@celljs/ta-web": "4.23.0",
32
32
  "@types/react": "^19.3.0"
33
33
  },
34
34
  "publishConfig": {