@fluxfiles/node 0.1.10 → 0.1.12

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
@@ -82,6 +82,12 @@ interface BaseTokenOptions {
82
82
  webpMaxWidth?: number;
83
83
  /** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
84
84
  webpDefaultQuality?: number;
85
+ /** Responsive `srcset` width ladder (px); list() emits these as `img_srcset` on images.
86
+ * Snapped to 100px and clamped to webpMaxWidth on decode. Omit to inherit the default
87
+ * `[320, 640, 768, 1024, 1366, 1920]`. */
88
+ srcsetWidths?: number[];
89
+ /** Optional `sizes` attribute surfaced as `img_sizes` (omit to let the host supply its own). */
90
+ srcsetSizes?: string;
85
91
  /** May this token mint clean original download URLs? Default true. `false` = preview-only
86
92
  * (list withholds url/permanent_url/variants; GET presign is denied — only watermarked img_base). */
87
93
  allowDownload?: boolean;
@@ -90,6 +96,14 @@ interface BaseTokenOptions {
90
96
  /** Allow editing a file's text content (GET/PUT /api/fm/content). Default **false** — editing
91
97
  * config/executable files (wp-config.php, .env, nginx.conf, deploy.sh) is powerful, so it's opt-in. */
92
98
  allowCodeEdit?: boolean;
99
+ /** Allow downloading a multi-file/-folder selection as a zip (POST /api/fm/zip). Default true. */
100
+ allowZip?: boolean;
101
+ /** Allow extracting a zip in place (POST /api/fm/extract). Default true. */
102
+ allowExtract?: boolean;
103
+ /** Max total uncompressed size (MB) for a zip/extract. `0`/omitted = inherit (1024). */
104
+ zipMaxMb?: number;
105
+ /** Max file count for a zip/extract. `0`/omitted = inherit (10000). */
106
+ zipMaxFiles?: number;
93
107
  /** Enable on-the-fly watermark on `/api/fm/img` (source file is never modified). Default off. */
94
108
  watermarkEnabled?: boolean;
95
109
  /** Watermark kind: 'text' or 'logo' (a PNG path in storage). Default 'text'. */
package/dist/index.d.ts CHANGED
@@ -82,6 +82,12 @@ interface BaseTokenOptions {
82
82
  webpMaxWidth?: number;
83
83
  /** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
84
84
  webpDefaultQuality?: number;
85
+ /** Responsive `srcset` width ladder (px); list() emits these as `img_srcset` on images.
86
+ * Snapped to 100px and clamped to webpMaxWidth on decode. Omit to inherit the default
87
+ * `[320, 640, 768, 1024, 1366, 1920]`. */
88
+ srcsetWidths?: number[];
89
+ /** Optional `sizes` attribute surfaced as `img_sizes` (omit to let the host supply its own). */
90
+ srcsetSizes?: string;
85
91
  /** May this token mint clean original download URLs? Default true. `false` = preview-only
86
92
  * (list withholds url/permanent_url/variants; GET presign is denied — only watermarked img_base). */
87
93
  allowDownload?: boolean;
@@ -90,6 +96,14 @@ interface BaseTokenOptions {
90
96
  /** Allow editing a file's text content (GET/PUT /api/fm/content). Default **false** — editing
91
97
  * config/executable files (wp-config.php, .env, nginx.conf, deploy.sh) is powerful, so it's opt-in. */
92
98
  allowCodeEdit?: boolean;
99
+ /** Allow downloading a multi-file/-folder selection as a zip (POST /api/fm/zip). Default true. */
100
+ allowZip?: boolean;
101
+ /** Allow extracting a zip in place (POST /api/fm/extract). Default true. */
102
+ allowExtract?: boolean;
103
+ /** Max total uncompressed size (MB) for a zip/extract. `0`/omitted = inherit (1024). */
104
+ zipMaxMb?: number;
105
+ /** Max file count for a zip/extract. `0`/omitted = inherit (10000). */
106
+ zipMaxFiles?: number;
93
107
  /** Enable on-the-fly watermark on `/api/fm/img` (source file is never modified). Default off. */
94
108
  watermarkEnabled?: boolean;
95
109
  /** Watermark kind: 'text' or 'logo' (a PNG path in storage). Default 'text'. */
package/dist/index.js CHANGED
@@ -157,9 +157,15 @@ 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 (Array.isArray(opts.srcsetWidths)) payload.srcset_widths = opts.srcsetWidths.map((w) => Math.trunc(w));
161
+ if (opts.srcsetSizes) payload.srcset_sizes = String(opts.srcsetSizes);
160
162
  if (opts.allowDownload !== void 0) payload.allow_download = !!opts.allowDownload;
161
163
  if (opts.allowChmod !== void 0) payload.allow_chmod = !!opts.allowChmod;
162
164
  if (opts.allowCodeEdit !== void 0) payload.allow_code_edit = !!opts.allowCodeEdit;
165
+ if (opts.allowZip !== void 0) payload.allow_zip = !!opts.allowZip;
166
+ if (opts.allowExtract !== void 0) payload.allow_extract = !!opts.allowExtract;
167
+ if (opts.zipMaxMb && opts.zipMaxMb > 0) payload.zip_max_mb = Math.trunc(opts.zipMaxMb);
168
+ if (opts.zipMaxFiles && opts.zipMaxFiles > 0) payload.zip_max_files = Math.trunc(opts.zipMaxFiles);
163
169
  if (opts.watermarkEnabled) {
164
170
  payload.watermark_enabled = true;
165
171
  if (opts.watermarkType) payload.watermark_type = opts.watermarkType;
package/dist/index.mjs CHANGED
@@ -135,9 +135,15 @@ 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 (Array.isArray(opts.srcsetWidths)) payload.srcset_widths = opts.srcsetWidths.map((w) => Math.trunc(w));
139
+ if (opts.srcsetSizes) payload.srcset_sizes = String(opts.srcsetSizes);
138
140
  if (opts.allowDownload !== void 0) payload.allow_download = !!opts.allowDownload;
139
141
  if (opts.allowChmod !== void 0) payload.allow_chmod = !!opts.allowChmod;
140
142
  if (opts.allowCodeEdit !== void 0) payload.allow_code_edit = !!opts.allowCodeEdit;
143
+ if (opts.allowZip !== void 0) payload.allow_zip = !!opts.allowZip;
144
+ if (opts.allowExtract !== void 0) payload.allow_extract = !!opts.allowExtract;
145
+ if (opts.zipMaxMb && opts.zipMaxMb > 0) payload.zip_max_mb = Math.trunc(opts.zipMaxMb);
146
+ if (opts.zipMaxFiles && opts.zipMaxFiles > 0) payload.zip_max_files = Math.trunc(opts.zipMaxFiles);
141
147
  if (opts.watermarkEnabled) {
142
148
  payload.watermark_enabled = true;
143
149
  if (opts.watermarkType) payload.watermark_type = opts.watermarkType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxfiles/node",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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,11 +125,17 @@ 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
+ if (Array.isArray(opts.srcsetWidths)) payload.srcset_widths = opts.srcsetWidths.map((w) => Math.trunc(w));
129
+ if (opts.srcsetSizes) payload.srcset_sizes = String(opts.srcsetSizes);
128
130
 
129
131
  // Download gate + watermark.
130
132
  if (opts.allowDownload !== undefined) payload.allow_download = !!opts.allowDownload;
131
133
  if (opts.allowChmod !== undefined) payload.allow_chmod = !!opts.allowChmod;
132
134
  if (opts.allowCodeEdit !== undefined) payload.allow_code_edit = !!opts.allowCodeEdit;
135
+ if (opts.allowZip !== undefined) payload.allow_zip = !!opts.allowZip;
136
+ if (opts.allowExtract !== undefined) payload.allow_extract = !!opts.allowExtract;
137
+ if (opts.zipMaxMb && opts.zipMaxMb > 0) payload.zip_max_mb = Math.trunc(opts.zipMaxMb);
138
+ if (opts.zipMaxFiles && opts.zipMaxFiles > 0) payload.zip_max_files = Math.trunc(opts.zipMaxFiles);
133
139
  if (opts.watermarkEnabled) {
134
140
  payload.watermark_enabled = true;
135
141
  if (opts.watermarkType) payload.watermark_type = opts.watermarkType;
package/src/types.ts CHANGED
@@ -86,6 +86,12 @@ export interface BaseTokenOptions {
86
86
  webpMaxWidth?: number;
87
87
  /** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
88
88
  webpDefaultQuality?: number;
89
+ /** Responsive `srcset` width ladder (px); list() emits these as `img_srcset` on images.
90
+ * Snapped to 100px and clamped to webpMaxWidth on decode. Omit to inherit the default
91
+ * `[320, 640, 768, 1024, 1366, 1920]`. */
92
+ srcsetWidths?: number[];
93
+ /** Optional `sizes` attribute surfaced as `img_sizes` (omit to let the host supply its own). */
94
+ srcsetSizes?: string;
89
95
  /** May this token mint clean original download URLs? Default true. `false` = preview-only
90
96
  * (list withholds url/permanent_url/variants; GET presign is denied — only watermarked img_base). */
91
97
  allowDownload?: boolean;
@@ -94,6 +100,14 @@ export interface BaseTokenOptions {
94
100
  /** Allow editing a file's text content (GET/PUT /api/fm/content). Default **false** — editing
95
101
  * config/executable files (wp-config.php, .env, nginx.conf, deploy.sh) is powerful, so it's opt-in. */
96
102
  allowCodeEdit?: boolean;
103
+ /** Allow downloading a multi-file/-folder selection as a zip (POST /api/fm/zip). Default true. */
104
+ allowZip?: boolean;
105
+ /** Allow extracting a zip in place (POST /api/fm/extract). Default true. */
106
+ allowExtract?: boolean;
107
+ /** Max total uncompressed size (MB) for a zip/extract. `0`/omitted = inherit (1024). */
108
+ zipMaxMb?: number;
109
+ /** Max file count for a zip/extract. `0`/omitted = inherit (10000). */
110
+ zipMaxFiles?: number;
97
111
  /** Enable on-the-fly watermark on `/api/fm/img` (source file is never modified). Default off. */
98
112
  watermarkEnabled?: boolean;
99
113
  /** Watermark kind: 'text' or 'logo' (a PNG path in storage). Default 'text'. */