@scalemule/sdk 0.0.26 → 0.0.27
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 +90 -1
- package/dist/index.d.ts +90 -1
- package/dist/index.js +79 -1
- package/dist/index.mjs +78 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -104,6 +104,8 @@ interface StorageAdapter {
|
|
|
104
104
|
interface ScaleMuleConfig {
|
|
105
105
|
/** API key (publishable key for browser, secret key for server) */
|
|
106
106
|
apiKey: string;
|
|
107
|
+
/** Application ID — required for realtime features (WebSocket auth, notifications) */
|
|
108
|
+
applicationId?: string;
|
|
107
109
|
/** Base URL for API requests. Overrides environment preset. */
|
|
108
110
|
baseUrl?: string;
|
|
109
111
|
/** Environment preset ('dev' or 'prod'). Defaults to 'prod'. */
|
|
@@ -250,6 +252,7 @@ declare function buildClientContextHeaders(context: ClientContext | undefined):
|
|
|
250
252
|
|
|
251
253
|
declare class ScaleMuleClient {
|
|
252
254
|
private apiKey;
|
|
255
|
+
private applicationId;
|
|
253
256
|
private baseUrl;
|
|
254
257
|
private debug;
|
|
255
258
|
private storage;
|
|
@@ -271,6 +274,7 @@ declare class ScaleMuleClient {
|
|
|
271
274
|
setAccessToken(token: string): void;
|
|
272
275
|
clearAccessToken(): void;
|
|
273
276
|
getSessionToken(): string | null;
|
|
277
|
+
getApplicationId(): string | null;
|
|
274
278
|
getUserId(): string | null;
|
|
275
279
|
isAuthenticated(): boolean;
|
|
276
280
|
getAnonymousId(): string | null;
|
|
@@ -2771,6 +2775,88 @@ declare class CommunicationService extends ServiceModule {
|
|
|
2771
2775
|
}): Promise<ApiResponse<MessageStatus>>;
|
|
2772
2776
|
}
|
|
2773
2777
|
|
|
2778
|
+
/**
|
|
2779
|
+
* Notifications Service
|
|
2780
|
+
*
|
|
2781
|
+
* In-app notification management — list, read, dismiss.
|
|
2782
|
+
* Notifications are created server-side by the notification pipeline
|
|
2783
|
+
* and delivered in real-time via WebSocket or fetched via these endpoints.
|
|
2784
|
+
*/
|
|
2785
|
+
|
|
2786
|
+
interface Notification {
|
|
2787
|
+
id: string;
|
|
2788
|
+
kind: string;
|
|
2789
|
+
title: string;
|
|
2790
|
+
body: string;
|
|
2791
|
+
icon_url?: string;
|
|
2792
|
+
action_url?: string;
|
|
2793
|
+
data: unknown;
|
|
2794
|
+
priority: 'high' | 'normal' | 'low';
|
|
2795
|
+
is_read: boolean;
|
|
2796
|
+
read_at?: string;
|
|
2797
|
+
created_at: string;
|
|
2798
|
+
}
|
|
2799
|
+
interface NotificationListResponse {
|
|
2800
|
+
notifications: Notification[];
|
|
2801
|
+
has_more: boolean;
|
|
2802
|
+
}
|
|
2803
|
+
interface UnreadCountResponse {
|
|
2804
|
+
count: number;
|
|
2805
|
+
}
|
|
2806
|
+
interface ListNotificationsParams {
|
|
2807
|
+
/** Only return unread notifications */
|
|
2808
|
+
unread_only?: boolean;
|
|
2809
|
+
/** Filter by notification kind (e.g., 'video.ready') */
|
|
2810
|
+
kind?: string;
|
|
2811
|
+
/** ISO 8601 timestamp — return notifications created after this time */
|
|
2812
|
+
since?: string;
|
|
2813
|
+
/** Max results per page (default: 20, max: 100) */
|
|
2814
|
+
limit?: number;
|
|
2815
|
+
/** Cursor for pagination (created_at of last item) */
|
|
2816
|
+
cursor?: string;
|
|
2817
|
+
}
|
|
2818
|
+
declare class NotificationsService extends ServiceModule {
|
|
2819
|
+
protected basePath: string;
|
|
2820
|
+
/**
|
|
2821
|
+
* List notifications for the authenticated user.
|
|
2822
|
+
*
|
|
2823
|
+
* @example
|
|
2824
|
+
* ```ts
|
|
2825
|
+
* // All unread
|
|
2826
|
+
* const { data } = await sm.notifications.list({ unread_only: true })
|
|
2827
|
+
*
|
|
2828
|
+
* // With pagination
|
|
2829
|
+
* const { data } = await sm.notifications.list({ limit: 10, cursor: lastCreatedAt })
|
|
2830
|
+
*
|
|
2831
|
+
* // Since last seen (reconnect catch-up)
|
|
2832
|
+
* const { data } = await sm.notifications.list({ unread_only: true, since: '2026-03-25T00:00:00Z' })
|
|
2833
|
+
* ```
|
|
2834
|
+
*/
|
|
2835
|
+
list(params?: ListNotificationsParams, options?: RequestOptions): Promise<ApiResponse<NotificationListResponse>>;
|
|
2836
|
+
/**
|
|
2837
|
+
* Get the count of unread notifications.
|
|
2838
|
+
*
|
|
2839
|
+
* @example
|
|
2840
|
+
* ```ts
|
|
2841
|
+
* const { data } = await sm.notifications.unreadCount()
|
|
2842
|
+
* console.log(`${data.count} unread`)
|
|
2843
|
+
* ```
|
|
2844
|
+
*/
|
|
2845
|
+
unreadCount(options?: RequestOptions): Promise<ApiResponse<UnreadCountResponse>>;
|
|
2846
|
+
/**
|
|
2847
|
+
* Mark a single notification as read.
|
|
2848
|
+
*/
|
|
2849
|
+
markRead(id: string, options?: RequestOptions): Promise<ApiResponse<void>>;
|
|
2850
|
+
/**
|
|
2851
|
+
* Mark all notifications as read.
|
|
2852
|
+
*/
|
|
2853
|
+
markAllRead(options?: RequestOptions): Promise<ApiResponse<void>>;
|
|
2854
|
+
/**
|
|
2855
|
+
* Dismiss a notification (soft delete).
|
|
2856
|
+
*/
|
|
2857
|
+
dismiss(id: string, options?: RequestOptions): Promise<ApiResponse<void>>;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2774
2860
|
/**
|
|
2775
2861
|
* WebPushManager — Browser push notification subscription manager
|
|
2776
2862
|
*
|
|
@@ -5455,6 +5541,7 @@ declare class ScaleMule {
|
|
|
5455
5541
|
readonly analytics: AnalyticsService;
|
|
5456
5542
|
readonly flags: FlagsService;
|
|
5457
5543
|
readonly communication: CommunicationService;
|
|
5544
|
+
readonly notifications: NotificationsService;
|
|
5458
5545
|
readonly scheduler: SchedulerService;
|
|
5459
5546
|
readonly permissions: PermissionsService;
|
|
5460
5547
|
readonly workspaces: WorkspacesService;
|
|
@@ -5520,6 +5607,8 @@ declare class ScaleMule {
|
|
|
5520
5607
|
clearAllAccounts(): Promise<void>;
|
|
5521
5608
|
/** The base URL being used for API requests. */
|
|
5522
5609
|
getBaseUrl(): string;
|
|
5610
|
+
/** The application ID, or null if not configured. */
|
|
5611
|
+
getApplicationId(): string | null;
|
|
5523
5612
|
/** Set the active workspace context. All subsequent requests include this as x-sm-workspace-id. */
|
|
5524
5613
|
setWorkspaceContext(id: string | null): void;
|
|
5525
5614
|
/** Get the current workspace ID, or null. */
|
|
@@ -5528,4 +5617,4 @@ declare class ScaleMule {
|
|
|
5528
5617
|
getClient(): ScaleMuleClient;
|
|
5529
5618
|
}
|
|
5530
5619
|
|
|
5531
|
-
export { type AccountBalance, 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 CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type Conversation, type CostReportDay, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, 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 GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, 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 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 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 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 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 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 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 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 };
|
|
5620
|
+
export { type AccountBalance, 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 CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type Conversation, type CostReportDay, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, 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 GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, 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 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 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 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 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 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
|
@@ -104,6 +104,8 @@ interface StorageAdapter {
|
|
|
104
104
|
interface ScaleMuleConfig {
|
|
105
105
|
/** API key (publishable key for browser, secret key for server) */
|
|
106
106
|
apiKey: string;
|
|
107
|
+
/** Application ID — required for realtime features (WebSocket auth, notifications) */
|
|
108
|
+
applicationId?: string;
|
|
107
109
|
/** Base URL for API requests. Overrides environment preset. */
|
|
108
110
|
baseUrl?: string;
|
|
109
111
|
/** Environment preset ('dev' or 'prod'). Defaults to 'prod'. */
|
|
@@ -250,6 +252,7 @@ declare function buildClientContextHeaders(context: ClientContext | undefined):
|
|
|
250
252
|
|
|
251
253
|
declare class ScaleMuleClient {
|
|
252
254
|
private apiKey;
|
|
255
|
+
private applicationId;
|
|
253
256
|
private baseUrl;
|
|
254
257
|
private debug;
|
|
255
258
|
private storage;
|
|
@@ -271,6 +274,7 @@ declare class ScaleMuleClient {
|
|
|
271
274
|
setAccessToken(token: string): void;
|
|
272
275
|
clearAccessToken(): void;
|
|
273
276
|
getSessionToken(): string | null;
|
|
277
|
+
getApplicationId(): string | null;
|
|
274
278
|
getUserId(): string | null;
|
|
275
279
|
isAuthenticated(): boolean;
|
|
276
280
|
getAnonymousId(): string | null;
|
|
@@ -2771,6 +2775,88 @@ declare class CommunicationService extends ServiceModule {
|
|
|
2771
2775
|
}): Promise<ApiResponse<MessageStatus>>;
|
|
2772
2776
|
}
|
|
2773
2777
|
|
|
2778
|
+
/**
|
|
2779
|
+
* Notifications Service
|
|
2780
|
+
*
|
|
2781
|
+
* In-app notification management — list, read, dismiss.
|
|
2782
|
+
* Notifications are created server-side by the notification pipeline
|
|
2783
|
+
* and delivered in real-time via WebSocket or fetched via these endpoints.
|
|
2784
|
+
*/
|
|
2785
|
+
|
|
2786
|
+
interface Notification {
|
|
2787
|
+
id: string;
|
|
2788
|
+
kind: string;
|
|
2789
|
+
title: string;
|
|
2790
|
+
body: string;
|
|
2791
|
+
icon_url?: string;
|
|
2792
|
+
action_url?: string;
|
|
2793
|
+
data: unknown;
|
|
2794
|
+
priority: 'high' | 'normal' | 'low';
|
|
2795
|
+
is_read: boolean;
|
|
2796
|
+
read_at?: string;
|
|
2797
|
+
created_at: string;
|
|
2798
|
+
}
|
|
2799
|
+
interface NotificationListResponse {
|
|
2800
|
+
notifications: Notification[];
|
|
2801
|
+
has_more: boolean;
|
|
2802
|
+
}
|
|
2803
|
+
interface UnreadCountResponse {
|
|
2804
|
+
count: number;
|
|
2805
|
+
}
|
|
2806
|
+
interface ListNotificationsParams {
|
|
2807
|
+
/** Only return unread notifications */
|
|
2808
|
+
unread_only?: boolean;
|
|
2809
|
+
/** Filter by notification kind (e.g., 'video.ready') */
|
|
2810
|
+
kind?: string;
|
|
2811
|
+
/** ISO 8601 timestamp — return notifications created after this time */
|
|
2812
|
+
since?: string;
|
|
2813
|
+
/** Max results per page (default: 20, max: 100) */
|
|
2814
|
+
limit?: number;
|
|
2815
|
+
/** Cursor for pagination (created_at of last item) */
|
|
2816
|
+
cursor?: string;
|
|
2817
|
+
}
|
|
2818
|
+
declare class NotificationsService extends ServiceModule {
|
|
2819
|
+
protected basePath: string;
|
|
2820
|
+
/**
|
|
2821
|
+
* List notifications for the authenticated user.
|
|
2822
|
+
*
|
|
2823
|
+
* @example
|
|
2824
|
+
* ```ts
|
|
2825
|
+
* // All unread
|
|
2826
|
+
* const { data } = await sm.notifications.list({ unread_only: true })
|
|
2827
|
+
*
|
|
2828
|
+
* // With pagination
|
|
2829
|
+
* const { data } = await sm.notifications.list({ limit: 10, cursor: lastCreatedAt })
|
|
2830
|
+
*
|
|
2831
|
+
* // Since last seen (reconnect catch-up)
|
|
2832
|
+
* const { data } = await sm.notifications.list({ unread_only: true, since: '2026-03-25T00:00:00Z' })
|
|
2833
|
+
* ```
|
|
2834
|
+
*/
|
|
2835
|
+
list(params?: ListNotificationsParams, options?: RequestOptions): Promise<ApiResponse<NotificationListResponse>>;
|
|
2836
|
+
/**
|
|
2837
|
+
* Get the count of unread notifications.
|
|
2838
|
+
*
|
|
2839
|
+
* @example
|
|
2840
|
+
* ```ts
|
|
2841
|
+
* const { data } = await sm.notifications.unreadCount()
|
|
2842
|
+
* console.log(`${data.count} unread`)
|
|
2843
|
+
* ```
|
|
2844
|
+
*/
|
|
2845
|
+
unreadCount(options?: RequestOptions): Promise<ApiResponse<UnreadCountResponse>>;
|
|
2846
|
+
/**
|
|
2847
|
+
* Mark a single notification as read.
|
|
2848
|
+
*/
|
|
2849
|
+
markRead(id: string, options?: RequestOptions): Promise<ApiResponse<void>>;
|
|
2850
|
+
/**
|
|
2851
|
+
* Mark all notifications as read.
|
|
2852
|
+
*/
|
|
2853
|
+
markAllRead(options?: RequestOptions): Promise<ApiResponse<void>>;
|
|
2854
|
+
/**
|
|
2855
|
+
* Dismiss a notification (soft delete).
|
|
2856
|
+
*/
|
|
2857
|
+
dismiss(id: string, options?: RequestOptions): Promise<ApiResponse<void>>;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2774
2860
|
/**
|
|
2775
2861
|
* WebPushManager — Browser push notification subscription manager
|
|
2776
2862
|
*
|
|
@@ -5455,6 +5541,7 @@ declare class ScaleMule {
|
|
|
5455
5541
|
readonly analytics: AnalyticsService;
|
|
5456
5542
|
readonly flags: FlagsService;
|
|
5457
5543
|
readonly communication: CommunicationService;
|
|
5544
|
+
readonly notifications: NotificationsService;
|
|
5458
5545
|
readonly scheduler: SchedulerService;
|
|
5459
5546
|
readonly permissions: PermissionsService;
|
|
5460
5547
|
readonly workspaces: WorkspacesService;
|
|
@@ -5520,6 +5607,8 @@ declare class ScaleMule {
|
|
|
5520
5607
|
clearAllAccounts(): Promise<void>;
|
|
5521
5608
|
/** The base URL being used for API requests. */
|
|
5522
5609
|
getBaseUrl(): string;
|
|
5610
|
+
/** The application ID, or null if not configured. */
|
|
5611
|
+
getApplicationId(): string | null;
|
|
5523
5612
|
/** Set the active workspace context. All subsequent requests include this as x-sm-workspace-id. */
|
|
5524
5613
|
setWorkspaceContext(id: string | null): void;
|
|
5525
5614
|
/** Get the current workspace ID, or null. */
|
|
@@ -5528,4 +5617,4 @@ declare class ScaleMule {
|
|
|
5528
5617
|
getClient(): ScaleMuleClient;
|
|
5529
5618
|
}
|
|
5530
5619
|
|
|
5531
|
-
export { type AccountBalance, 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 CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type Conversation, type CostReportDay, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, 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 GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, 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 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 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 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 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 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 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 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 };
|
|
5620
|
+
export { type AccountBalance, 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 CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type Conversation, type CostReportDay, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, 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 GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, 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 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 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 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 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 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
|
@@ -319,6 +319,7 @@ __export(index_exports, {
|
|
|
319
319
|
LeaderboardService: () => LeaderboardService,
|
|
320
320
|
ListingsService: () => ListingsService,
|
|
321
321
|
LoggerService: () => LoggerService,
|
|
322
|
+
NotificationsService: () => NotificationsService,
|
|
322
323
|
OrchestratorService: () => OrchestratorService,
|
|
323
324
|
PHONE_COUNTRIES: () => import_phone.PHONE_COUNTRIES,
|
|
324
325
|
PHOTO_BREAKPOINTS: () => PHOTO_BREAKPOINTS,
|
|
@@ -660,6 +661,7 @@ var OfflineQueue = class {
|
|
|
660
661
|
};
|
|
661
662
|
var ScaleMuleClient = class {
|
|
662
663
|
constructor(config) {
|
|
664
|
+
this.applicationId = null;
|
|
663
665
|
this.sessionToken = null;
|
|
664
666
|
this.userId = null;
|
|
665
667
|
this.rateLimitQueue = null;
|
|
@@ -668,6 +670,7 @@ var ScaleMuleClient = class {
|
|
|
668
670
|
this.anonymousId = null;
|
|
669
671
|
this.sessionPool = /* @__PURE__ */ new Map();
|
|
670
672
|
this.apiKey = config.apiKey;
|
|
673
|
+
this.applicationId = config.applicationId || null;
|
|
671
674
|
this.baseUrl = config.baseUrl || GATEWAY_URLS[config.environment || "prod"];
|
|
672
675
|
this.debug = config.debug || false;
|
|
673
676
|
this.storage = config.storage || createDefaultStorage();
|
|
@@ -772,6 +775,9 @@ var ScaleMuleClient = class {
|
|
|
772
775
|
getSessionToken() {
|
|
773
776
|
return this.sessionToken;
|
|
774
777
|
}
|
|
778
|
+
getApplicationId() {
|
|
779
|
+
return this.applicationId;
|
|
780
|
+
}
|
|
775
781
|
getUserId() {
|
|
776
782
|
return this.userId;
|
|
777
783
|
}
|
|
@@ -3512,9 +3518,11 @@ var RealtimeService = class extends ServiceModule {
|
|
|
3512
3518
|
}
|
|
3513
3519
|
authenticate() {
|
|
3514
3520
|
const token = this.client.getSessionToken();
|
|
3521
|
+
const appId = this.client.getApplicationId();
|
|
3515
3522
|
this.sendWs({
|
|
3516
3523
|
type: "auth",
|
|
3517
|
-
token: token || void 0
|
|
3524
|
+
token: token || void 0,
|
|
3525
|
+
app_id: appId || void 0
|
|
3518
3526
|
});
|
|
3519
3527
|
}
|
|
3520
3528
|
handleMessage(msg) {
|
|
@@ -4572,6 +4580,70 @@ var CommunicationService = class extends ServiceModule {
|
|
|
4572
4580
|
}
|
|
4573
4581
|
};
|
|
4574
4582
|
|
|
4583
|
+
// src/services/notifications.ts
|
|
4584
|
+
var NotificationsService = class extends ServiceModule {
|
|
4585
|
+
constructor() {
|
|
4586
|
+
super(...arguments);
|
|
4587
|
+
this.basePath = "/notifications";
|
|
4588
|
+
}
|
|
4589
|
+
/**
|
|
4590
|
+
* List notifications for the authenticated user.
|
|
4591
|
+
*
|
|
4592
|
+
* @example
|
|
4593
|
+
* ```ts
|
|
4594
|
+
* // All unread
|
|
4595
|
+
* const { data } = await sm.notifications.list({ unread_only: true })
|
|
4596
|
+
*
|
|
4597
|
+
* // With pagination
|
|
4598
|
+
* const { data } = await sm.notifications.list({ limit: 10, cursor: lastCreatedAt })
|
|
4599
|
+
*
|
|
4600
|
+
* // Since last seen (reconnect catch-up)
|
|
4601
|
+
* const { data } = await sm.notifications.list({ unread_only: true, since: '2026-03-25T00:00:00Z' })
|
|
4602
|
+
* ```
|
|
4603
|
+
*/
|
|
4604
|
+
async list(params, options) {
|
|
4605
|
+
const qs = new URLSearchParams();
|
|
4606
|
+
if (params?.unread_only) qs.set("unread_only", "true");
|
|
4607
|
+
if (params?.kind) qs.set("kind", params.kind);
|
|
4608
|
+
if (params?.since) qs.set("since", params.since);
|
|
4609
|
+
if (params?.limit) qs.set("limit", String(params.limit));
|
|
4610
|
+
if (params?.cursor) qs.set("cursor", params.cursor);
|
|
4611
|
+
const query = qs.toString();
|
|
4612
|
+
const path = query ? `?${query}` : "";
|
|
4613
|
+
return this._get(path, options);
|
|
4614
|
+
}
|
|
4615
|
+
/**
|
|
4616
|
+
* Get the count of unread notifications.
|
|
4617
|
+
*
|
|
4618
|
+
* @example
|
|
4619
|
+
* ```ts
|
|
4620
|
+
* const { data } = await sm.notifications.unreadCount()
|
|
4621
|
+
* console.log(`${data.count} unread`)
|
|
4622
|
+
* ```
|
|
4623
|
+
*/
|
|
4624
|
+
async unreadCount(options) {
|
|
4625
|
+
return this._get("/unread-count", options);
|
|
4626
|
+
}
|
|
4627
|
+
/**
|
|
4628
|
+
* Mark a single notification as read.
|
|
4629
|
+
*/
|
|
4630
|
+
async markRead(id, options) {
|
|
4631
|
+
return this.patch(`/${id}/read`, void 0, options);
|
|
4632
|
+
}
|
|
4633
|
+
/**
|
|
4634
|
+
* Mark all notifications as read.
|
|
4635
|
+
*/
|
|
4636
|
+
async markAllRead(options) {
|
|
4637
|
+
return this.patch("/read-all", void 0, options);
|
|
4638
|
+
}
|
|
4639
|
+
/**
|
|
4640
|
+
* Dismiss a notification (soft delete).
|
|
4641
|
+
*/
|
|
4642
|
+
async dismiss(id, options) {
|
|
4643
|
+
return this.del(`/${id}`, options);
|
|
4644
|
+
}
|
|
4645
|
+
};
|
|
4646
|
+
|
|
4575
4647
|
// src/web-push.ts
|
|
4576
4648
|
var STORAGE_KEY = "scalemule_push_state";
|
|
4577
4649
|
var WebPushManager = class {
|
|
@@ -6309,6 +6381,7 @@ var ScaleMule = class {
|
|
|
6309
6381
|
this.analytics = new AnalyticsService(this._client);
|
|
6310
6382
|
this.flags = new FlagsService(this._client);
|
|
6311
6383
|
this.communication = new CommunicationService(this._client);
|
|
6384
|
+
this.notifications = new NotificationsService(this._client);
|
|
6312
6385
|
this.scheduler = new SchedulerService(this._client);
|
|
6313
6386
|
this.permissions = new PermissionsService(this._client);
|
|
6314
6387
|
this.workspaces = new WorkspacesService(this._client);
|
|
@@ -6410,6 +6483,10 @@ var ScaleMule = class {
|
|
|
6410
6483
|
getBaseUrl() {
|
|
6411
6484
|
return this._client.getBaseUrl();
|
|
6412
6485
|
}
|
|
6486
|
+
/** The application ID, or null if not configured. */
|
|
6487
|
+
getApplicationId() {
|
|
6488
|
+
return this._client.getApplicationId();
|
|
6489
|
+
}
|
|
6413
6490
|
/** Set the active workspace context. All subsequent requests include this as x-sm-workspace-id. */
|
|
6414
6491
|
setWorkspaceContext(id) {
|
|
6415
6492
|
this._client.setWorkspaceContext(id);
|
|
@@ -6452,6 +6529,7 @@ var index_default = ScaleMule;
|
|
|
6452
6529
|
LeaderboardService,
|
|
6453
6530
|
ListingsService,
|
|
6454
6531
|
LoggerService,
|
|
6532
|
+
NotificationsService,
|
|
6455
6533
|
OrchestratorService,
|
|
6456
6534
|
PHONE_COUNTRIES,
|
|
6457
6535
|
PHOTO_BREAKPOINTS,
|
package/dist/index.mjs
CHANGED
|
@@ -294,6 +294,7 @@ var OfflineQueue = class {
|
|
|
294
294
|
};
|
|
295
295
|
var ScaleMuleClient = class {
|
|
296
296
|
constructor(config) {
|
|
297
|
+
this.applicationId = null;
|
|
297
298
|
this.sessionToken = null;
|
|
298
299
|
this.userId = null;
|
|
299
300
|
this.rateLimitQueue = null;
|
|
@@ -302,6 +303,7 @@ var ScaleMuleClient = class {
|
|
|
302
303
|
this.anonymousId = null;
|
|
303
304
|
this.sessionPool = /* @__PURE__ */ new Map();
|
|
304
305
|
this.apiKey = config.apiKey;
|
|
306
|
+
this.applicationId = config.applicationId || null;
|
|
305
307
|
this.baseUrl = config.baseUrl || GATEWAY_URLS[config.environment || "prod"];
|
|
306
308
|
this.debug = config.debug || false;
|
|
307
309
|
this.storage = config.storage || createDefaultStorage();
|
|
@@ -406,6 +408,9 @@ var ScaleMuleClient = class {
|
|
|
406
408
|
getSessionToken() {
|
|
407
409
|
return this.sessionToken;
|
|
408
410
|
}
|
|
411
|
+
getApplicationId() {
|
|
412
|
+
return this.applicationId;
|
|
413
|
+
}
|
|
409
414
|
getUserId() {
|
|
410
415
|
return this.userId;
|
|
411
416
|
}
|
|
@@ -3153,9 +3158,11 @@ var RealtimeService = class extends ServiceModule {
|
|
|
3153
3158
|
}
|
|
3154
3159
|
authenticate() {
|
|
3155
3160
|
const token = this.client.getSessionToken();
|
|
3161
|
+
const appId = this.client.getApplicationId();
|
|
3156
3162
|
this.sendWs({
|
|
3157
3163
|
type: "auth",
|
|
3158
|
-
token: token || void 0
|
|
3164
|
+
token: token || void 0,
|
|
3165
|
+
app_id: appId || void 0
|
|
3159
3166
|
});
|
|
3160
3167
|
}
|
|
3161
3168
|
handleMessage(msg) {
|
|
@@ -4213,6 +4220,70 @@ var CommunicationService = class extends ServiceModule {
|
|
|
4213
4220
|
}
|
|
4214
4221
|
};
|
|
4215
4222
|
|
|
4223
|
+
// src/services/notifications.ts
|
|
4224
|
+
var NotificationsService = class extends ServiceModule {
|
|
4225
|
+
constructor() {
|
|
4226
|
+
super(...arguments);
|
|
4227
|
+
this.basePath = "/notifications";
|
|
4228
|
+
}
|
|
4229
|
+
/**
|
|
4230
|
+
* List notifications for the authenticated user.
|
|
4231
|
+
*
|
|
4232
|
+
* @example
|
|
4233
|
+
* ```ts
|
|
4234
|
+
* // All unread
|
|
4235
|
+
* const { data } = await sm.notifications.list({ unread_only: true })
|
|
4236
|
+
*
|
|
4237
|
+
* // With pagination
|
|
4238
|
+
* const { data } = await sm.notifications.list({ limit: 10, cursor: lastCreatedAt })
|
|
4239
|
+
*
|
|
4240
|
+
* // Since last seen (reconnect catch-up)
|
|
4241
|
+
* const { data } = await sm.notifications.list({ unread_only: true, since: '2026-03-25T00:00:00Z' })
|
|
4242
|
+
* ```
|
|
4243
|
+
*/
|
|
4244
|
+
async list(params, options) {
|
|
4245
|
+
const qs = new URLSearchParams();
|
|
4246
|
+
if (params?.unread_only) qs.set("unread_only", "true");
|
|
4247
|
+
if (params?.kind) qs.set("kind", params.kind);
|
|
4248
|
+
if (params?.since) qs.set("since", params.since);
|
|
4249
|
+
if (params?.limit) qs.set("limit", String(params.limit));
|
|
4250
|
+
if (params?.cursor) qs.set("cursor", params.cursor);
|
|
4251
|
+
const query = qs.toString();
|
|
4252
|
+
const path = query ? `?${query}` : "";
|
|
4253
|
+
return this._get(path, options);
|
|
4254
|
+
}
|
|
4255
|
+
/**
|
|
4256
|
+
* Get the count of unread notifications.
|
|
4257
|
+
*
|
|
4258
|
+
* @example
|
|
4259
|
+
* ```ts
|
|
4260
|
+
* const { data } = await sm.notifications.unreadCount()
|
|
4261
|
+
* console.log(`${data.count} unread`)
|
|
4262
|
+
* ```
|
|
4263
|
+
*/
|
|
4264
|
+
async unreadCount(options) {
|
|
4265
|
+
return this._get("/unread-count", options);
|
|
4266
|
+
}
|
|
4267
|
+
/**
|
|
4268
|
+
* Mark a single notification as read.
|
|
4269
|
+
*/
|
|
4270
|
+
async markRead(id, options) {
|
|
4271
|
+
return this.patch(`/${id}/read`, void 0, options);
|
|
4272
|
+
}
|
|
4273
|
+
/**
|
|
4274
|
+
* Mark all notifications as read.
|
|
4275
|
+
*/
|
|
4276
|
+
async markAllRead(options) {
|
|
4277
|
+
return this.patch("/read-all", void 0, options);
|
|
4278
|
+
}
|
|
4279
|
+
/**
|
|
4280
|
+
* Dismiss a notification (soft delete).
|
|
4281
|
+
*/
|
|
4282
|
+
async dismiss(id, options) {
|
|
4283
|
+
return this.del(`/${id}`, options);
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4286
|
+
|
|
4216
4287
|
// src/web-push.ts
|
|
4217
4288
|
var STORAGE_KEY = "scalemule_push_state";
|
|
4218
4289
|
var WebPushManager = class {
|
|
@@ -5950,6 +6021,7 @@ var ScaleMule = class {
|
|
|
5950
6021
|
this.analytics = new AnalyticsService(this._client);
|
|
5951
6022
|
this.flags = new FlagsService(this._client);
|
|
5952
6023
|
this.communication = new CommunicationService(this._client);
|
|
6024
|
+
this.notifications = new NotificationsService(this._client);
|
|
5953
6025
|
this.scheduler = new SchedulerService(this._client);
|
|
5954
6026
|
this.permissions = new PermissionsService(this._client);
|
|
5955
6027
|
this.workspaces = new WorkspacesService(this._client);
|
|
@@ -6051,6 +6123,10 @@ var ScaleMule = class {
|
|
|
6051
6123
|
getBaseUrl() {
|
|
6052
6124
|
return this._client.getBaseUrl();
|
|
6053
6125
|
}
|
|
6126
|
+
/** The application ID, or null if not configured. */
|
|
6127
|
+
getApplicationId() {
|
|
6128
|
+
return this._client.getApplicationId();
|
|
6129
|
+
}
|
|
6054
6130
|
/** Set the active workspace context. All subsequent requests include this as x-sm-workspace-id. */
|
|
6055
6131
|
setWorkspaceContext(id) {
|
|
6056
6132
|
this._client.setWorkspaceContext(id);
|
|
@@ -6092,6 +6168,7 @@ export {
|
|
|
6092
6168
|
LeaderboardService,
|
|
6093
6169
|
ListingsService,
|
|
6094
6170
|
LoggerService,
|
|
6171
|
+
NotificationsService,
|
|
6095
6172
|
OrchestratorService,
|
|
6096
6173
|
PHONE_COUNTRIES,
|
|
6097
6174
|
PHOTO_BREAKPOINTS,
|