@scalemule/sdk 0.0.41 → 0.0.43
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 +115 -1
- package/dist/index.d.ts +115 -1
- package/dist/index.js +90 -0
- package/dist/index.mjs +89 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1122,6 +1122,29 @@ interface SignedUrlResponse {
|
|
|
1122
1122
|
url: string;
|
|
1123
1123
|
expires_at: string;
|
|
1124
1124
|
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Per-app media-pipeline policy. Drives release-gating + processing
|
|
1127
|
+
* behavior. Orthogonal to `is_public`. Five modes — see
|
|
1128
|
+
* `docs/MEDIA-UPLOADS.md` and ADR-2026-04-26 for the full taxonomy.
|
|
1129
|
+
*/
|
|
1130
|
+
type MediaPolicy = 'fast_trusted' | 'safe_visible' | 'safe_public' | 'moderated' | 'compliance';
|
|
1131
|
+
/** Content-type allow/block policy for uploads. */
|
|
1132
|
+
interface ContentPolicy {
|
|
1133
|
+
mode: 'allow' | 'block' | 'none';
|
|
1134
|
+
allowed_types?: string[];
|
|
1135
|
+
blocked_extensions?: string[];
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Per-app storage + media settings. Returned by {@link StorageService.getSettings}
|
|
1139
|
+
* and accepted by {@link StorageService.updateSettings}.
|
|
1140
|
+
*/
|
|
1141
|
+
interface StorageSettings {
|
|
1142
|
+
content_policy?: ContentPolicy;
|
|
1143
|
+
media_policy?: MediaPolicy;
|
|
1144
|
+
default_retention_hours?: number | null;
|
|
1145
|
+
max_retention_hours?: number | null;
|
|
1146
|
+
max_file_size_bytes?: number | null;
|
|
1147
|
+
}
|
|
1125
1148
|
/**
|
|
1126
1149
|
* Aggregate file status — returned by {@link StorageService.getFileStatus}.
|
|
1127
1150
|
*
|
|
@@ -1240,6 +1263,21 @@ declare class StorageService extends ServiceModule {
|
|
|
1240
1263
|
}>>;
|
|
1241
1264
|
/** Get file metadata (no signed URL). */
|
|
1242
1265
|
getInfo(fileId: string, options?: RequestOptions): Promise<ApiResponse<FileInfo>>;
|
|
1266
|
+
/**
|
|
1267
|
+
* Get the calling app's storage + media settings — content policy,
|
|
1268
|
+
* retention, max upload size, and the per-app `media_policy`.
|
|
1269
|
+
*
|
|
1270
|
+
* `media_policy` drives release-gating in the SDK upload helpers:
|
|
1271
|
+
* `fast_trusted` / `safe_visible` resolve immediately on upload; the
|
|
1272
|
+
* `safe_public` / `moderated` / `compliance` modes await pipeline
|
|
1273
|
+
* completion before resolving the upload promise.
|
|
1274
|
+
*/
|
|
1275
|
+
getSettings(options?: RequestOptions): Promise<ApiResponse<StorageSettings>>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Update the calling app's storage + media settings. Admin-only on the
|
|
1278
|
+
* platform side (callers without the right role get 403).
|
|
1279
|
+
*/
|
|
1280
|
+
updateSettings(settings: StorageSettings, options?: RequestOptions): Promise<ApiResponse<StorageSettings>>;
|
|
1243
1281
|
/**
|
|
1244
1282
|
* Aggregate status for a file — single call returns scan + reserved
|
|
1245
1283
|
* optimize/transcode slots + the canonical view URL paths for image
|
|
@@ -4556,6 +4594,81 @@ declare class PhotoService extends ServiceModule {
|
|
|
4556
4594
|
getPhoto(id: string): Promise<ApiResponse<PhotoInfo>>;
|
|
4557
4595
|
}
|
|
4558
4596
|
|
|
4597
|
+
/**
|
|
4598
|
+
* Audio service — typed wrapper over `/v1/audios`.
|
|
4599
|
+
*
|
|
4600
|
+
* Phase 5 MVP scope:
|
|
4601
|
+
* - `uploadViaStorage()` — presigned-direct-to-S3 upload + register flow,
|
|
4602
|
+
* mirrors `photo.uploadViaStorage()` and `video.uploadViaStorage()`.
|
|
4603
|
+
* - `register()` — explicitly register an already-uploaded storage file
|
|
4604
|
+
* with the audio service so it gets typed metadata + ownership.
|
|
4605
|
+
*
|
|
4606
|
+
* Out of scope today (future phases): waveform peaks, codec normalization,
|
|
4607
|
+
* derivative transcoding profiles. The audio service stores metadata; the
|
|
4608
|
+
* actual bytes live in scalemule-storage and are served via the storage
|
|
4609
|
+
* view URL. Once the audio worker ships, this service will gain a
|
|
4610
|
+
* `transcoded_url_promise` field analogous to photo's
|
|
4611
|
+
* `optimized_url_promise`.
|
|
4612
|
+
*/
|
|
4613
|
+
|
|
4614
|
+
/** Result of {@link AudioService.register}. */
|
|
4615
|
+
interface AudioRegisterResult {
|
|
4616
|
+
/** Audio service id. `audio_id == file_id` invariant holds. */
|
|
4617
|
+
audio_id: string;
|
|
4618
|
+
/** Storage file_id (same as `audio_id`). */
|
|
4619
|
+
file_id: string;
|
|
4620
|
+
/** `'ready'` once the audio row exists. The audio service's pipeline
|
|
4621
|
+
* is metadata-only today; bytes are immediately playable via the
|
|
4622
|
+
* storage view URL. */
|
|
4623
|
+
status: 'ready' | 'processing' | 'failed';
|
|
4624
|
+
}
|
|
4625
|
+
/** Result of {@link AudioService.uploadViaStorage}. */
|
|
4626
|
+
interface AudioUploadViaStorageResult {
|
|
4627
|
+
/** Storage file_id. */
|
|
4628
|
+
file_id: string;
|
|
4629
|
+
/** Audio service id (== file_id). `null` when register failed but the
|
|
4630
|
+
* storage upload succeeded — the file is still usable as a generic
|
|
4631
|
+
* private file. */
|
|
4632
|
+
audio_id: string | null;
|
|
4633
|
+
/** Short-lived signed URL to the original bytes. Usable immediately. */
|
|
4634
|
+
original_view_url: string | null;
|
|
4635
|
+
}
|
|
4636
|
+
declare class AudioService extends ServiceModule {
|
|
4637
|
+
private readonly storage;
|
|
4638
|
+
protected basePath: string;
|
|
4639
|
+
/**
|
|
4640
|
+
* @param storage Required for {@link uploadViaStorage}. Wired up by the
|
|
4641
|
+
* top-level {@link ScaleMule} constructor — most call sites should not
|
|
4642
|
+
* instantiate `AudioService` directly.
|
|
4643
|
+
*/
|
|
4644
|
+
constructor(client: ScaleMuleClient, storage: StorageService);
|
|
4645
|
+
/**
|
|
4646
|
+
* Register a storage-uploaded audio asset with the audio service.
|
|
4647
|
+
* Idempotent — re-calling with the same `file_id` returns the existing
|
|
4648
|
+
* record.
|
|
4649
|
+
*/
|
|
4650
|
+
register(args: {
|
|
4651
|
+
fileId: string;
|
|
4652
|
+
userId?: string;
|
|
4653
|
+
}, options?: RequestOptions): Promise<ApiResponse<AudioRegisterResult>>;
|
|
4654
|
+
/**
|
|
4655
|
+
* Upload a file to storage (browser → S3 direct, private, uncompressed)
|
|
4656
|
+
* and register it with the audio service.
|
|
4657
|
+
*
|
|
4658
|
+
* Mirrors `photo.uploadViaStorage()` / `video.uploadViaStorage()`. If
|
|
4659
|
+
* `register()` fails after a successful storage upload, the file is *not*
|
|
4660
|
+
* lost — the returned `file_id` is still valid as a generic private storage
|
|
4661
|
+
* file. The SDK logs a warning and returns `audio_id: null`.
|
|
4662
|
+
*/
|
|
4663
|
+
uploadViaStorage(file: File | Blob, uploadOptions?: {
|
|
4664
|
+
userId?: string;
|
|
4665
|
+
filename?: string;
|
|
4666
|
+
metadata?: Record<string, unknown>;
|
|
4667
|
+
onProgress?: (progress: number) => void;
|
|
4668
|
+
signal?: AbortSignal;
|
|
4669
|
+
}, requestOptions?: RequestOptions): Promise<ApiResponse<AudioUploadViaStorageResult>>;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4559
4672
|
/**
|
|
4560
4673
|
* Queue Service Module
|
|
4561
4674
|
*
|
|
@@ -6280,6 +6393,7 @@ declare class ScaleMule {
|
|
|
6280
6393
|
readonly graph: GraphService;
|
|
6281
6394
|
readonly functions: FunctionsService;
|
|
6282
6395
|
readonly photo: PhotoService;
|
|
6396
|
+
readonly audio: AudioService;
|
|
6283
6397
|
readonly flagContent: FlagContentService;
|
|
6284
6398
|
readonly creatorMaker: CreatorMakerService;
|
|
6285
6399
|
readonly compliance: ComplianceService;
|
|
@@ -6354,4 +6468,4 @@ declare class ScaleMule {
|
|
|
6354
6468
|
getClient(): ScaleMuleClient;
|
|
6355
6469
|
}
|
|
6356
6470
|
|
|
6357
|
-
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, extractClientContext, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
|
6471
|
+
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, type MediaPolicy, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, extractClientContext, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
package/dist/index.d.ts
CHANGED
|
@@ -1122,6 +1122,29 @@ interface SignedUrlResponse {
|
|
|
1122
1122
|
url: string;
|
|
1123
1123
|
expires_at: string;
|
|
1124
1124
|
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Per-app media-pipeline policy. Drives release-gating + processing
|
|
1127
|
+
* behavior. Orthogonal to `is_public`. Five modes — see
|
|
1128
|
+
* `docs/MEDIA-UPLOADS.md` and ADR-2026-04-26 for the full taxonomy.
|
|
1129
|
+
*/
|
|
1130
|
+
type MediaPolicy = 'fast_trusted' | 'safe_visible' | 'safe_public' | 'moderated' | 'compliance';
|
|
1131
|
+
/** Content-type allow/block policy for uploads. */
|
|
1132
|
+
interface ContentPolicy {
|
|
1133
|
+
mode: 'allow' | 'block' | 'none';
|
|
1134
|
+
allowed_types?: string[];
|
|
1135
|
+
blocked_extensions?: string[];
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Per-app storage + media settings. Returned by {@link StorageService.getSettings}
|
|
1139
|
+
* and accepted by {@link StorageService.updateSettings}.
|
|
1140
|
+
*/
|
|
1141
|
+
interface StorageSettings {
|
|
1142
|
+
content_policy?: ContentPolicy;
|
|
1143
|
+
media_policy?: MediaPolicy;
|
|
1144
|
+
default_retention_hours?: number | null;
|
|
1145
|
+
max_retention_hours?: number | null;
|
|
1146
|
+
max_file_size_bytes?: number | null;
|
|
1147
|
+
}
|
|
1125
1148
|
/**
|
|
1126
1149
|
* Aggregate file status — returned by {@link StorageService.getFileStatus}.
|
|
1127
1150
|
*
|
|
@@ -1240,6 +1263,21 @@ declare class StorageService extends ServiceModule {
|
|
|
1240
1263
|
}>>;
|
|
1241
1264
|
/** Get file metadata (no signed URL). */
|
|
1242
1265
|
getInfo(fileId: string, options?: RequestOptions): Promise<ApiResponse<FileInfo>>;
|
|
1266
|
+
/**
|
|
1267
|
+
* Get the calling app's storage + media settings — content policy,
|
|
1268
|
+
* retention, max upload size, and the per-app `media_policy`.
|
|
1269
|
+
*
|
|
1270
|
+
* `media_policy` drives release-gating in the SDK upload helpers:
|
|
1271
|
+
* `fast_trusted` / `safe_visible` resolve immediately on upload; the
|
|
1272
|
+
* `safe_public` / `moderated` / `compliance` modes await pipeline
|
|
1273
|
+
* completion before resolving the upload promise.
|
|
1274
|
+
*/
|
|
1275
|
+
getSettings(options?: RequestOptions): Promise<ApiResponse<StorageSettings>>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Update the calling app's storage + media settings. Admin-only on the
|
|
1278
|
+
* platform side (callers without the right role get 403).
|
|
1279
|
+
*/
|
|
1280
|
+
updateSettings(settings: StorageSettings, options?: RequestOptions): Promise<ApiResponse<StorageSettings>>;
|
|
1243
1281
|
/**
|
|
1244
1282
|
* Aggregate status for a file — single call returns scan + reserved
|
|
1245
1283
|
* optimize/transcode slots + the canonical view URL paths for image
|
|
@@ -4556,6 +4594,81 @@ declare class PhotoService extends ServiceModule {
|
|
|
4556
4594
|
getPhoto(id: string): Promise<ApiResponse<PhotoInfo>>;
|
|
4557
4595
|
}
|
|
4558
4596
|
|
|
4597
|
+
/**
|
|
4598
|
+
* Audio service — typed wrapper over `/v1/audios`.
|
|
4599
|
+
*
|
|
4600
|
+
* Phase 5 MVP scope:
|
|
4601
|
+
* - `uploadViaStorage()` — presigned-direct-to-S3 upload + register flow,
|
|
4602
|
+
* mirrors `photo.uploadViaStorage()` and `video.uploadViaStorage()`.
|
|
4603
|
+
* - `register()` — explicitly register an already-uploaded storage file
|
|
4604
|
+
* with the audio service so it gets typed metadata + ownership.
|
|
4605
|
+
*
|
|
4606
|
+
* Out of scope today (future phases): waveform peaks, codec normalization,
|
|
4607
|
+
* derivative transcoding profiles. The audio service stores metadata; the
|
|
4608
|
+
* actual bytes live in scalemule-storage and are served via the storage
|
|
4609
|
+
* view URL. Once the audio worker ships, this service will gain a
|
|
4610
|
+
* `transcoded_url_promise` field analogous to photo's
|
|
4611
|
+
* `optimized_url_promise`.
|
|
4612
|
+
*/
|
|
4613
|
+
|
|
4614
|
+
/** Result of {@link AudioService.register}. */
|
|
4615
|
+
interface AudioRegisterResult {
|
|
4616
|
+
/** Audio service id. `audio_id == file_id` invariant holds. */
|
|
4617
|
+
audio_id: string;
|
|
4618
|
+
/** Storage file_id (same as `audio_id`). */
|
|
4619
|
+
file_id: string;
|
|
4620
|
+
/** `'ready'` once the audio row exists. The audio service's pipeline
|
|
4621
|
+
* is metadata-only today; bytes are immediately playable via the
|
|
4622
|
+
* storage view URL. */
|
|
4623
|
+
status: 'ready' | 'processing' | 'failed';
|
|
4624
|
+
}
|
|
4625
|
+
/** Result of {@link AudioService.uploadViaStorage}. */
|
|
4626
|
+
interface AudioUploadViaStorageResult {
|
|
4627
|
+
/** Storage file_id. */
|
|
4628
|
+
file_id: string;
|
|
4629
|
+
/** Audio service id (== file_id). `null` when register failed but the
|
|
4630
|
+
* storage upload succeeded — the file is still usable as a generic
|
|
4631
|
+
* private file. */
|
|
4632
|
+
audio_id: string | null;
|
|
4633
|
+
/** Short-lived signed URL to the original bytes. Usable immediately. */
|
|
4634
|
+
original_view_url: string | null;
|
|
4635
|
+
}
|
|
4636
|
+
declare class AudioService extends ServiceModule {
|
|
4637
|
+
private readonly storage;
|
|
4638
|
+
protected basePath: string;
|
|
4639
|
+
/**
|
|
4640
|
+
* @param storage Required for {@link uploadViaStorage}. Wired up by the
|
|
4641
|
+
* top-level {@link ScaleMule} constructor — most call sites should not
|
|
4642
|
+
* instantiate `AudioService` directly.
|
|
4643
|
+
*/
|
|
4644
|
+
constructor(client: ScaleMuleClient, storage: StorageService);
|
|
4645
|
+
/**
|
|
4646
|
+
* Register a storage-uploaded audio asset with the audio service.
|
|
4647
|
+
* Idempotent — re-calling with the same `file_id` returns the existing
|
|
4648
|
+
* record.
|
|
4649
|
+
*/
|
|
4650
|
+
register(args: {
|
|
4651
|
+
fileId: string;
|
|
4652
|
+
userId?: string;
|
|
4653
|
+
}, options?: RequestOptions): Promise<ApiResponse<AudioRegisterResult>>;
|
|
4654
|
+
/**
|
|
4655
|
+
* Upload a file to storage (browser → S3 direct, private, uncompressed)
|
|
4656
|
+
* and register it with the audio service.
|
|
4657
|
+
*
|
|
4658
|
+
* Mirrors `photo.uploadViaStorage()` / `video.uploadViaStorage()`. If
|
|
4659
|
+
* `register()` fails after a successful storage upload, the file is *not*
|
|
4660
|
+
* lost — the returned `file_id` is still valid as a generic private storage
|
|
4661
|
+
* file. The SDK logs a warning and returns `audio_id: null`.
|
|
4662
|
+
*/
|
|
4663
|
+
uploadViaStorage(file: File | Blob, uploadOptions?: {
|
|
4664
|
+
userId?: string;
|
|
4665
|
+
filename?: string;
|
|
4666
|
+
metadata?: Record<string, unknown>;
|
|
4667
|
+
onProgress?: (progress: number) => void;
|
|
4668
|
+
signal?: AbortSignal;
|
|
4669
|
+
}, requestOptions?: RequestOptions): Promise<ApiResponse<AudioUploadViaStorageResult>>;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4559
4672
|
/**
|
|
4560
4673
|
* Queue Service Module
|
|
4561
4674
|
*
|
|
@@ -6280,6 +6393,7 @@ declare class ScaleMule {
|
|
|
6280
6393
|
readonly graph: GraphService;
|
|
6281
6394
|
readonly functions: FunctionsService;
|
|
6282
6395
|
readonly photo: PhotoService;
|
|
6396
|
+
readonly audio: AudioService;
|
|
6283
6397
|
readonly flagContent: FlagContentService;
|
|
6284
6398
|
readonly creatorMaker: CreatorMakerService;
|
|
6285
6399
|
readonly compliance: ComplianceService;
|
|
@@ -6354,4 +6468,4 @@ declare class ScaleMule {
|
|
|
6354
6468
|
getClient(): ScaleMuleClient;
|
|
6355
6469
|
}
|
|
6356
6470
|
|
|
6357
|
-
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, extractClientContext, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
|
6471
|
+
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, type MediaPolicy, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, extractClientContext, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
package/dist/index.js
CHANGED
|
@@ -301,6 +301,7 @@ __export(index_exports, {
|
|
|
301
301
|
AgentToolsService: () => AgentToolsService,
|
|
302
302
|
AgentsService: () => AgentsService,
|
|
303
303
|
AnalyticsService: () => AnalyticsService,
|
|
304
|
+
AudioService: () => AudioService,
|
|
304
305
|
AuthService: () => AuthService,
|
|
305
306
|
BillingService: () => BillingService,
|
|
306
307
|
CacheService: () => CacheService,
|
|
@@ -2943,6 +2944,25 @@ var StorageService = class extends ServiceModule {
|
|
|
2943
2944
|
async getInfo(fileId, options) {
|
|
2944
2945
|
return this._get(`/files/${fileId}/info`, options);
|
|
2945
2946
|
}
|
|
2947
|
+
/**
|
|
2948
|
+
* Get the calling app's storage + media settings — content policy,
|
|
2949
|
+
* retention, max upload size, and the per-app `media_policy`.
|
|
2950
|
+
*
|
|
2951
|
+
* `media_policy` drives release-gating in the SDK upload helpers:
|
|
2952
|
+
* `fast_trusted` / `safe_visible` resolve immediately on upload; the
|
|
2953
|
+
* `safe_public` / `moderated` / `compliance` modes await pipeline
|
|
2954
|
+
* completion before resolving the upload promise.
|
|
2955
|
+
*/
|
|
2956
|
+
async getSettings(options) {
|
|
2957
|
+
return this._get("/settings", options);
|
|
2958
|
+
}
|
|
2959
|
+
/**
|
|
2960
|
+
* Update the calling app's storage + media settings. Admin-only on the
|
|
2961
|
+
* platform side (callers without the right role get 403).
|
|
2962
|
+
*/
|
|
2963
|
+
async updateSettings(settings, options) {
|
|
2964
|
+
return this.put("/settings", settings, options);
|
|
2965
|
+
}
|
|
2946
2966
|
/**
|
|
2947
2967
|
* Aggregate status for a file — single call returns scan + reserved
|
|
2948
2968
|
* optimize/transcode slots + the canonical view URL paths for image
|
|
@@ -6457,6 +6477,74 @@ var PhotoService = class extends ServiceModule {
|
|
|
6457
6477
|
}
|
|
6458
6478
|
};
|
|
6459
6479
|
|
|
6480
|
+
// src/services/audio.ts
|
|
6481
|
+
var AudioService = class extends ServiceModule {
|
|
6482
|
+
/**
|
|
6483
|
+
* @param storage Required for {@link uploadViaStorage}. Wired up by the
|
|
6484
|
+
* top-level {@link ScaleMule} constructor — most call sites should not
|
|
6485
|
+
* instantiate `AudioService` directly.
|
|
6486
|
+
*/
|
|
6487
|
+
constructor(client, storage) {
|
|
6488
|
+
super(client);
|
|
6489
|
+
this.storage = storage;
|
|
6490
|
+
this.basePath = "/v1/audios";
|
|
6491
|
+
}
|
|
6492
|
+
/**
|
|
6493
|
+
* Register a storage-uploaded audio asset with the audio service.
|
|
6494
|
+
* Idempotent — re-calling with the same `file_id` returns the existing
|
|
6495
|
+
* record.
|
|
6496
|
+
*/
|
|
6497
|
+
async register(args, options) {
|
|
6498
|
+
return this.post("/register", { file_id: args.fileId, sm_user_id: args.userId }, options);
|
|
6499
|
+
}
|
|
6500
|
+
/**
|
|
6501
|
+
* Upload a file to storage (browser → S3 direct, private, uncompressed)
|
|
6502
|
+
* and register it with the audio service.
|
|
6503
|
+
*
|
|
6504
|
+
* Mirrors `photo.uploadViaStorage()` / `video.uploadViaStorage()`. If
|
|
6505
|
+
* `register()` fails after a successful storage upload, the file is *not*
|
|
6506
|
+
* lost — the returned `file_id` is still valid as a generic private storage
|
|
6507
|
+
* file. The SDK logs a warning and returns `audio_id: null`.
|
|
6508
|
+
*/
|
|
6509
|
+
async uploadViaStorage(file, uploadOptions, requestOptions) {
|
|
6510
|
+
const uploadResult = await this.storage.uploadPrivate(file, {
|
|
6511
|
+
filename: uploadOptions?.filename,
|
|
6512
|
+
metadata: uploadOptions?.metadata,
|
|
6513
|
+
onProgress: uploadOptions?.onProgress,
|
|
6514
|
+
signal: uploadOptions?.signal
|
|
6515
|
+
});
|
|
6516
|
+
if (uploadResult.error || !uploadResult.data) {
|
|
6517
|
+
return { data: null, error: uploadResult.error };
|
|
6518
|
+
}
|
|
6519
|
+
const fileInfo = uploadResult.data;
|
|
6520
|
+
const fileId = fileInfo.id;
|
|
6521
|
+
const originalViewUrl = fileInfo.url ?? null;
|
|
6522
|
+
const registerResult = await this.register({ fileId, userId: uploadOptions?.userId }, requestOptions);
|
|
6523
|
+
if (registerResult.error || !registerResult.data) {
|
|
6524
|
+
console.warn(
|
|
6525
|
+
"[scalemule-sdk] audio.register() failed after storage upload; typed audio metadata unavailable.",
|
|
6526
|
+
registerResult.error
|
|
6527
|
+
);
|
|
6528
|
+
return {
|
|
6529
|
+
data: {
|
|
6530
|
+
file_id: fileId,
|
|
6531
|
+
audio_id: null,
|
|
6532
|
+
original_view_url: originalViewUrl
|
|
6533
|
+
},
|
|
6534
|
+
error: null
|
|
6535
|
+
};
|
|
6536
|
+
}
|
|
6537
|
+
return {
|
|
6538
|
+
data: {
|
|
6539
|
+
file_id: fileId,
|
|
6540
|
+
audio_id: registerResult.data.audio_id,
|
|
6541
|
+
original_view_url: originalViewUrl
|
|
6542
|
+
},
|
|
6543
|
+
error: null
|
|
6544
|
+
};
|
|
6545
|
+
}
|
|
6546
|
+
};
|
|
6547
|
+
|
|
6460
6548
|
// src/services/queue.ts
|
|
6461
6549
|
var DeadLetterApi = class extends ServiceModule {
|
|
6462
6550
|
constructor() {
|
|
@@ -7307,6 +7395,7 @@ var ScaleMule = class {
|
|
|
7307
7395
|
this.graph = new GraphService(this._client);
|
|
7308
7396
|
this.functions = new FunctionsService(this._client);
|
|
7309
7397
|
this.photo = new PhotoService(this._client, this.storage);
|
|
7398
|
+
this.audio = new AudioService(this._client, this.storage);
|
|
7310
7399
|
this.flagContent = new FlagContentService(this._client);
|
|
7311
7400
|
this.creatorMaker = new CreatorMakerService(this._client);
|
|
7312
7401
|
this.compliance = new ComplianceService(this._client);
|
|
@@ -7450,6 +7539,7 @@ var index_default = ScaleMule;
|
|
|
7450
7539
|
AgentToolsService,
|
|
7451
7540
|
AgentsService,
|
|
7452
7541
|
AnalyticsService,
|
|
7542
|
+
AudioService,
|
|
7453
7543
|
AuthService,
|
|
7454
7544
|
BillingService,
|
|
7455
7545
|
CacheService,
|
package/dist/index.mjs
CHANGED
|
@@ -2574,6 +2574,25 @@ var StorageService = class extends ServiceModule {
|
|
|
2574
2574
|
async getInfo(fileId, options) {
|
|
2575
2575
|
return this._get(`/files/${fileId}/info`, options);
|
|
2576
2576
|
}
|
|
2577
|
+
/**
|
|
2578
|
+
* Get the calling app's storage + media settings — content policy,
|
|
2579
|
+
* retention, max upload size, and the per-app `media_policy`.
|
|
2580
|
+
*
|
|
2581
|
+
* `media_policy` drives release-gating in the SDK upload helpers:
|
|
2582
|
+
* `fast_trusted` / `safe_visible` resolve immediately on upload; the
|
|
2583
|
+
* `safe_public` / `moderated` / `compliance` modes await pipeline
|
|
2584
|
+
* completion before resolving the upload promise.
|
|
2585
|
+
*/
|
|
2586
|
+
async getSettings(options) {
|
|
2587
|
+
return this._get("/settings", options);
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2590
|
+
* Update the calling app's storage + media settings. Admin-only on the
|
|
2591
|
+
* platform side (callers without the right role get 403).
|
|
2592
|
+
*/
|
|
2593
|
+
async updateSettings(settings, options) {
|
|
2594
|
+
return this.put("/settings", settings, options);
|
|
2595
|
+
}
|
|
2577
2596
|
/**
|
|
2578
2597
|
* Aggregate status for a file — single call returns scan + reserved
|
|
2579
2598
|
* optimize/transcode slots + the canonical view URL paths for image
|
|
@@ -6085,6 +6104,74 @@ var PhotoService = class extends ServiceModule {
|
|
|
6085
6104
|
}
|
|
6086
6105
|
};
|
|
6087
6106
|
|
|
6107
|
+
// src/services/audio.ts
|
|
6108
|
+
var AudioService = class extends ServiceModule {
|
|
6109
|
+
/**
|
|
6110
|
+
* @param storage Required for {@link uploadViaStorage}. Wired up by the
|
|
6111
|
+
* top-level {@link ScaleMule} constructor — most call sites should not
|
|
6112
|
+
* instantiate `AudioService` directly.
|
|
6113
|
+
*/
|
|
6114
|
+
constructor(client, storage) {
|
|
6115
|
+
super(client);
|
|
6116
|
+
this.storage = storage;
|
|
6117
|
+
this.basePath = "/v1/audios";
|
|
6118
|
+
}
|
|
6119
|
+
/**
|
|
6120
|
+
* Register a storage-uploaded audio asset with the audio service.
|
|
6121
|
+
* Idempotent — re-calling with the same `file_id` returns the existing
|
|
6122
|
+
* record.
|
|
6123
|
+
*/
|
|
6124
|
+
async register(args, options) {
|
|
6125
|
+
return this.post("/register", { file_id: args.fileId, sm_user_id: args.userId }, options);
|
|
6126
|
+
}
|
|
6127
|
+
/**
|
|
6128
|
+
* Upload a file to storage (browser → S3 direct, private, uncompressed)
|
|
6129
|
+
* and register it with the audio service.
|
|
6130
|
+
*
|
|
6131
|
+
* Mirrors `photo.uploadViaStorage()` / `video.uploadViaStorage()`. If
|
|
6132
|
+
* `register()` fails after a successful storage upload, the file is *not*
|
|
6133
|
+
* lost — the returned `file_id` is still valid as a generic private storage
|
|
6134
|
+
* file. The SDK logs a warning and returns `audio_id: null`.
|
|
6135
|
+
*/
|
|
6136
|
+
async uploadViaStorage(file, uploadOptions, requestOptions) {
|
|
6137
|
+
const uploadResult = await this.storage.uploadPrivate(file, {
|
|
6138
|
+
filename: uploadOptions?.filename,
|
|
6139
|
+
metadata: uploadOptions?.metadata,
|
|
6140
|
+
onProgress: uploadOptions?.onProgress,
|
|
6141
|
+
signal: uploadOptions?.signal
|
|
6142
|
+
});
|
|
6143
|
+
if (uploadResult.error || !uploadResult.data) {
|
|
6144
|
+
return { data: null, error: uploadResult.error };
|
|
6145
|
+
}
|
|
6146
|
+
const fileInfo = uploadResult.data;
|
|
6147
|
+
const fileId = fileInfo.id;
|
|
6148
|
+
const originalViewUrl = fileInfo.url ?? null;
|
|
6149
|
+
const registerResult = await this.register({ fileId, userId: uploadOptions?.userId }, requestOptions);
|
|
6150
|
+
if (registerResult.error || !registerResult.data) {
|
|
6151
|
+
console.warn(
|
|
6152
|
+
"[scalemule-sdk] audio.register() failed after storage upload; typed audio metadata unavailable.",
|
|
6153
|
+
registerResult.error
|
|
6154
|
+
);
|
|
6155
|
+
return {
|
|
6156
|
+
data: {
|
|
6157
|
+
file_id: fileId,
|
|
6158
|
+
audio_id: null,
|
|
6159
|
+
original_view_url: originalViewUrl
|
|
6160
|
+
},
|
|
6161
|
+
error: null
|
|
6162
|
+
};
|
|
6163
|
+
}
|
|
6164
|
+
return {
|
|
6165
|
+
data: {
|
|
6166
|
+
file_id: fileId,
|
|
6167
|
+
audio_id: registerResult.data.audio_id,
|
|
6168
|
+
original_view_url: originalViewUrl
|
|
6169
|
+
},
|
|
6170
|
+
error: null
|
|
6171
|
+
};
|
|
6172
|
+
}
|
|
6173
|
+
};
|
|
6174
|
+
|
|
6088
6175
|
// src/services/queue.ts
|
|
6089
6176
|
var DeadLetterApi = class extends ServiceModule {
|
|
6090
6177
|
constructor() {
|
|
@@ -6935,6 +7022,7 @@ var ScaleMule = class {
|
|
|
6935
7022
|
this.graph = new GraphService(this._client);
|
|
6936
7023
|
this.functions = new FunctionsService(this._client);
|
|
6937
7024
|
this.photo = new PhotoService(this._client, this.storage);
|
|
7025
|
+
this.audio = new AudioService(this._client, this.storage);
|
|
6938
7026
|
this.flagContent = new FlagContentService(this._client);
|
|
6939
7027
|
this.creatorMaker = new CreatorMakerService(this._client);
|
|
6940
7028
|
this.compliance = new ComplianceService(this._client);
|
|
@@ -7077,6 +7165,7 @@ export {
|
|
|
7077
7165
|
AgentToolsService,
|
|
7078
7166
|
AgentsService,
|
|
7079
7167
|
AnalyticsService,
|
|
7168
|
+
AudioService,
|
|
7080
7169
|
AuthService,
|
|
7081
7170
|
BillingService,
|
|
7082
7171
|
CacheService,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalemule/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
4
|
"description": "Official TypeScript/JavaScript SDK for ScaleMule Backend-as-a-Service",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
34
34
|
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
35
35
|
"typecheck": "tsc --noEmit",
|
|
36
|
-
"prepublishOnly": "npm run build && npm test && npm run lint",
|
|
36
|
+
"prepublishOnly": "node -e \"const v=require('./package.json').version; if(!/^0\\.(0|1)\\.\\d+$/.test(v)){console.error('ERR: SDK '+v+' violates patch-only policy (0.0.x or 0.1.x only). See CONTRIBUTING.md SDK versioning section.');process.exit(1)}\" && npm run build && npm test && npm run lint",
|
|
37
37
|
"release": "npm run prepublishOnly && npm publish --access public"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|