@dimah-s3/server 1.5.9 → 1.5.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.
@@ -1,4 +1,4 @@
1
- import type { DimahS3Config } from "../types/index.d.ts";
1
+ import type { DimahS3Config } from "../types/index.js";
2
2
  import { type AppliedPlugins, type DimahS3Plugin, type PluginContextMap } from "./types";
3
3
  /**
4
4
  * Validate plugins, build context map, collect endpoints, validate routes,
@@ -1,5 +1,5 @@
1
1
  import type { Endpoint } from "better-call";
2
- import type { DeleteConfig, DownloadConfig, MultipartConfig, UploadConfig, DimahS3Config, ResolvedDimahS3Config } from "../types/config.d.ts";
2
+ import type { DeleteConfig, DownloadConfig, MultipartConfig, UploadConfig, DimahS3Config, ResolvedDimahS3Config } from "../types/config.js";
3
3
  import type { FeatureHookKeyMap, MultipartHookKey } from "./hook-registry";
4
4
  type HookFields<T, K extends keyof T> = Pick<T, K>;
5
5
  /**
package/dist/plugins.js CHANGED
@@ -443,8 +443,9 @@ function assertDistinctKeyPrefixes(routes) {
443
443
  }
444
444
 
445
445
  // src/helpers/request.ts
446
+ var SYNTHETIC_ORIGIN = "http://dimah-s3.local";
446
447
  function requestFromHeaders(headers) {
447
- return new Request("http://dimah-s3.local", { headers });
448
+ return new Request(SYNTHETIC_ORIGIN, { headers });
448
449
  }
449
450
  function assertWithinMaxFileSize(maxFileSize, size) {
450
451
  if (typeof maxFileSize === "number" && size > maxFileSize) {
@@ -662,6 +663,9 @@ function withS3Validation(options) {
662
663
  ...options,
663
664
  ...options.body !== void 0 ? { body: compileIfZod(options.body) } : {},
664
665
  ...options.query !== void 0 ? { query: compileIfZod(options.query) } : {},
666
+ // better-call reads the body before hooks. Clone first so
667
+ // `request.clone().json()` in guard / resolveScope still works.
668
+ ...options.body !== void 0 && options.cloneRequest === void 0 ? { cloneRequest: true } : {},
665
669
  onValidationError: options.onValidationError ?? (({ message }) => {
666
670
  throw errors.validationError(message);
667
671
  })