@dimah-s3/server 2.0.0-beta.1 → 2.0.0-beta.11

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/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # @dimah-s3/server
2
2
 
3
- **2.0 beta.** Install with `@beta`. `@latest` stays on 1.x, and betas can include breaking changes until 2.0.0.
3
+ **2.0 beta.** Install with `@beta`. `@latest` stays on 1.x ([v1.s3.dimah.dev](https://v1.s3.dimah.dev/docs)), and betas can include breaking changes until 2.0.0.
4
4
 
5
5
  Presigned S3 upload, download, and delete handlers with route policies,
6
6
  guards, and lifecycle hooks. One instance gives you an HTTP `handler`, an
7
7
  in-process `api`, and `put` for server-side uploads.
8
8
 
9
- Full documentation: [v2.s3.dimah.dev/docs/server](https://v2.s3.dimah.dev/docs/server) ·
10
- [llms.txt](https://v2.s3.dimah.dev/llms.txt)
9
+ Full documentation: [s3.dimah.dev/docs/server](https://s3.dimah.dev/docs/server) ·
10
+ [llms.txt](https://s3.dimah.dev/llms.txt)
11
11
 
12
12
  ## Install
13
13
 
@@ -64,7 +64,7 @@ export const { GET, POST, PUT, PATCH, DELETE } = toNextJsHandler(s3);
64
64
  // Any Fetch runtime: s3.handler(request)
65
65
  ```
66
66
 
67
- See [Server Setup](https://v2.s3.dimah.dev/docs/server/setup) for every adapter.
67
+ See [Server Setup](https://s3.dimah.dev/docs/server/setup) for every adapter.
68
68
 
69
69
  ## Guards and hooks
70
70
 
@@ -109,7 +109,7 @@ Optional persistence: add `db()` from [`@dimah-s3/db`](../db) to `plugins`.
109
109
 
110
110
  ## Upgrading from 1.7
111
111
 
112
- See [Upgrade to 2.0 beta](https://v2.s3.dimah.dev/docs/migration-2-0).
112
+ See [Upgrade to 2.0 beta](https://s3.dimah.dev/docs/migration-2-0).
113
113
 
114
114
  ## License
115
115
 
@@ -1,4 +1,4 @@
1
- import type { DimahS3HandlerSource } from "./types";
1
+ import type { DimahS3HandlerSource } from "./types.js";
2
2
  /** Structural Elysia context — avoids a hard dependency on `elysia`. */
3
3
  type ElysiaContext = {
4
4
  request: Request;
@@ -1,5 +1,5 @@
1
- import { fromNodeHeaders, type NodeHandlerOptions } from "./node";
2
- import type { DimahS3HandlerSource } from "./types";
1
+ import { fromNodeHeaders, type NodeHandlerOptions } from "./node.js";
2
+ import type { DimahS3HandlerSource } from "./types.js";
3
3
  export { fromNodeHeaders, type NodeHandlerOptions };
4
4
  /**
5
5
  * Adapt a dimah-s3 instance to an Express / Connect handler.
@@ -1,6 +1,6 @@
1
1
  import type { IncomingMessage, ServerResponse } from "node:http";
2
- import { type NodeHandlerOptions } from "./node";
3
- import type { DimahS3HandlerSource } from "./types";
2
+ import { type NodeHandlerOptions } from "./node.js";
3
+ import type { DimahS3HandlerSource } from "./types.js";
4
4
  export type { NodeHandlerOptions };
5
5
  /** Structural Fastify request/reply — avoids a hard dependency on `fastify`. */
6
6
  type FastifyRequestLike = {
@@ -1,4 +1,4 @@
1
- import type { DimahS3HandlerSource } from "./types";
1
+ import type { DimahS3HandlerSource } from "./types.js";
2
2
  /** Structural Hono context — avoids a hard dependency on `hono`. */
3
3
  type HonoContext = {
4
4
  req: {
@@ -1,4 +1,4 @@
1
- import type { DimahS3HandlerSource } from "./types";
1
+ import type { DimahS3HandlerSource } from "./types.js";
2
2
  /**
3
3
  * Adapt a dimah-s3 instance to Next.js App Router route handlers.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "node:http";
2
- import type { DimahS3HandlerSource } from "./types";
2
+ import type { DimahS3HandlerSource } from "./types.js";
3
3
  /** Options of the Node, Express and Fastify adapters. */
4
4
  export type NodeHandlerOptions = {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type { DimahS3HandlerSource } from "./types";
1
+ import type { DimahS3HandlerSource } from "./types.js";
2
2
  /** Structural SvelteKit event — avoids a hard dependency on `@sveltejs/kit`. */
3
3
  type SvelteKitRequestEvent = {
4
4
  request: Request;
@@ -1,5 +1,5 @@
1
1
  import { type EndpointBaseOptions, type EndpointHandler, type StandardSchemaV1 } from "better-call";
2
- import type { S3EndpointContext } from "./context";
2
+ import type { S3EndpointContext } from "./context.js";
3
3
  /** HTTP methods a dimah-s3 endpoint can use. */
4
4
  export type S3EndpointMethod = "GET" | "POST" | "PATCH" | "DELETE";
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type { S3EndpointContext } from "./context";
1
+ import type { S3EndpointContext } from "./context.js";
2
2
  /**
3
3
  * Context middleware of every plugin endpoint. Plugin endpoints are guarded
4
4
  * here; core endpoints run their guards inside the operation.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { dimahS3 } from "./dimah-s3";
2
- export type { DimahS3 } from "./dimah-s3";
3
- export { route } from "./route";
4
- export { chainHooks } from "./plugin";
1
+ export { dimahS3 } from "./dimah-s3.js";
2
+ export type { DimahS3 } from "./dimah-s3.js";
3
+ export { route } from "./route.js";
4
+ export { chainHooks } from "./plugin/index.js";
5
5
  export { APIError, isAPIError, isS3ErrorCode, s3Error, S3_ERROR_CODES, } from "@dimah-s3/core";
6
- export type { DeleteConfig, DeleteGuardContext, DeleteOnDeletedContext, DimahS3Api, DimahS3Config, DimahS3Locals, DimahS3Logger, DimahS3RouteConfig, DimahS3RoutePluginOptions, DownloadConfig, DownloadGuardContext, DownloadOnPresignedContext, DownloadResolveContext, DownloadResolveInfo, FeatureToggle, Guard, GuardContext, GuardResult, LifecycleHook, MultipartConfig, MultipartGuardContext, MultipartOnAbortContext, MultipartUploadContext, ObjectContext, ObjectS3Headers, PutInput, RouteGuardContext, S3Operation, S3ServerCallOptions, TicketSubject, UploadConfig, UploadConfirmGuardContext, UploadFile, UploadGuardContext, UploadKind, UploadObjectContext, UploadObjectInfo, UploadOnConfirmedContext, UploadOnStartContext, VerifiedObject, } from "./types";
6
+ export type { DeleteConfig, DeleteGuardContext, DeleteOnDeletedContext, DimahS3Api, DimahS3Config, DimahS3Locals, DimahS3Logger, DimahS3RouteConfig, DimahS3RoutePluginOptions, DownloadConfig, DownloadGuardContext, DownloadOnPresignedContext, DownloadResolveContext, DownloadResolveInfo, FeatureToggle, Guard, GuardContext, GuardResult, LifecycleHook, MultipartConfig, MultipartGuardContext, MultipartOnAbortContext, MultipartUploadContext, ObjectContext, ObjectS3Headers, PutInput, RouteGuardContext, S3Operation, S3ServerCallOptions, TicketSubject, UploadConfig, UploadConfirmGuardContext, UploadFile, UploadGuardContext, UploadKind, UploadObjectContext, UploadObjectInfo, UploadOnConfirmedContext, UploadOnStartContext, VerifiedObject, } from "./types/index.js";
7
7
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -326,7 +326,12 @@ async function capRequestBody(request, maxSize) {
326
326
  }
327
327
  chunks.push(value);
328
328
  }
329
- return new Request(request, { body: new Blob(chunks) });
329
+ return new Request(request.url, {
330
+ method: request.method,
331
+ headers: request.headers,
332
+ body: new Blob(chunks),
333
+ signal: request.signal
334
+ });
330
335
  }
331
336
  function isUnmatched(response) {
332
337
  return response.status === 404 && response.body === null;