@ayepi/files 0.4.1 → 0.5.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.
package/dist/server.d.cts CHANGED
@@ -3,6 +3,14 @@ import { AnySpec, MountHandle, Server } from "@ayepi/core";
3
3
 
4
4
  //#region src/server.d.ts
5
5
 
6
+ /** Why an upload was refused: its body broke a limit its token pins. */
7
+ declare class UploadRefused extends Error {
8
+ /** The HTTP status the refusal answers with. */
9
+ readonly status: 413 | 422;
10
+ /** A stable code: `TOO_LARGE` or `CHECKSUM_MISMATCH`. */
11
+ readonly code: 'TOO_LARGE' | 'CHECKSUM_MISMATCH';
12
+ constructor(status: 413 | 422, code: 'TOO_LARGE' | 'CHECKSUM_MISMATCH', message: string);
13
+ }
6
14
  /** Shared options for the two serving styles. */
7
15
  interface FilesServerOptions {
8
16
  /** HMAC secret used to sign/verify presigned tokens (server-side only). */
@@ -48,4 +56,4 @@ declare function createFilesHandler(store: FileStore, opts: FilesServerOptions):
48
56
  presign: Presigner;
49
57
  };
50
58
  //#endregion
51
- export { FilesServerOptions, createFilesHandler, mountFiles };
59
+ export { FilesServerOptions, UploadRefused, createFilesHandler, mountFiles };
package/dist/server.d.ts CHANGED
@@ -3,6 +3,14 @@ import { AnySpec, MountHandle, Server } from "@ayepi/core";
3
3
 
4
4
  //#region src/server.d.ts
5
5
 
6
+ /** Why an upload was refused: its body broke a limit its token pins. */
7
+ declare class UploadRefused extends Error {
8
+ /** The HTTP status the refusal answers with. */
9
+ readonly status: 413 | 422;
10
+ /** A stable code: `TOO_LARGE` or `CHECKSUM_MISMATCH`. */
11
+ readonly code: 'TOO_LARGE' | 'CHECKSUM_MISMATCH';
12
+ constructor(status: 413 | 422, code: 'TOO_LARGE' | 'CHECKSUM_MISMATCH', message: string);
13
+ }
6
14
  /** Shared options for the two serving styles. */
7
15
  interface FilesServerOptions {
8
16
  /** HMAC secret used to sign/verify presigned tokens (server-side only). */
@@ -48,4 +56,4 @@ declare function createFilesHandler(store: FileStore, opts: FilesServerOptions):
48
56
  presign: Presigner;
49
57
  };
50
58
  //#endregion
51
- export { FilesServerOptions, createFilesHandler, mountFiles };
59
+ export { FilesServerOptions, UploadRefused, createFilesHandler, mountFiles };