@lacrous/omnicloud 0.2.21 → 0.2.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacrous/omnicloud",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "SDK and core building blocks for OmniCloud — self-hosted cloud storage powered by your Telegram account.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,9 +48,9 @@
48
48
  "prisma": "^6.2.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@omnicloud/core": "0.2.21",
52
- "@omnicloud/shared": "0.2.21",
53
- "@omnicloud/telegram": "0.2.21",
51
+ "@omnicloud/core": "0.2.22",
52
+ "@omnicloud/shared": "0.2.22",
53
+ "@omnicloud/telegram": "0.2.22",
54
54
  "@types/node": "^22.10.0",
55
55
  "esbuild": "0.25.12",
56
56
  "tsup": "^8.3.0",
package/server/index.js CHANGED
@@ -2440,11 +2440,15 @@ function mapTelegramError(error, fallbackMessage) {
2440
2440
  if (error instanceof DomainError) return error;
2441
2441
  if (isTelegramRpcError(error)) {
2442
2442
  const msg = error.errorMessage ?? "";
2443
- if (msg.startsWith("FLOOD_WAIT_")) {
2444
- const seconds = Number(msg.slice("FLOOD_WAIT_".length)) || 60;
2445
- return new RateLimitedError(`Telegram rate limit reached \u2014 retry in ${seconds} seconds`, {
2446
- retryAfterSeconds: seconds
2447
- });
2443
+ const seconds = error.seconds;
2444
+ const floodSeconds = typeof seconds === "number" ? seconds : msg.startsWith("FLOOD_WAIT_") ? Number(msg.slice("FLOOD_WAIT_".length)) : null;
2445
+ if (msg.startsWith("FLOOD") && floodSeconds !== null && floodSeconds > 0) {
2446
+ return new RateLimitedError(
2447
+ `Telegram rate limit reached \u2014 retry in ${floodSeconds} seconds`,
2448
+ {
2449
+ retryAfterSeconds: floodSeconds
2450
+ }
2451
+ );
2448
2452
  }
2449
2453
  switch (msg) {
2450
2454
  case "PHONE_NUMBER_INVALID":
@@ -2875,7 +2879,9 @@ var TelegramStorageProvider = class {
2875
2879
  try {
2876
2880
  await this.client.deleteMessages(this.peer, [Number(ref.messageId)], { revoke: true });
2877
2881
  } catch (error) {
2878
- throw mapTelegramError(error, "Telegram delete failed");
2882
+ const mapped = mapTelegramError(error, "Telegram delete failed");
2883
+ if (mapped instanceof TelegramFileNotFoundError) return;
2884
+ throw mapped;
2879
2885
  }
2880
2886
  }
2881
2887
  async exists(ref) {
@@ -5032,7 +5038,7 @@ function encryptionCheck(configured) {
5032
5038
  }
5033
5039
 
5034
5040
  // ../../apps/api/src/routes/storage.ts
5035
- var VERSION = "0.2.21";
5041
+ var VERSION = "0.2.22";
5036
5042
  function registerStorageRoutes(app2, container2) {
5037
5043
  app2.get("/api/health", async () => {
5038
5044
  const database = await probeDatabase(container2);