@lacrous/omnicloud 0.2.24 → 0.2.25

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.d.cts CHANGED
@@ -812,10 +812,12 @@ interface StorageStats {
812
812
  * COMMITTING the stored object is being turned into a file record by exactly one
813
813
  * request, which holds this state as an exclusive claim
814
814
  * COMPLETED Telegram object stored and file record committed; result is final
815
+ * UNKNOWN the Telegram write may have stored the object but the outcome is not
816
+ * known; it is resolved, never silently re-uploaded
815
817
  * FAILED Telegram write definitively failed; the operation may be retried
816
818
  * under a new id
817
819
  */
818
- type UploadOperationStatus = "PENDING" | "UPLOADING" | "COMMITTING" | "COMPLETED" | "FAILED";
820
+ type UploadOperationStatus = "PENDING" | "UPLOADING" | "COMMITTING" | "UNKNOWN" | "COMPLETED" | "FAILED";
819
821
 
820
822
  /**
821
823
  * Repository interfaces. The application depends on these, not on a specific
@@ -1277,15 +1279,6 @@ interface FileUploadInput {
1277
1279
  onProgress?: (progress: TransferProgress) => void;
1278
1280
  signal?: AbortSignal;
1279
1281
  }
1280
- /**
1281
- * File metadata operations. Every method verifies ownership: records
1282
- * belonging to other users are reported as missing.
1283
- *
1284
- * Reliability rules honored here:
1285
- * - metadata is written only after the storage upload succeeds;
1286
- * - permanent deletion removes the remote object before the metadata;
1287
- * - client-supplied ownership is never trusted (userId is server-derived).
1288
- */
1289
1282
  declare class FileService {
1290
1283
  private readonly files;
1291
1284
  private readonly folders;
package/dist/index.d.ts CHANGED
@@ -812,10 +812,12 @@ interface StorageStats {
812
812
  * COMMITTING the stored object is being turned into a file record by exactly one
813
813
  * request, which holds this state as an exclusive claim
814
814
  * COMPLETED Telegram object stored and file record committed; result is final
815
+ * UNKNOWN the Telegram write may have stored the object but the outcome is not
816
+ * known; it is resolved, never silently re-uploaded
815
817
  * FAILED Telegram write definitively failed; the operation may be retried
816
818
  * under a new id
817
819
  */
818
- type UploadOperationStatus = "PENDING" | "UPLOADING" | "COMMITTING" | "COMPLETED" | "FAILED";
820
+ type UploadOperationStatus = "PENDING" | "UPLOADING" | "COMMITTING" | "UNKNOWN" | "COMPLETED" | "FAILED";
819
821
 
820
822
  /**
821
823
  * Repository interfaces. The application depends on these, not on a specific
@@ -1277,15 +1279,6 @@ interface FileUploadInput {
1277
1279
  onProgress?: (progress: TransferProgress) => void;
1278
1280
  signal?: AbortSignal;
1279
1281
  }
1280
- /**
1281
- * File metadata operations. Every method verifies ownership: records
1282
- * belonging to other users are reported as missing.
1283
- *
1284
- * Reliability rules honored here:
1285
- * - metadata is written only after the storage upload succeeds;
1286
- * - permanent deletion removes the remote object before the metadata;
1287
- * - client-supplied ownership is never trusted (userId is server-derived).
1288
- */
1289
1282
  declare class FileService {
1290
1283
  private readonly files;
1291
1284
  private readonly folders;
package/dist/index.js CHANGED
@@ -1437,6 +1437,13 @@ function uploadRequestFingerprint(input) {
1437
1437
  }
1438
1438
 
1439
1439
  // ../core/src/services/file-service.ts
1440
+ function connectionCausedFailure(error) {
1441
+ if (error instanceof TelegramConnectionError) return true;
1442
+ if (error instanceof UploadFailedError) {
1443
+ return error.details instanceof TelegramConnectionError;
1444
+ }
1445
+ return false;
1446
+ }
1440
1447
  var FileService = class {
1441
1448
  constructor(files, folders, engineFor, activity = noopActivityRecorder, operations = null, log = null) {
1442
1449
  this.files = files;
@@ -1513,8 +1520,9 @@ var FileService = class {
1513
1520
  await operations.update(op.id, { status: "COMPLETED", fileId: record.id });
1514
1521
  return record;
1515
1522
  } catch (error) {
1523
+ const status = connectionCausedFailure(error) ? "UNKNOWN" : "FAILED";
1516
1524
  await operations.update(op.id, {
1517
- status: "FAILED",
1525
+ status,
1518
1526
  error: error instanceof Error ? error.message.slice(0, 200) : "upload failed"
1519
1527
  });
1520
1528
  throw error;