@fluxfiles/node 0.1.3 → 0.1.4
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 +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/index.mjs +4 -0
- package/package.json +1 -1
- package/src/token.ts +6 -0
- package/src/types.ts +8 -0
package/dist/index.d.mts
CHANGED
|
@@ -52,6 +52,14 @@ 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;
|
|
55
63
|
}
|
|
56
64
|
interface CreateTokenOptions extends BaseTokenOptions {
|
|
57
65
|
/** Disk names the token may access. */
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,14 @@ 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;
|
|
55
63
|
}
|
|
56
64
|
interface CreateTokenOptions extends BaseTokenOptions {
|
|
57
65
|
/** Disk names the token may access. */
|
package/dist/index.js
CHANGED
|
@@ -150,6 +150,10 @@ 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);
|
|
153
157
|
}
|
|
154
158
|
function validateByobDisk(name, config) {
|
|
155
159
|
if (!config || config.driver !== "s3") {
|
package/dist/index.mjs
CHANGED
|
@@ -128,6 +128,10 @@ 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);
|
|
131
135
|
}
|
|
132
136
|
function validateByobDisk(name, config) {
|
|
133
137
|
if (!config || config.driver !== "s3") {
|
package/package.json
CHANGED
package/src/token.ts
CHANGED
|
@@ -114,6 +114,12 @@ 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);
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
/**
|
package/src/types.ts
CHANGED
|
@@ -54,6 +54,14 @@ 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;
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
export interface CreateTokenOptions extends BaseTokenOptions {
|