@dimah-s3/server 2.0.0-beta.1 → 2.0.0-beta.10
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 +5 -5
- package/dist/adapters/elysia.d.ts +1 -1
- package/dist/adapters/express.d.ts +2 -2
- package/dist/adapters/fastify.d.ts +2 -2
- package/dist/adapters/hono.d.ts +1 -1
- package/dist/adapters/next.d.ts +1 -1
- package/dist/adapters/node.d.ts +1 -1
- package/dist/adapters/svelte-kit.d.ts +1 -1
- package/dist/api/create-s3-endpoint.d.ts +1 -1
- package/dist/api/create-s3-middleware.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/operations/multipart/abort.d.ts +1 -1
- package/dist/operations/multipart/complete.d.ts +1 -1
- package/dist/operations/multipart/list-parts.d.ts +1 -1
- package/dist/plugin/apply-plugins.d.ts +1 -1
- package/dist/plugin/define-plugin.d.ts +1 -1
- package/dist/plugin/index.d.ts +4 -4
- package/dist/plugins.d.ts +10 -10
- package/dist/types/config.d.ts +2 -2
- package/dist/types/hook-contexts.d.ts +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/resolved.d.ts +3 -3
- package/package.json +10 -10
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: [
|
|
10
|
-
[llms.txt](https://
|
|
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://
|
|
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://
|
|
112
|
+
See [Upgrade to 2.0 beta](https://s3.dimah.dev/docs/migration-2-0).
|
|
113
113
|
|
|
114
114
|
## License
|
|
115
115
|
|
|
@@ -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 = {
|
package/dist/adapters/hono.d.ts
CHANGED
package/dist/adapters/next.d.ts
CHANGED
package/dist/adapters/node.d.ts
CHANGED
|
@@ -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,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
|
/**
|
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, {
|
|
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;
|