@fluxfiles/node 0.1.5 → 0.1.7

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.mts CHANGED
@@ -66,6 +66,33 @@ interface BaseTokenOptions {
66
66
  webpMaxWidth?: number;
67
67
  /** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
68
68
  webpDefaultQuality?: number;
69
+ /** May this token mint clean original download URLs? Default true. `false` = preview-only
70
+ * (list withholds url/permanent_url/variants; GET presign is denied — only watermarked img_base). */
71
+ allowDownload?: boolean;
72
+ /** Enable on-the-fly watermark on `/api/fm/img` (source file is never modified). Default off. */
73
+ watermarkEnabled?: boolean;
74
+ /** Watermark kind: 'text' or 'logo' (a PNG path in storage). Default 'text'. */
75
+ watermarkType?: 'text' | 'logo';
76
+ /** Watermark text (for type 'text'). */
77
+ watermarkText?: string;
78
+ /** Storage path to the logo PNG (for type 'logo'); missing → text fallback. */
79
+ watermarkLogoPath?: string;
80
+ /** Position: top-left / top-right / bottom-left / bottom-right / center. Default bottom-right. */
81
+ watermarkPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
82
+ /** Opacity 0.0–1.0. Default 0.6. */
83
+ watermarkOpacity?: number;
84
+ /** Font size for text watermark. Default 24. */
85
+ watermarkFontSize?: number;
86
+ /** Usage-summary cache TTL (seconds). `0`/omitted = inherit (900). */
87
+ usageCacheTtl?: number;
88
+ /** Percent at which quota status becomes "warning". `0`/omitted = inherit (70). */
89
+ usageWarningThreshold?: number;
90
+ /** Percent at which quota status becomes "critical". `0`/omitted = inherit (90). */
91
+ usageCriticalThreshold?: number;
92
+ /** Number of largest folders the usage dashboard returns. `0`/omitted = inherit (10). */
93
+ usageTopFoldersCount?: number;
94
+ /** Folder grouping depth for the usage breakdown. `0`/omitted = inherit (1). */
95
+ usageFolderDepth?: number;
69
96
  }
70
97
  interface CreateTokenOptions extends BaseTokenOptions {
71
98
  /** Disk names the token may access. */
package/dist/index.d.ts CHANGED
@@ -66,6 +66,33 @@ interface BaseTokenOptions {
66
66
  webpMaxWidth?: number;
67
67
  /** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
68
68
  webpDefaultQuality?: number;
69
+ /** May this token mint clean original download URLs? Default true. `false` = preview-only
70
+ * (list withholds url/permanent_url/variants; GET presign is denied — only watermarked img_base). */
71
+ allowDownload?: boolean;
72
+ /** Enable on-the-fly watermark on `/api/fm/img` (source file is never modified). Default off. */
73
+ watermarkEnabled?: boolean;
74
+ /** Watermark kind: 'text' or 'logo' (a PNG path in storage). Default 'text'. */
75
+ watermarkType?: 'text' | 'logo';
76
+ /** Watermark text (for type 'text'). */
77
+ watermarkText?: string;
78
+ /** Storage path to the logo PNG (for type 'logo'); missing → text fallback. */
79
+ watermarkLogoPath?: string;
80
+ /** Position: top-left / top-right / bottom-left / bottom-right / center. Default bottom-right. */
81
+ watermarkPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
82
+ /** Opacity 0.0–1.0. Default 0.6. */
83
+ watermarkOpacity?: number;
84
+ /** Font size for text watermark. Default 24. */
85
+ watermarkFontSize?: number;
86
+ /** Usage-summary cache TTL (seconds). `0`/omitted = inherit (900). */
87
+ usageCacheTtl?: number;
88
+ /** Percent at which quota status becomes "warning". `0`/omitted = inherit (70). */
89
+ usageWarningThreshold?: number;
90
+ /** Percent at which quota status becomes "critical". `0`/omitted = inherit (90). */
91
+ usageCriticalThreshold?: number;
92
+ /** Number of largest folders the usage dashboard returns. `0`/omitted = inherit (10). */
93
+ usageTopFoldersCount?: number;
94
+ /** Folder grouping depth for the usage breakdown. `0`/omitted = inherit (1). */
95
+ usageFolderDepth?: number;
69
96
  }
70
97
  interface CreateTokenOptions extends BaseTokenOptions {
71
98
  /** Disk names the token may access. */
package/dist/index.js CHANGED
@@ -157,6 +157,21 @@ function applyTenantOverrides(payload, opts) {
157
157
  if (opts.webpEnabled !== void 0) payload.webp_enabled = !!opts.webpEnabled;
158
158
  if (opts.webpMaxWidth && opts.webpMaxWidth > 0) payload.webp_max_width = Math.trunc(opts.webpMaxWidth);
159
159
  if (opts.webpDefaultQuality && opts.webpDefaultQuality > 0) payload.webp_default_quality = Math.trunc(opts.webpDefaultQuality);
160
+ if (opts.allowDownload !== void 0) payload.allow_download = !!opts.allowDownload;
161
+ if (opts.watermarkEnabled) {
162
+ payload.watermark_enabled = true;
163
+ if (opts.watermarkType) payload.watermark_type = opts.watermarkType;
164
+ if (opts.watermarkText) payload.watermark_text = String(opts.watermarkText);
165
+ if (opts.watermarkLogoPath) payload.watermark_logo_path = String(opts.watermarkLogoPath);
166
+ if (opts.watermarkPosition) payload.watermark_position = opts.watermarkPosition;
167
+ if (opts.watermarkOpacity !== void 0) payload.watermark_opacity = opts.watermarkOpacity;
168
+ if (opts.watermarkFontSize && opts.watermarkFontSize > 0) payload.watermark_font_size = Math.trunc(opts.watermarkFontSize);
169
+ }
170
+ if (opts.usageCacheTtl && opts.usageCacheTtl > 0) payload.usage_cache_ttl = Math.trunc(opts.usageCacheTtl);
171
+ if (opts.usageWarningThreshold && opts.usageWarningThreshold > 0) payload.usage_warning_threshold = Math.trunc(opts.usageWarningThreshold);
172
+ if (opts.usageCriticalThreshold && opts.usageCriticalThreshold > 0) payload.usage_critical_threshold = Math.trunc(opts.usageCriticalThreshold);
173
+ if (opts.usageTopFoldersCount && opts.usageTopFoldersCount > 0) payload.usage_top_folders_count = Math.trunc(opts.usageTopFoldersCount);
174
+ if (opts.usageFolderDepth && opts.usageFolderDepth > 0) payload.usage_folder_depth = Math.trunc(opts.usageFolderDepth);
160
175
  }
161
176
  function validateByobDisk(name, config) {
162
177
  if (!config || config.driver !== "s3") {
package/dist/index.mjs CHANGED
@@ -135,6 +135,21 @@ function applyTenantOverrides(payload, opts) {
135
135
  if (opts.webpEnabled !== void 0) payload.webp_enabled = !!opts.webpEnabled;
136
136
  if (opts.webpMaxWidth && opts.webpMaxWidth > 0) payload.webp_max_width = Math.trunc(opts.webpMaxWidth);
137
137
  if (opts.webpDefaultQuality && opts.webpDefaultQuality > 0) payload.webp_default_quality = Math.trunc(opts.webpDefaultQuality);
138
+ if (opts.allowDownload !== void 0) payload.allow_download = !!opts.allowDownload;
139
+ if (opts.watermarkEnabled) {
140
+ payload.watermark_enabled = true;
141
+ if (opts.watermarkType) payload.watermark_type = opts.watermarkType;
142
+ if (opts.watermarkText) payload.watermark_text = String(opts.watermarkText);
143
+ if (opts.watermarkLogoPath) payload.watermark_logo_path = String(opts.watermarkLogoPath);
144
+ if (opts.watermarkPosition) payload.watermark_position = opts.watermarkPosition;
145
+ if (opts.watermarkOpacity !== void 0) payload.watermark_opacity = opts.watermarkOpacity;
146
+ if (opts.watermarkFontSize && opts.watermarkFontSize > 0) payload.watermark_font_size = Math.trunc(opts.watermarkFontSize);
147
+ }
148
+ if (opts.usageCacheTtl && opts.usageCacheTtl > 0) payload.usage_cache_ttl = Math.trunc(opts.usageCacheTtl);
149
+ if (opts.usageWarningThreshold && opts.usageWarningThreshold > 0) payload.usage_warning_threshold = Math.trunc(opts.usageWarningThreshold);
150
+ if (opts.usageCriticalThreshold && opts.usageCriticalThreshold > 0) payload.usage_critical_threshold = Math.trunc(opts.usageCriticalThreshold);
151
+ if (opts.usageTopFoldersCount && opts.usageTopFoldersCount > 0) payload.usage_top_folders_count = Math.trunc(opts.usageTopFoldersCount);
152
+ if (opts.usageFolderDepth && opts.usageFolderDepth > 0) payload.usage_folder_depth = Math.trunc(opts.usageFolderDepth);
138
153
  }
139
154
  function validateByobDisk(name, config) {
140
155
  if (!config || config.driver !== "s3") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxfiles/node",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Server-side Node/TypeScript SDK for minting FluxFiles JWTs (plain + BYOB), byte-compatible with the PHP core",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
package/src/token.ts CHANGED
@@ -125,6 +125,25 @@ function applyTenantOverrides(payload: Record<string, unknown>, opts: BaseTokenO
125
125
  if (opts.webpEnabled !== undefined) payload.webp_enabled = !!opts.webpEnabled;
126
126
  if (opts.webpMaxWidth && opts.webpMaxWidth > 0) payload.webp_max_width = Math.trunc(opts.webpMaxWidth);
127
127
  if (opts.webpDefaultQuality && opts.webpDefaultQuality > 0) payload.webp_default_quality = Math.trunc(opts.webpDefaultQuality);
128
+
129
+ // Download gate + watermark.
130
+ if (opts.allowDownload !== undefined) payload.allow_download = !!opts.allowDownload;
131
+ if (opts.watermarkEnabled) {
132
+ payload.watermark_enabled = true;
133
+ if (opts.watermarkType) payload.watermark_type = opts.watermarkType;
134
+ if (opts.watermarkText) payload.watermark_text = String(opts.watermarkText);
135
+ if (opts.watermarkLogoPath) payload.watermark_logo_path = String(opts.watermarkLogoPath);
136
+ if (opts.watermarkPosition) payload.watermark_position = opts.watermarkPosition;
137
+ if (opts.watermarkOpacity !== undefined) payload.watermark_opacity = opts.watermarkOpacity;
138
+ if (opts.watermarkFontSize && opts.watermarkFontSize > 0) payload.watermark_font_size = Math.trunc(opts.watermarkFontSize);
139
+ }
140
+
141
+ // Usage-dashboard claims.
142
+ if (opts.usageCacheTtl && opts.usageCacheTtl > 0) payload.usage_cache_ttl = Math.trunc(opts.usageCacheTtl);
143
+ if (opts.usageWarningThreshold && opts.usageWarningThreshold > 0) payload.usage_warning_threshold = Math.trunc(opts.usageWarningThreshold);
144
+ if (opts.usageCriticalThreshold && opts.usageCriticalThreshold > 0) payload.usage_critical_threshold = Math.trunc(opts.usageCriticalThreshold);
145
+ if (opts.usageTopFoldersCount && opts.usageTopFoldersCount > 0) payload.usage_top_folders_count = Math.trunc(opts.usageTopFoldersCount);
146
+ if (opts.usageFolderDepth && opts.usageFolderDepth > 0) payload.usage_folder_depth = Math.trunc(opts.usageFolderDepth);
128
147
  }
129
148
 
130
149
  /**
package/src/types.ts CHANGED
@@ -68,6 +68,33 @@ export interface BaseTokenOptions {
68
68
  webpMaxWidth?: number;
69
69
  /** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
70
70
  webpDefaultQuality?: number;
71
+ /** May this token mint clean original download URLs? Default true. `false` = preview-only
72
+ * (list withholds url/permanent_url/variants; GET presign is denied — only watermarked img_base). */
73
+ allowDownload?: boolean;
74
+ /** Enable on-the-fly watermark on `/api/fm/img` (source file is never modified). Default off. */
75
+ watermarkEnabled?: boolean;
76
+ /** Watermark kind: 'text' or 'logo' (a PNG path in storage). Default 'text'. */
77
+ watermarkType?: 'text' | 'logo';
78
+ /** Watermark text (for type 'text'). */
79
+ watermarkText?: string;
80
+ /** Storage path to the logo PNG (for type 'logo'); missing → text fallback. */
81
+ watermarkLogoPath?: string;
82
+ /** Position: top-left / top-right / bottom-left / bottom-right / center. Default bottom-right. */
83
+ watermarkPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
84
+ /** Opacity 0.0–1.0. Default 0.6. */
85
+ watermarkOpacity?: number;
86
+ /** Font size for text watermark. Default 24. */
87
+ watermarkFontSize?: number;
88
+ /** Usage-summary cache TTL (seconds). `0`/omitted = inherit (900). */
89
+ usageCacheTtl?: number;
90
+ /** Percent at which quota status becomes "warning". `0`/omitted = inherit (70). */
91
+ usageWarningThreshold?: number;
92
+ /** Percent at which quota status becomes "critical". `0`/omitted = inherit (90). */
93
+ usageCriticalThreshold?: number;
94
+ /** Number of largest folders the usage dashboard returns. `0`/omitted = inherit (10). */
95
+ usageTopFoldersCount?: number;
96
+ /** Folder grouping depth for the usage breakdown. `0`/omitted = inherit (1). */
97
+ usageFolderDepth?: number;
71
98
  }
72
99
 
73
100
  export interface CreateTokenOptions extends BaseTokenOptions {