@vryzel/file-next 0.4.4 → 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/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { b as FileSystemConfig, C as CreateFileSystemOptions, a as FileSystem, S as S3CompatibleAdapter, c as S3Key, R as Result, M as MetadataStore } from './filesystem-CewcaWEl.cjs';
2
- export { d as CopyInput, e as CopyOutput, f as CreateNodeInput, g as Credentials, D as DeleteInput, h as DeleteNodeInput, i as DeleteOutput, E as ExistsInput, j as ExistsOutput, F as FileNode, G as GetMetadataInput, k as GetMetadataOutput, l as GetNodeInput, m as GetPathInput, n as GetPathOutput, o as GetPublicUrlInput, p as GetPublicUrlOutput, L as ListChildrenInput, q as ListChildrenOutput, r as ListInput, s as ListOutput, t as MoveInput, u as MoveNodeInput, v as MoveOutput, N as NodeKind, P as Path, w as Prefix, x as PresignedDownloadInput, y as PresignedDownloadOutput, z as PresignedUploadInput, A as PresignedUploadOutput, B as R2Config, H as ReadInput, I as ReadOutput, J as ReconcileResult, K as S3Config, O as SearchInput, Q as SetMetadataInput, V as SetMetadataOutput, W as StatInput, X as StatOutput, T as TenantId, Y as UpdateMetadataInput, U as UserId, Z as WriteInput, _ as WriteOutput, $ as andThen, a0 as asPath, a1 as asPrefix, a2 as asS3Key, a3 as asTenantId, a4 as asUserId, a5 as assertPath, a6 as assertPrefix, a7 as assertS3Key, a8 as assertTenantId, a9 as assertUserId, aa as err, ab as map, ac as mapErr, ad as ok, ae as parseFileSystemConfig, af as unwrap, ag as unwrapOr } from './filesystem-CewcaWEl.cjs';
1
+ import { b as FileSystemConfig, C as CreateFileSystemOptions, a as FileSystem, S as S3CompatibleAdapter, c as S3Key, R as Result, M as MetadataStore } from './filesystem-C0vVDtg4.cjs';
2
+ export { d as CopyInput, e as CopyOutput, f as CreateNodeInput, g as Credentials, D as DeleteInput, h as DeleteNodeInput, i as DeleteOutput, E as ExistsInput, j as ExistsOutput, F as FileNode, G as GetMetadataInput, k as GetMetadataOutput, l as GetNodeInput, m as GetPathInput, n as GetPathOutput, o as GetPublicUrlInput, p as GetPublicUrlOutput, L as ListChildrenInput, q as ListChildrenOutput, r as ListInput, s as ListOutput, t as MoveInput, u as MoveNodeInput, v as MoveOutput, N as NodeKind, P as Path, w as Prefix, x as PresignedDownloadInput, y as PresignedDownloadOutput, z as PresignedUploadInput, A as PresignedUploadOutput, B as R2Config, H as ReadInput, I as ReadOutput, J as ReconcileResult, K as S3Config, O as SearchInput, Q as SetMetadataInput, V as SetMetadataOutput, W as StatInput, X as StatOutput, T as TenantId, Y as UpdateMetadataInput, U as UserId, Z as WriteInput, _ as WriteOutput, $ as andThen, a0 as asPath, a1 as asPrefix, a2 as asS3Key, a3 as asTenantId, a4 as asUserId, a5 as assertPath, a6 as assertPrefix, a7 as assertS3Key, a8 as assertTenantId, a9 as assertUserId, aa as err, ab as map, ac as mapErr, ad as ok, ae as parseFileSystemConfig, af as unwrap, ag as unwrapOr } from './filesystem-C0vVDtg4.cjs';
3
3
  import { FileSystemError } from './errors/index.cjs';
4
4
  export { FILE_SYSTEM_ERROR_CODES, FileSystemErrorCode, FileSystemErrorJson, FileSystemErrorOptions, RETRYABLE_BY_CODE, fromAws, fromPg, fromSqlite } from './errors/index.cjs';
5
5
  import { ClassValue } from 'clsx';
6
- export { A as AuthContext, w as withAuth } from './with-auth-DDTngJoQ.cjs';
6
+ export { A as AuthContext, w as withAuth } from './with-auth-Dtn57B_S.cjs';
7
7
  import 'zod';
8
8
 
9
9
  /**
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { b as FileSystemConfig, C as CreateFileSystemOptions, a as FileSystem, S as S3CompatibleAdapter, c as S3Key, R as Result, M as MetadataStore } from './filesystem-B0bJh8bW.js';
2
- export { d as CopyInput, e as CopyOutput, f as CreateNodeInput, g as Credentials, D as DeleteInput, h as DeleteNodeInput, i as DeleteOutput, E as ExistsInput, j as ExistsOutput, F as FileNode, G as GetMetadataInput, k as GetMetadataOutput, l as GetNodeInput, m as GetPathInput, n as GetPathOutput, o as GetPublicUrlInput, p as GetPublicUrlOutput, L as ListChildrenInput, q as ListChildrenOutput, r as ListInput, s as ListOutput, t as MoveInput, u as MoveNodeInput, v as MoveOutput, N as NodeKind, P as Path, w as Prefix, x as PresignedDownloadInput, y as PresignedDownloadOutput, z as PresignedUploadInput, A as PresignedUploadOutput, B as R2Config, H as ReadInput, I as ReadOutput, J as ReconcileResult, K as S3Config, O as SearchInput, Q as SetMetadataInput, V as SetMetadataOutput, W as StatInput, X as StatOutput, T as TenantId, Y as UpdateMetadataInput, U as UserId, Z as WriteInput, _ as WriteOutput, $ as andThen, a0 as asPath, a1 as asPrefix, a2 as asS3Key, a3 as asTenantId, a4 as asUserId, a5 as assertPath, a6 as assertPrefix, a7 as assertS3Key, a8 as assertTenantId, a9 as assertUserId, aa as err, ab as map, ac as mapErr, ad as ok, ae as parseFileSystemConfig, af as unwrap, ag as unwrapOr } from './filesystem-B0bJh8bW.js';
1
+ import { b as FileSystemConfig, C as CreateFileSystemOptions, a as FileSystem, S as S3CompatibleAdapter, c as S3Key, R as Result, M as MetadataStore } from './filesystem-Djiiu6YU.js';
2
+ export { d as CopyInput, e as CopyOutput, f as CreateNodeInput, g as Credentials, D as DeleteInput, h as DeleteNodeInput, i as DeleteOutput, E as ExistsInput, j as ExistsOutput, F as FileNode, G as GetMetadataInput, k as GetMetadataOutput, l as GetNodeInput, m as GetPathInput, n as GetPathOutput, o as GetPublicUrlInput, p as GetPublicUrlOutput, L as ListChildrenInput, q as ListChildrenOutput, r as ListInput, s as ListOutput, t as MoveInput, u as MoveNodeInput, v as MoveOutput, N as NodeKind, P as Path, w as Prefix, x as PresignedDownloadInput, y as PresignedDownloadOutput, z as PresignedUploadInput, A as PresignedUploadOutput, B as R2Config, H as ReadInput, I as ReadOutput, J as ReconcileResult, K as S3Config, O as SearchInput, Q as SetMetadataInput, V as SetMetadataOutput, W as StatInput, X as StatOutput, T as TenantId, Y as UpdateMetadataInput, U as UserId, Z as WriteInput, _ as WriteOutput, $ as andThen, a0 as asPath, a1 as asPrefix, a2 as asS3Key, a3 as asTenantId, a4 as asUserId, a5 as assertPath, a6 as assertPrefix, a7 as assertS3Key, a8 as assertTenantId, a9 as assertUserId, aa as err, ab as map, ac as mapErr, ad as ok, ae as parseFileSystemConfig, af as unwrap, ag as unwrapOr } from './filesystem-Djiiu6YU.js';
3
3
  import { FileSystemError } from './errors/index.js';
4
4
  export { FILE_SYSTEM_ERROR_CODES, FileSystemErrorCode, FileSystemErrorJson, FileSystemErrorOptions, RETRYABLE_BY_CODE, fromAws, fromPg, fromSqlite } from './errors/index.js';
5
5
  import { ClassValue } from 'clsx';
6
- export { A as AuthContext, w as withAuth } from './with-auth-f82V2WB6.js';
6
+ export { A as AuthContext, w as withAuth } from './with-auth-OZNiZGga.js';
7
7
  import 'zod';
8
8
 
9
9
  /**
package/dist/index.js CHANGED
@@ -3058,6 +3058,20 @@ var setMetadata = async (client, config, input) => {
3058
3058
  return err(fromAws(e));
3059
3059
  }
3060
3060
  };
3061
+
3062
+ // src/storage/content-disposition.ts
3063
+ var NEVER_INLINE = /* @__PURE__ */ new Set(["text/html", "application/xhtml+xml", "image/svg+xml"]);
3064
+ function signedContentDisposition(requested, contentType) {
3065
+ if (requested !== "inline") return "attachment";
3066
+ const mime = (contentType ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
3067
+ if (!mime || NEVER_INLINE.has(mime)) return "attachment";
3068
+ if (mime === "application/pdf" || mime === "text/plain" || mime === "text/csv" || mime === "text/markdown" || mime.startsWith("image/") || mime.startsWith("video/") || mime.startsWith("audio/")) {
3069
+ return "inline";
3070
+ }
3071
+ return "attachment";
3072
+ }
3073
+
3074
+ // src/storage/s3-adapter/presigned.ts
3061
3075
  var createPresignedUploadUrl = async (client, config, input) => {
3062
3076
  try {
3063
3077
  const cmd = new PutObjectCommand({
@@ -3075,7 +3089,8 @@ var createPresignedDownloadUrl = async (client, config, input) => {
3075
3089
  try {
3076
3090
  const cmd = new GetObjectCommand({
3077
3091
  Bucket: config.bucket,
3078
- Key: input.key
3092
+ Key: input.key,
3093
+ ResponseContentDisposition: signedContentDisposition(input.disposition, input.contentType)
3079
3094
  });
3080
3095
  const url = await getSignedUrl(client, cmd, { expiresIn: input.expiresIn ?? 900 });
3081
3096
  return ok({ url });