@scalemule/nextjs 0.1.5 → 0.1.6
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 +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +8 -0
- package/dist/index.mjs +8 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -185,12 +185,43 @@ interface MediaUploadResult {
|
|
|
185
185
|
/** Whether the resulting storage object is public-readable. */
|
|
186
186
|
is_public: boolean;
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Per-app media-pipeline policy. Drives release-gating + processing
|
|
190
|
+
* behavior. **Orthogonal to `is_public`.** See
|
|
191
|
+
* `docs/MEDIA-UPLOADS.md` and ADR-2026-04-26 for the full taxonomy.
|
|
192
|
+
*
|
|
193
|
+
* Today's behavior (Phase 4 v1):
|
|
194
|
+
* - `fast_trusted` / `safe_visible` (default): upload promise resolves
|
|
195
|
+
* as soon as the file is uploaded + registered. The post-processing
|
|
196
|
+
* (scan, optimize, transcode) runs async; callers can observe via
|
|
197
|
+
* `useFileStatus`.
|
|
198
|
+
* - `safe_public` / `moderated`: upload promise *waits* for the
|
|
199
|
+
* optimized image variant (image MIME) or HLS playlist (video MIME)
|
|
200
|
+
* to become ready before resolving. Acts as the release-gate for
|
|
201
|
+
* UGC-style apps that should not publish raw bytes.
|
|
202
|
+
* - `compliance`: today behaves as `safe_public`; Phase 4+ adds the
|
|
203
|
+
* audit-log + signed-with-purpose URL semantics.
|
|
204
|
+
*/
|
|
205
|
+
type MediaPolicy = 'fast_trusted' | 'safe_visible' | 'safe_public' | 'moderated' | 'compliance';
|
|
188
206
|
interface UseMediaUploadOptions {
|
|
189
207
|
/** Whether the resulting storage object should be public-readable.
|
|
190
208
|
* Default: `false` (private). Public is opt-in for surfaces that
|
|
191
209
|
* genuinely need it (avatars, public listings). Chat / DM uploads
|
|
192
210
|
* should always be private. */
|
|
193
211
|
is_public?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Per-call media-policy override. Defaults to `safe_visible` (visible
|
|
214
|
+
* immediately at original fidelity; optimized variants swap in async).
|
|
215
|
+
* Set to `safe_public` to make the upload promise *await* the optimized
|
|
216
|
+
* variant (image) or HLS playlist (video) before resolving — useful for
|
|
217
|
+
* broadcast / UGC apps that gate publication on processing complete.
|
|
218
|
+
*
|
|
219
|
+
* The per-app default lives in `application_storage_settings.media_policy`
|
|
220
|
+
* (Phase 4 / P3, live in prod 2026-04-26). Reading the per-app default
|
|
221
|
+
* into `useMedia` defaults lands in a follow-up; today the option is
|
|
222
|
+
* caller-provided per call.
|
|
223
|
+
*/
|
|
224
|
+
policy?: MediaPolicy;
|
|
194
225
|
/** Display filename (sanitized server-side). */
|
|
195
226
|
filename?: string;
|
|
196
227
|
/** Custom metadata attached to the file. */
|
|
@@ -895,4 +926,4 @@ declare function createSafeLogger(prefix: string): {
|
|
|
895
926
|
error: (message: string, data?: unknown) => void;
|
|
896
927
|
};
|
|
897
928
|
|
|
898
|
-
export { ApiError, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, type FeedbackItem, type FeedbackItemInput, type FeedbackPriority, type FeedbackStatus, type FeedbackType, FeedbackWidget, type FeedbackWidgetConfig, type FeedbackWidgetProps, ListFilesParams, LoginResponse, type MediaUploadResult, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, type ScaleMuleMediaProps, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeedbackOptions, type UseFeedbackResult, type UseFileStatusOptions, type UseFileStatusReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseMediaReturn, type UseMediaUploadOptions, type UsePushNotificationsOptions, type UsePushNotificationsReturn, type UseRealtimeOptions, type UseRealtimeReturn, type UseShareOptions, type UseShareReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useFeedback, useFileStatus, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useUser, validateForm, validators };
|
|
929
|
+
export { ApiError, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, type FeedbackItem, type FeedbackItemInput, type FeedbackPriority, type FeedbackStatus, type FeedbackType, FeedbackWidget, type FeedbackWidgetConfig, type FeedbackWidgetProps, ListFilesParams, LoginResponse, type MediaPolicy, type MediaUploadResult, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, type ScaleMuleMediaProps, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeedbackOptions, type UseFeedbackResult, type UseFileStatusOptions, type UseFileStatusReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseMediaReturn, type UseMediaUploadOptions, type UsePushNotificationsOptions, type UsePushNotificationsReturn, type UseRealtimeOptions, type UseRealtimeReturn, type UseShareOptions, type UseShareReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useFeedback, useFileStatus, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useUser, validateForm, validators };
|
package/dist/index.d.ts
CHANGED
|
@@ -185,12 +185,43 @@ interface MediaUploadResult {
|
|
|
185
185
|
/** Whether the resulting storage object is public-readable. */
|
|
186
186
|
is_public: boolean;
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Per-app media-pipeline policy. Drives release-gating + processing
|
|
190
|
+
* behavior. **Orthogonal to `is_public`.** See
|
|
191
|
+
* `docs/MEDIA-UPLOADS.md` and ADR-2026-04-26 for the full taxonomy.
|
|
192
|
+
*
|
|
193
|
+
* Today's behavior (Phase 4 v1):
|
|
194
|
+
* - `fast_trusted` / `safe_visible` (default): upload promise resolves
|
|
195
|
+
* as soon as the file is uploaded + registered. The post-processing
|
|
196
|
+
* (scan, optimize, transcode) runs async; callers can observe via
|
|
197
|
+
* `useFileStatus`.
|
|
198
|
+
* - `safe_public` / `moderated`: upload promise *waits* for the
|
|
199
|
+
* optimized image variant (image MIME) or HLS playlist (video MIME)
|
|
200
|
+
* to become ready before resolving. Acts as the release-gate for
|
|
201
|
+
* UGC-style apps that should not publish raw bytes.
|
|
202
|
+
* - `compliance`: today behaves as `safe_public`; Phase 4+ adds the
|
|
203
|
+
* audit-log + signed-with-purpose URL semantics.
|
|
204
|
+
*/
|
|
205
|
+
type MediaPolicy = 'fast_trusted' | 'safe_visible' | 'safe_public' | 'moderated' | 'compliance';
|
|
188
206
|
interface UseMediaUploadOptions {
|
|
189
207
|
/** Whether the resulting storage object should be public-readable.
|
|
190
208
|
* Default: `false` (private). Public is opt-in for surfaces that
|
|
191
209
|
* genuinely need it (avatars, public listings). Chat / DM uploads
|
|
192
210
|
* should always be private. */
|
|
193
211
|
is_public?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Per-call media-policy override. Defaults to `safe_visible` (visible
|
|
214
|
+
* immediately at original fidelity; optimized variants swap in async).
|
|
215
|
+
* Set to `safe_public` to make the upload promise *await* the optimized
|
|
216
|
+
* variant (image) or HLS playlist (video) before resolving — useful for
|
|
217
|
+
* broadcast / UGC apps that gate publication on processing complete.
|
|
218
|
+
*
|
|
219
|
+
* The per-app default lives in `application_storage_settings.media_policy`
|
|
220
|
+
* (Phase 4 / P3, live in prod 2026-04-26). Reading the per-app default
|
|
221
|
+
* into `useMedia` defaults lands in a follow-up; today the option is
|
|
222
|
+
* caller-provided per call.
|
|
223
|
+
*/
|
|
224
|
+
policy?: MediaPolicy;
|
|
194
225
|
/** Display filename (sanitized server-side). */
|
|
195
226
|
filename?: string;
|
|
196
227
|
/** Custom metadata attached to the file. */
|
|
@@ -895,4 +926,4 @@ declare function createSafeLogger(prefix: string): {
|
|
|
895
926
|
error: (message: string, data?: unknown) => void;
|
|
896
927
|
};
|
|
897
928
|
|
|
898
|
-
export { ApiError, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, type FeedbackItem, type FeedbackItemInput, type FeedbackPriority, type FeedbackStatus, type FeedbackType, FeedbackWidget, type FeedbackWidgetConfig, type FeedbackWidgetProps, ListFilesParams, LoginResponse, type MediaUploadResult, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, type ScaleMuleMediaProps, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeedbackOptions, type UseFeedbackResult, type UseFileStatusOptions, type UseFileStatusReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseMediaReturn, type UseMediaUploadOptions, type UsePushNotificationsOptions, type UsePushNotificationsReturn, type UseRealtimeOptions, type UseRealtimeReturn, type UseShareOptions, type UseShareReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useFeedback, useFileStatus, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useUser, validateForm, validators };
|
|
929
|
+
export { ApiError, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, type FeedbackItem, type FeedbackItemInput, type FeedbackPriority, type FeedbackStatus, type FeedbackType, FeedbackWidget, type FeedbackWidgetConfig, type FeedbackWidgetProps, ListFilesParams, LoginResponse, type MediaPolicy, type MediaUploadResult, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, type ScaleMuleMediaProps, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeedbackOptions, type UseFeedbackResult, type UseFileStatusOptions, type UseFileStatusReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseMediaReturn, type UseMediaUploadOptions, type UsePushNotificationsOptions, type UsePushNotificationsReturn, type UseRealtimeOptions, type UseRealtimeReturn, type UseShareOptions, type UseShareReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useFeedback, useFileStatus, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useUser, validateForm, validators };
|
package/dist/index.js
CHANGED
|
@@ -8906,6 +8906,8 @@ function useMedia() {
|
|
|
8906
8906
|
setError(null);
|
|
8907
8907
|
const isPublic = options?.is_public ?? false;
|
|
8908
8908
|
const mimeType = file.type || "application/octet-stream";
|
|
8909
|
+
const policy = options?.policy ?? "safe_visible";
|
|
8910
|
+
const gateOnPipeline = policy === "safe_public" || policy === "moderated" || policy === "compliance";
|
|
8909
8911
|
const sharedOpts = {
|
|
8910
8912
|
filename: options?.filename,
|
|
8911
8913
|
metadata: options?.metadata,
|
|
@@ -8918,6 +8920,9 @@ function useMedia() {
|
|
|
8918
8920
|
if (r2.error || !r2.data) {
|
|
8919
8921
|
throw r2.error ?? { code: "upload_error", message: "Upload failed", status: 0 };
|
|
8920
8922
|
}
|
|
8923
|
+
if (gateOnPipeline) {
|
|
8924
|
+
await r2.data.optimized_url_promise;
|
|
8925
|
+
}
|
|
8921
8926
|
return {
|
|
8922
8927
|
file_id: r2.data.file_id,
|
|
8923
8928
|
photo_id: r2.data.photo_id,
|
|
@@ -8933,6 +8938,9 @@ function useMedia() {
|
|
|
8933
8938
|
if (r2.error || !r2.data) {
|
|
8934
8939
|
throw r2.error ?? { code: "upload_error", message: "Upload failed", status: 0 };
|
|
8935
8940
|
}
|
|
8941
|
+
if (gateOnPipeline) {
|
|
8942
|
+
await r2.data.hls_url_promise;
|
|
8943
|
+
}
|
|
8936
8944
|
return {
|
|
8937
8945
|
file_id: r2.data.file_id,
|
|
8938
8946
|
photo_id: null,
|
package/dist/index.mjs
CHANGED
|
@@ -8886,6 +8886,8 @@ function useMedia() {
|
|
|
8886
8886
|
setError(null);
|
|
8887
8887
|
const isPublic = options?.is_public ?? false;
|
|
8888
8888
|
const mimeType = file.type || "application/octet-stream";
|
|
8889
|
+
const policy = options?.policy ?? "safe_visible";
|
|
8890
|
+
const gateOnPipeline = policy === "safe_public" || policy === "moderated" || policy === "compliance";
|
|
8889
8891
|
const sharedOpts = {
|
|
8890
8892
|
filename: options?.filename,
|
|
8891
8893
|
metadata: options?.metadata,
|
|
@@ -8898,6 +8900,9 @@ function useMedia() {
|
|
|
8898
8900
|
if (r2.error || !r2.data) {
|
|
8899
8901
|
throw r2.error ?? { code: "upload_error", message: "Upload failed", status: 0 };
|
|
8900
8902
|
}
|
|
8903
|
+
if (gateOnPipeline) {
|
|
8904
|
+
await r2.data.optimized_url_promise;
|
|
8905
|
+
}
|
|
8901
8906
|
return {
|
|
8902
8907
|
file_id: r2.data.file_id,
|
|
8903
8908
|
photo_id: r2.data.photo_id,
|
|
@@ -8913,6 +8918,9 @@ function useMedia() {
|
|
|
8913
8918
|
if (r2.error || !r2.data) {
|
|
8914
8919
|
throw r2.error ?? { code: "upload_error", message: "Upload failed", status: 0 };
|
|
8915
8920
|
}
|
|
8921
|
+
if (gateOnPipeline) {
|
|
8922
|
+
await r2.data.hls_url_promise;
|
|
8923
|
+
}
|
|
8916
8924
|
return {
|
|
8917
8925
|
file_id: r2.data.file_id,
|
|
8918
8926
|
photo_id: null,
|
package/package.json
CHANGED