@dimah-s3/server 1.5.6 → 1.5.8

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, DimahS3RouteConfig, FeatureToggle, ResolvedFeature, ResolvedRoute } from "../types";
1
+ import type { DimahS3Config, DimahS3RouteConfig, FeatureToggle, ResolvedFeature, ResolvedRoute } from "../types/index.d.ts";
2
2
  export declare function isEnabled<T extends {
3
3
  enabled: boolean;
4
4
  }>(feature: T): feature is T & {
@@ -1,6 +1,6 @@
1
1
  import type { ConfirmedObjectResponse, S3ObjectAcl } from "@dimah-s3/core";
2
2
  import type { HeadObjectCommandOutput, S3Client } from "@aws-sdk/client-s3";
3
- import type { OpenedRoute, ResolvedDimahS3Config, StoredObjectContext } from "../types";
3
+ import type { OpenedRoute, ResolvedDimahS3Config, StoredObjectContext } from "../types/index.d.ts";
4
4
  export type FinalizeConfirmedInput = {
5
5
  config: ResolvedDimahS3Config;
6
6
  route: OpenedRoute<"upload" | "multipart">;
@@ -1,4 +1,4 @@
1
- import type { ResolvedDimahS3Config, UploadConfig, UploadObjectContext, UploadObjectInfo } from "../types";
1
+ import type { ResolvedDimahS3Config, UploadConfig, UploadObjectContext, UploadObjectInfo } from "../types/index.d.ts";
2
2
  /**
3
3
  * Run a guard hook. {@link isAPIError} values are preserved; plain Errors keep
4
4
  * their English message without a library `code` so client
@@ -1,4 +1,4 @@
1
- import type { DimahS3Logger } from "../types";
1
+ import type { DimahS3Logger } from "../types/index.d.ts";
2
2
  export declare const defaultLogger: DimahS3Logger;
3
3
  export declare function resolveLogger(logger: DimahS3Logger | false | undefined): DimahS3Logger;
4
4
  //# sourceMappingURL=logger.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { StorageClass } from "@aws-sdk/client-s3";
2
- import type { ObjectS3Headers } from "../types";
2
+ import type { ObjectS3Headers } from "../types/index.d.ts";
3
3
  /** URL-encoded `key=value&…` for the S3 `Tagging` / `x-amz-tagging` field. */
4
4
  export declare function encodeObjectTagging(tagging: Record<string, string>): string;
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { type ResolvedObject } from "./resolve-target";
2
- import type { OpenedRoute, ResolvedDimahS3Config, ResolvedRoute, RouteOperation, StoredObjectContext } from "../types";
1
+ import { type ResolvedObject } from "./resolve-target.d.ts";
2
+ import type { OpenedRoute, ResolvedDimahS3Config, ResolvedRoute, RouteOperation, StoredObjectContext } from "../types/index.d.ts";
3
3
  export type OpenedTarget<F extends RouteOperation> = {
4
4
  route: OpenedRoute<F>;
5
5
  key: string;
@@ -1,5 +1,5 @@
1
1
  import { normalizeObjectKey, type S3ObjectAcl } from "@dimah-s3/core";
2
- import type { ObjectS3Headers, OpenedRoute, ResolvedRoute, UploadObjectContext } from "../types";
2
+ import type { ObjectS3Headers, OpenedRoute, ResolvedRoute, UploadObjectContext } from "../types/index.d.ts";
3
3
  export type ResolvedObject = {
4
4
  key: string;
5
5
  bucket: string;
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-target.d.ts","sourceRoot":"","sources":["../../src/helpers/resolve-target.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,aAAa,EACb,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,GAAG,EAAE,WAAW,CAAC;CAClB,GAAG,eAAe,CAAC;AAEpB,KAAK,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAEjD;;;GAGG;AACH,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,mBAAmB,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AO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIvD;AAUD,yEAAyE;AACzE,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,cAAc,EACzB,GAAG,EAAE,MAAM,GACV,MAAM,CAIR;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,cAAc,GACxB,MAAM,CAMR;AAaD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GAAG,KAAK,EACtB,QAAQ,EAAE,MAAM,GACf,MAAM,CAIR;AASD,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,EAC1C,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,WAAW,CAAC,GACzD,OAAO,CAAC,cAAc,CAAC,CAiCzB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,MAAM,GACV;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAKjC"}
package/dist/index.js CHANGED
@@ -269,7 +269,7 @@ function assertStoredKey(key, keyPrefix) {
269
269
  }
270
270
  function objectKeyFileName(fileName) {
271
271
  const sanitized = sanitizeFileName(fileName);
272
- const leaf = sanitized.split("/").filter((part) => part.length > 0).at(-1);
272
+ const leaf = sanitized.split("/").findLast((part) => part.length > 0);
273
273
  if (!leaf || leaf === "." || leaf === "..") return "file";
274
274
  return leaf;
275
275
  }
@@ -361,7 +361,7 @@ function skippedPluginIds(plugins) {
361
361
  const ids = /* @__PURE__ */ new Set();
362
362
  if (!plugins) return ids;
363
363
  for (const [id, enabled] of Object.entries(plugins)) {
364
- if (enabled === false) ids.add(id);
364
+ if (!enabled) ids.add(id);
365
365
  }
366
366
  return ids;
367
367
  }
@@ -599,7 +599,7 @@ async function finalizeConfirmedObject(client, bucket, key, input) {
599
599
  ...stored,
600
600
  contentType: head.ContentType,
601
601
  contentLength,
602
- eTag: head.ETag?.replace(/"/g, ""),
602
+ eTag: head.ETag?.replaceAll('"', ""),
603
603
  metadata,
604
604
  acl,
605
605
  fileName,
@@ -979,7 +979,7 @@ async function handleFile(config, input, request) {
979
979
  new GetObjectCommand({
980
980
  Bucket: bucket,
981
981
  Key: key,
982
- ResponseContentDisposition: fileName ? buildContentDisposition(fileName, disposition) : `${disposition}`
982
+ ResponseContentDisposition: fileName ? buildContentDisposition(fileName, disposition) : disposition
983
983
  })
984
984
  )
985
985
  );
@@ -990,7 +990,7 @@ async function handleFile(config, input, request) {
990
990
  headers.set("Content-Type", result.ContentType ?? "application/octet-stream");
991
991
  headers.set(
992
992
  "Content-Disposition",
993
- fileName ? buildContentDisposition(fileName, disposition) : `${disposition}`
993
+ fileName ? buildContentDisposition(fileName, disposition) : disposition
994
994
  );
995
995
  if (typeof result.ContentLength === "number") {
996
996
  headers.set("Content-Length", String(result.ContentLength));
@@ -1243,7 +1243,7 @@ async function handleListParts(config, input, request) {
1243
1243
  {
1244
1244
  partNumber: p.PartNumber,
1245
1245
  size: p.Size ?? 0,
1246
- eTag: (p.ETag ?? "").replace(/"/g, "")
1246
+ eTag: (p.ETag ?? "").replaceAll('"', "")
1247
1247
  }
1248
1248
  ];
1249
1249
  });