@fluxfiles/node 0.1.3 → 0.1.5
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 +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +7 -0
- package/dist/index.mjs +7 -0
- package/package.json +1 -1
- package/src/token.ts +11 -0
- package/src/types.ts +14 -0
package/dist/index.d.mts
CHANGED
|
@@ -52,6 +52,20 @@ interface BaseTokenOptions {
|
|
|
52
52
|
/** Import-specific rate limit (req/min) and max concurrent imports. `0`/omitted = inherit. */
|
|
53
53
|
importRateLimit?: number;
|
|
54
54
|
importConcurrency?: number;
|
|
55
|
+
/** Enable inline video/audio preview for this tenant. Omit to inherit the default (true). */
|
|
56
|
+
mediaPreview?: boolean;
|
|
57
|
+
/** Presigned media-URL TTL (seconds) — longer so a long video doesn't expire mid-play. `0`/omitted = inherit (7200). */
|
|
58
|
+
previewUrlTtl?: number;
|
|
59
|
+
/** Max file size (MB) eligible for inline preview; larger media shows a download placeholder. `0`/omitted = inherit (500). */
|
|
60
|
+
maxPreviewMb?: number;
|
|
61
|
+
/** TTL (seconds) for per-file gated-local stream tokens. `0`/omitted = inherit (3600). */
|
|
62
|
+
streamTokenTtl?: number;
|
|
63
|
+
/** Expose the on-demand WebP endpoint (`/api/fm/img`) for images. Omit to inherit the default (true). */
|
|
64
|
+
webpEnabled?: boolean;
|
|
65
|
+
/** Max resize width (px) a transform request may ask for. `0`/omitted = inherit (2000). */
|
|
66
|
+
webpMaxWidth?: number;
|
|
67
|
+
/** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
|
|
68
|
+
webpDefaultQuality?: number;
|
|
55
69
|
}
|
|
56
70
|
interface CreateTokenOptions extends BaseTokenOptions {
|
|
57
71
|
/** Disk names the token may access. */
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,20 @@ interface BaseTokenOptions {
|
|
|
52
52
|
/** Import-specific rate limit (req/min) and max concurrent imports. `0`/omitted = inherit. */
|
|
53
53
|
importRateLimit?: number;
|
|
54
54
|
importConcurrency?: number;
|
|
55
|
+
/** Enable inline video/audio preview for this tenant. Omit to inherit the default (true). */
|
|
56
|
+
mediaPreview?: boolean;
|
|
57
|
+
/** Presigned media-URL TTL (seconds) — longer so a long video doesn't expire mid-play. `0`/omitted = inherit (7200). */
|
|
58
|
+
previewUrlTtl?: number;
|
|
59
|
+
/** Max file size (MB) eligible for inline preview; larger media shows a download placeholder. `0`/omitted = inherit (500). */
|
|
60
|
+
maxPreviewMb?: number;
|
|
61
|
+
/** TTL (seconds) for per-file gated-local stream tokens. `0`/omitted = inherit (3600). */
|
|
62
|
+
streamTokenTtl?: number;
|
|
63
|
+
/** Expose the on-demand WebP endpoint (`/api/fm/img`) for images. Omit to inherit the default (true). */
|
|
64
|
+
webpEnabled?: boolean;
|
|
65
|
+
/** Max resize width (px) a transform request may ask for. `0`/omitted = inherit (2000). */
|
|
66
|
+
webpMaxWidth?: number;
|
|
67
|
+
/** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
|
|
68
|
+
webpDefaultQuality?: number;
|
|
55
69
|
}
|
|
56
70
|
interface CreateTokenOptions extends BaseTokenOptions {
|
|
57
71
|
/** Disk names the token may access. */
|
package/dist/index.js
CHANGED
|
@@ -150,6 +150,13 @@ function applyTenantOverrides(payload, opts) {
|
|
|
150
150
|
if (Array.isArray(opts.importUrlAllowlist) && opts.importUrlAllowlist.length) {
|
|
151
151
|
payload.import_url_allowlist = opts.importUrlAllowlist.map((h) => String(h));
|
|
152
152
|
}
|
|
153
|
+
if (opts.mediaPreview !== void 0) payload.media_preview = !!opts.mediaPreview;
|
|
154
|
+
if (opts.previewUrlTtl && opts.previewUrlTtl > 0) payload.preview_url_ttl = Math.trunc(opts.previewUrlTtl);
|
|
155
|
+
if (opts.maxPreviewMb && opts.maxPreviewMb > 0) payload.max_preview_mb = Math.trunc(opts.maxPreviewMb);
|
|
156
|
+
if (opts.streamTokenTtl && opts.streamTokenTtl > 0) payload.stream_token_ttl = Math.trunc(opts.streamTokenTtl);
|
|
157
|
+
if (opts.webpEnabled !== void 0) payload.webp_enabled = !!opts.webpEnabled;
|
|
158
|
+
if (opts.webpMaxWidth && opts.webpMaxWidth > 0) payload.webp_max_width = Math.trunc(opts.webpMaxWidth);
|
|
159
|
+
if (opts.webpDefaultQuality && opts.webpDefaultQuality > 0) payload.webp_default_quality = Math.trunc(opts.webpDefaultQuality);
|
|
153
160
|
}
|
|
154
161
|
function validateByobDisk(name, config) {
|
|
155
162
|
if (!config || config.driver !== "s3") {
|
package/dist/index.mjs
CHANGED
|
@@ -128,6 +128,13 @@ function applyTenantOverrides(payload, opts) {
|
|
|
128
128
|
if (Array.isArray(opts.importUrlAllowlist) && opts.importUrlAllowlist.length) {
|
|
129
129
|
payload.import_url_allowlist = opts.importUrlAllowlist.map((h) => String(h));
|
|
130
130
|
}
|
|
131
|
+
if (opts.mediaPreview !== void 0) payload.media_preview = !!opts.mediaPreview;
|
|
132
|
+
if (opts.previewUrlTtl && opts.previewUrlTtl > 0) payload.preview_url_ttl = Math.trunc(opts.previewUrlTtl);
|
|
133
|
+
if (opts.maxPreviewMb && opts.maxPreviewMb > 0) payload.max_preview_mb = Math.trunc(opts.maxPreviewMb);
|
|
134
|
+
if (opts.streamTokenTtl && opts.streamTokenTtl > 0) payload.stream_token_ttl = Math.trunc(opts.streamTokenTtl);
|
|
135
|
+
if (opts.webpEnabled !== void 0) payload.webp_enabled = !!opts.webpEnabled;
|
|
136
|
+
if (opts.webpMaxWidth && opts.webpMaxWidth > 0) payload.webp_max_width = Math.trunc(opts.webpMaxWidth);
|
|
137
|
+
if (opts.webpDefaultQuality && opts.webpDefaultQuality > 0) payload.webp_default_quality = Math.trunc(opts.webpDefaultQuality);
|
|
131
138
|
}
|
|
132
139
|
function validateByobDisk(name, config) {
|
|
133
140
|
if (!config || config.driver !== "s3") {
|
package/package.json
CHANGED
package/src/token.ts
CHANGED
|
@@ -114,6 +114,17 @@ function applyTenantOverrides(payload: Record<string, unknown>, opts: BaseTokenO
|
|
|
114
114
|
if (Array.isArray(opts.importUrlAllowlist) && opts.importUrlAllowlist.length) {
|
|
115
115
|
payload.import_url_allowlist = opts.importUrlAllowlist.map((h) => String(h));
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
// Media-preview claims (the server sanitizes/clamps these on decode).
|
|
119
|
+
if (opts.mediaPreview !== undefined) payload.media_preview = !!opts.mediaPreview;
|
|
120
|
+
if (opts.previewUrlTtl && opts.previewUrlTtl > 0) payload.preview_url_ttl = Math.trunc(opts.previewUrlTtl);
|
|
121
|
+
if (opts.maxPreviewMb && opts.maxPreviewMb > 0) payload.max_preview_mb = Math.trunc(opts.maxPreviewMb);
|
|
122
|
+
if (opts.streamTokenTtl && opts.streamTokenTtl > 0) payload.stream_token_ttl = Math.trunc(opts.streamTokenTtl);
|
|
123
|
+
|
|
124
|
+
// On-demand WebP claims.
|
|
125
|
+
if (opts.webpEnabled !== undefined) payload.webp_enabled = !!opts.webpEnabled;
|
|
126
|
+
if (opts.webpMaxWidth && opts.webpMaxWidth > 0) payload.webp_max_width = Math.trunc(opts.webpMaxWidth);
|
|
127
|
+
if (opts.webpDefaultQuality && opts.webpDefaultQuality > 0) payload.webp_default_quality = Math.trunc(opts.webpDefaultQuality);
|
|
117
128
|
}
|
|
118
129
|
|
|
119
130
|
/**
|
package/src/types.ts
CHANGED
|
@@ -54,6 +54,20 @@ export interface BaseTokenOptions {
|
|
|
54
54
|
/** Import-specific rate limit (req/min) and max concurrent imports. `0`/omitted = inherit. */
|
|
55
55
|
importRateLimit?: number;
|
|
56
56
|
importConcurrency?: number;
|
|
57
|
+
/** Enable inline video/audio preview for this tenant. Omit to inherit the default (true). */
|
|
58
|
+
mediaPreview?: boolean;
|
|
59
|
+
/** Presigned media-URL TTL (seconds) — longer so a long video doesn't expire mid-play. `0`/omitted = inherit (7200). */
|
|
60
|
+
previewUrlTtl?: number;
|
|
61
|
+
/** Max file size (MB) eligible for inline preview; larger media shows a download placeholder. `0`/omitted = inherit (500). */
|
|
62
|
+
maxPreviewMb?: number;
|
|
63
|
+
/** TTL (seconds) for per-file gated-local stream tokens. `0`/omitted = inherit (3600). */
|
|
64
|
+
streamTokenTtl?: number;
|
|
65
|
+
/** Expose the on-demand WebP endpoint (`/api/fm/img`) for images. Omit to inherit the default (true). */
|
|
66
|
+
webpEnabled?: boolean;
|
|
67
|
+
/** Max resize width (px) a transform request may ask for. `0`/omitted = inherit (2000). */
|
|
68
|
+
webpMaxWidth?: number;
|
|
69
|
+
/** Default WebP quality when a request omits it. `0`/omitted = inherit (80). */
|
|
70
|
+
webpDefaultQuality?: number;
|
|
57
71
|
}
|
|
58
72
|
|
|
59
73
|
export interface CreateTokenOptions extends BaseTokenOptions {
|