@sylphx/sdk 0.10.2 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/index.d.ts +63 -16
- package/dist/index.mjs +111 -21
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.d.ts +62 -1
- package/dist/nextjs/index.mjs +220 -24
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +6 -1
- package/dist/react/index.mjs +38 -8
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.mjs.map +1 -1
- package/package.json +21 -2
- package/dist/health/index.d.ts +0 -681
package/README.md
CHANGED
|
@@ -66,6 +66,12 @@ export const config = {
|
|
|
66
66
|
|
|
67
67
|
No manual `/api/auth/*` routes needed — the middleware handles everything.
|
|
68
68
|
|
|
69
|
+
Organization context is part of the same contract. Calling the mounted
|
|
70
|
+
`POST /auth/switch-org` route stores the active org in SDK-owned HttpOnly
|
|
71
|
+
cookies; subsequent refresh-token rotations restore the org-scoped access token
|
|
72
|
+
automatically. If a user belongs to exactly one organization, the middleware
|
|
73
|
+
auto-scopes the refreshed session without app-specific glue code.
|
|
74
|
+
|
|
69
75
|
---
|
|
70
76
|
|
|
71
77
|
### 3. Root Layout
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SdkBillingPlan, SdkBillingSubscription, BillingCheckoutRequest, BillingCheckoutResponse, BillingPortalRequest, BillingPortalResponse, BillingBalanceResponse, BillingUsageResponse, SdkConsentType, UserConsent as UserConsent$1, AIModel as AIModel$1, GetModelsResponse, GetRateLimitResponse, GetUsageResponse, ReferralLeaderboardEntry, ReferralRewardDefaults as ReferralRewardDefaults$1, WebhookDelivery as WebhookDelivery$1, DeviceApproveRequest, DeviceApproveResponse, DeviceDenyRequest, DeviceDenyResponse, DeviceInitResponse, DeviceInitRequest, DevicePollResponse, LoginRequest as LoginRequest$1, LoginResponse as LoginResponse$1, UserFullProfile as UserFullProfile$1, LogoutInput, PlatformPasswordChangeRequest, PlatformPasswordChangeResponse, PlatformPasswordSetRequest, PlatformPasswordSetResponse, PlatformPasswordStatusResponse, RefreshTokenInput, RefreshTokenResult, PlatformSessionRenameRequest, PlatformSessionRenameResponse, PlatformSessionRevokeAllResponse, PlatformSessionRevokeRequest, PlatformSessionRevokeOtherResponse, PlatformSessionRevokeResponse, PlatformSessionsListResponse, AuthUserDeleteRequest, AuthUserDeleteResponse, AuthUserExportResponse, RegisterRequest as RegisterRequest$1, RegisterResponse as RegisterResponse$1, ResendEmailVerificationRequest as ResendEmailVerificationRequest$1, ResendEmailVerificationResponse as ResendEmailVerificationResponse$1, AuthTokensResponse, TwoFactorVerifyRequest as TwoFactorVerifyRequest$1, OAuthIntrospectResponse, PlatformAuditQueryRequest, PlatformAuditQueryResponse, PlatformRateLimitStatusRequest, PlatformRateLimitStatusResponse, PlatformRateLimitStrategiesListRequest, PlatformRateLimitStrategiesListResponse, PlatformRateLimitStrategyDeleteRequest, PlatformRateLimitStrategyDeleteResponse, PlatformRateLimitStrategyUpsertRequest, PlatformRateLimitStrategyUpsertResponse, File as File$1, UploadId, FileId, FileVersion, FileVersionId, CreateOrgInput as CreateOrgInput$1, InviteMemberInput as InviteMemberInput$1, OrgSdkRole, OrgInvitation, OrgMember, MembershipInfo, UpdateOrgInput as UpdateOrgInput$1,
|
|
1
|
+
import { SdkBillingPlan, SdkBillingSubscription, BillingCheckoutRequest, BillingCheckoutResponse, BillingPortalRequest, BillingPortalResponse, BillingBalanceResponse, BillingUsageResponse, SdkConsentType, UserConsent as UserConsent$1, AIModel as AIModel$1, GetModelsResponse, GetRateLimitResponse, GetUsageResponse, ReferralLeaderboardEntry, ReferralRewardDefaults as ReferralRewardDefaults$1, WebhookDelivery as WebhookDelivery$1, DeviceApproveRequest, DeviceApproveResponse, DeviceDenyRequest, DeviceDenyResponse, DeviceInitResponse, DeviceInitRequest, DevicePollResponse, LoginRequest as LoginRequest$1, LoginResponse as LoginResponse$1, UserFullProfile as UserFullProfile$1, LogoutInput, PlatformPasswordChangeRequest, PlatformPasswordChangeResponse, PlatformPasswordSetRequest, PlatformPasswordSetResponse, PlatformPasswordStatusResponse, RefreshTokenInput, RefreshTokenResult, PlatformSessionRenameRequest, PlatformSessionRenameResponse, PlatformSessionRevokeAllResponse, PlatformSessionRevokeRequest, PlatformSessionRevokeOtherResponse, PlatformSessionRevokeResponse, PlatformSessionsListResponse, AuthUserDeleteRequest, AuthUserDeleteResponse, AuthUserExportResponse, RegisterRequest as RegisterRequest$1, RegisterResponse as RegisterResponse$1, ResendEmailVerificationRequest as ResendEmailVerificationRequest$1, ResendEmailVerificationResponse as ResendEmailVerificationResponse$1, AuthTokensResponse, TwoFactorVerifyRequest as TwoFactorVerifyRequest$1, OAuthIntrospectResponse, PlatformAuditQueryRequest, PlatformAuditQueryResponse, PlatformRateLimitStatusRequest, PlatformRateLimitStatusResponse, PlatformRateLimitStrategiesListRequest, PlatformRateLimitStrategiesListResponse, PlatformRateLimitStrategyDeleteRequest, PlatformRateLimitStrategyDeleteResponse, PlatformRateLimitStrategyUpsertRequest, PlatformRateLimitStrategyUpsertResponse, File as File$1, UploadId, FileId, TakedownFileRequest, TakedownFileResult, FileVersion, FileVersionId, CreateOrgInput as CreateOrgInput$1, InviteMemberInput as InviteMemberInput$1, OrgSdkRole, OrgInvitation, OrgMember, MembershipInfo, Organization, UpdateOrgInput as UpdateOrgInput$1, UserOrganizationMembership, UserOrganizationsResponse } from '@sylphx/contract';
|
|
2
2
|
export { BillingBalanceResponse as BalanceResponse, BillingCheckoutRequest as CheckoutRequest, BillingCheckoutResponse as CheckoutResponse, FileId, FileVersion, FileVersionId, FileVisibility, Organization, BillingPortalRequest as PortalRequest, BillingPortalResponse as PortalResponse, SignedUrlDisposition, File as StorageFile, UploadId, BillingUsageResponse as UsageResponse } from '@sylphx/contract';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1782,6 +1782,8 @@ interface AccessTokenPayload {
|
|
|
1782
1782
|
email_verified: boolean;
|
|
1783
1783
|
app_id: string;
|
|
1784
1784
|
role?: string;
|
|
1785
|
+
/** Project session id when the token was minted from a BaaS auth session. */
|
|
1786
|
+
sid?: string;
|
|
1785
1787
|
iat: number;
|
|
1786
1788
|
exp: number;
|
|
1787
1789
|
}
|
|
@@ -3769,6 +3771,7 @@ interface CopyFileOptions {
|
|
|
3769
3771
|
visibility?: 'public' | 'private';
|
|
3770
3772
|
metadata?: Record<string, unknown>;
|
|
3771
3773
|
}
|
|
3774
|
+
type TakedownFileOptions = TakedownFileRequest;
|
|
3772
3775
|
declare function uploadsCreate(config: SylphxConfig, blob: Blob | File, options: UploadCreateOptions): Promise<File$1>;
|
|
3773
3776
|
declare function uploadsAbort(config: SylphxConfig, uploadId: UploadId | string): Promise<void>;
|
|
3774
3777
|
interface ListPage {
|
|
@@ -3783,6 +3786,7 @@ declare function filesDelete(config: SylphxConfig, fileId: FileId | string): Pro
|
|
|
3783
3786
|
id: FileId;
|
|
3784
3787
|
isDeleted: true;
|
|
3785
3788
|
}>;
|
|
3789
|
+
declare function filesTakedown(config: SylphxConfig, fileId: FileId | string, options: TakedownFileOptions): Promise<TakedownFileResult>;
|
|
3786
3790
|
declare function filesRestore(config: SylphxConfig, fileId: FileId | string): Promise<File$1>;
|
|
3787
3791
|
declare function filesSignedUrl(config: SylphxConfig, fileId: FileId | string, options?: SignedUrlOptions): Promise<{
|
|
3788
3792
|
url: string;
|
|
@@ -3822,6 +3826,7 @@ declare const storage: {
|
|
|
3822
3826
|
readonly list: typeof filesList;
|
|
3823
3827
|
readonly get: typeof filesGet;
|
|
3824
3828
|
readonly delete: typeof filesDelete;
|
|
3829
|
+
readonly takedown: typeof filesTakedown;
|
|
3825
3830
|
readonly restore: typeof filesRestore;
|
|
3826
3831
|
readonly signedUrl: typeof filesSignedUrl;
|
|
3827
3832
|
readonly copy: typeof filesCopy;
|
|
@@ -3995,6 +4000,27 @@ interface PushNotification {
|
|
|
3995
4000
|
icon?: string;
|
|
3996
4001
|
url?: string;
|
|
3997
4002
|
}
|
|
4003
|
+
interface PushDeliveryPlatformCounts {
|
|
4004
|
+
readonly web?: number;
|
|
4005
|
+
readonly ios?: number;
|
|
4006
|
+
readonly android?: number;
|
|
4007
|
+
}
|
|
4008
|
+
interface SendPushWireResult {
|
|
4009
|
+
readonly status?: 'delivered' | 'queued' | 'failed';
|
|
4010
|
+
readonly messageId?: string;
|
|
4011
|
+
readonly reason?: string;
|
|
4012
|
+
readonly sent?: number;
|
|
4013
|
+
readonly failed?: number;
|
|
4014
|
+
readonly platforms?: PushDeliveryPlatformCounts;
|
|
4015
|
+
readonly sentTo?: number;
|
|
4016
|
+
readonly expired?: number;
|
|
4017
|
+
}
|
|
4018
|
+
type SendPushResult = SendPushWireResult & {
|
|
4019
|
+
readonly sent: number;
|
|
4020
|
+
readonly failed: number;
|
|
4021
|
+
readonly sentTo: number;
|
|
4022
|
+
readonly expired: number;
|
|
4023
|
+
};
|
|
3998
4024
|
/**
|
|
3999
4025
|
* Register a push subscription
|
|
4000
4026
|
*
|
|
@@ -4039,10 +4065,7 @@ declare function unregisterPush(config: SylphxConfig, endpoint: string): Promise
|
|
|
4039
4065
|
* })
|
|
4040
4066
|
* ```
|
|
4041
4067
|
*/
|
|
4042
|
-
declare function sendPush(config: SylphxConfig, userId: string, notification: PushNotification): Promise<
|
|
4043
|
-
sentTo: number;
|
|
4044
|
-
expired: number;
|
|
4045
|
-
}>;
|
|
4068
|
+
declare function sendPush(config: SylphxConfig, userId: string, notification: PushNotification): Promise<SendPushResult>;
|
|
4046
4069
|
/**
|
|
4047
4070
|
* Get push notification preferences
|
|
4048
4071
|
*
|
|
@@ -5543,6 +5566,13 @@ type OrganizationInvitation = OrgInvitation;
|
|
|
5543
5566
|
* path) — SDK callers get the union on the response envelope, not here.
|
|
5544
5567
|
*/
|
|
5545
5568
|
type OrganizationMembership = MembershipInfo;
|
|
5569
|
+
type UserOrganization = UserOrganizationMembership;
|
|
5570
|
+
type OrganizationsListResult = {
|
|
5571
|
+
organizations: Organization[];
|
|
5572
|
+
total: number;
|
|
5573
|
+
limit: number;
|
|
5574
|
+
offset: number;
|
|
5575
|
+
};
|
|
5546
5576
|
type OrgRole = OrgSdkRole;
|
|
5547
5577
|
/**
|
|
5548
5578
|
* The contract's `CreateOrgInput` requires `{ name, slug }`; the SDK's
|
|
@@ -5567,9 +5597,22 @@ type InviteMemberInput = InviteMemberInput$1;
|
|
|
5567
5597
|
* const { organizations } = await getOrganizations(config)
|
|
5568
5598
|
* ```
|
|
5569
5599
|
*/
|
|
5570
|
-
declare function getOrganizations(config: SylphxConfig): Promise<
|
|
5571
|
-
|
|
5572
|
-
|
|
5600
|
+
declare function getOrganizations(config: SylphxConfig): Promise<UserOrganizationsResponse>;
|
|
5601
|
+
/**
|
|
5602
|
+
* Admin-only organization list.
|
|
5603
|
+
*
|
|
5604
|
+
* `getOrganizations()` is intentionally user-scoped. Use this function only
|
|
5605
|
+
* from Platform operator contexts that are allowed to enumerate every org.
|
|
5606
|
+
*
|
|
5607
|
+
* @example
|
|
5608
|
+
* ```typescript
|
|
5609
|
+
* const { organizations, total } = await listOrganizations(adminConfig)
|
|
5610
|
+
* ```
|
|
5611
|
+
*/
|
|
5612
|
+
declare function listOrganizations(config: SylphxConfig, options?: {
|
|
5613
|
+
limit?: number;
|
|
5614
|
+
offset?: number;
|
|
5615
|
+
}): Promise<OrganizationsListResult>;
|
|
5573
5616
|
/**
|
|
5574
5617
|
* Get organization by ID or slug
|
|
5575
5618
|
*
|
|
@@ -6676,7 +6719,7 @@ interface DatabaseConnectionInfo {
|
|
|
6676
6719
|
/** Database name */
|
|
6677
6720
|
databaseName: string;
|
|
6678
6721
|
/** Database role/user name */
|
|
6679
|
-
roleName: string
|
|
6722
|
+
roleName: string;
|
|
6680
6723
|
/** Database provisioning status */
|
|
6681
6724
|
status: Exclude<DatabaseStatus, 'not_provisioned'>;
|
|
6682
6725
|
}
|
|
@@ -6791,6 +6834,8 @@ interface KvSetRequest extends KvSetOptions {
|
|
|
6791
6834
|
key: string;
|
|
6792
6835
|
/** Value to store (any JSON-serializable value) */
|
|
6793
6836
|
value: unknown;
|
|
6837
|
+
/** @deprecated Use `ex`. Kept for compatibility with early SDK adopters. */
|
|
6838
|
+
ttl?: number;
|
|
6794
6839
|
}
|
|
6795
6840
|
interface KvMsetRequest {
|
|
6796
6841
|
/** Key-value pairs to set in a single atomic operation */
|
|
@@ -6866,12 +6911,14 @@ interface KvExpireRequest {
|
|
|
6866
6911
|
seconds: number;
|
|
6867
6912
|
}
|
|
6868
6913
|
interface KvRateLimitRequest {
|
|
6869
|
-
/** Rate limit
|
|
6870
|
-
|
|
6914
|
+
/** Rate limit key (e.g., userId, IP) */
|
|
6915
|
+
key?: string;
|
|
6916
|
+
/** @deprecated Use `key`. Kept for compatibility with early SDK adopters. */
|
|
6917
|
+
identifier?: string;
|
|
6871
6918
|
/** Maximum requests allowed in the window */
|
|
6872
6919
|
limit: number;
|
|
6873
6920
|
/** Window duration in seconds */
|
|
6874
|
-
window: number;
|
|
6921
|
+
window: number | string;
|
|
6875
6922
|
}
|
|
6876
6923
|
/**
|
|
6877
6924
|
* Set a key-value pair, with optional TTL and conditional flags.
|
|
@@ -7042,9 +7089,9 @@ declare function kvZrange(config: SylphxConfig, request: KvZrangeRequest): Promi
|
|
|
7042
7089
|
* ```ts
|
|
7043
7090
|
* // 10 requests per 60 seconds per user
|
|
7044
7091
|
* const result = await kvRateLimit(config, {
|
|
7045
|
-
*
|
|
7092
|
+
* key: `user:${userId}`,
|
|
7046
7093
|
* limit: 10,
|
|
7047
|
-
* window:
|
|
7094
|
+
* window: '60s',
|
|
7048
7095
|
* })
|
|
7049
7096
|
*
|
|
7050
7097
|
* if (!result.success) {
|
|
@@ -7516,7 +7563,7 @@ interface SandboxOptions {
|
|
|
7516
7563
|
createTimeoutMs?: number;
|
|
7517
7564
|
/** Idle timeout in ms before auto-termination (default: 300_000 = 5 min) */
|
|
7518
7565
|
idleTimeoutMs?: number;
|
|
7519
|
-
/**
|
|
7566
|
+
/** Scratch storage size in GiB at /data, scoped to the sandbox lifecycle. */
|
|
7520
7567
|
storageGi?: number;
|
|
7521
7568
|
/** CPU/memory resource spec */
|
|
7522
7569
|
resources?: {
|
|
@@ -9294,4 +9341,4 @@ declare const functions: {
|
|
|
9294
9341
|
};
|
|
9295
9342
|
};
|
|
9296
9343
|
|
|
9297
|
-
export { ACHIEVEMENT_TIER_CONFIG, type AIListModelsOptions, type AIListModelsResponse, type AIMessage, type AIMessageRole, type AIModel, type AIModelInfo, type AIModelsResponse, type AIProvider, type AIRateLimitInfo, type AIRateLimitResponse, type AIRequestType, type AIStreamChunk, type AITool, type AIToolCall, type AIUsageResponse, type AIUsageStats, type AccessTokenPayload, type AchievementCategory, type AchievementCriteria, type AchievementCriterion, type AchievementDefinition, type AchievementTier, type AchievementType, type AchievementUnlockEvent, type AdminUser, type AuditQueryFilter, type AuditQueryResult, AuthenticationError, AuthorizationError, type BackupCodesResult, type BatchEvent, type BatchIndexInput, type BatchIndexResult, type Breadcrumb, type BuildLog, type BuildLogHistoryResponse, type CaptureExceptionRequest, type CaptureMessageRequest, type ChallengeMethod, type ChallengeType, type ChallengeVerifyInput, type ChallengeVerifyResult, type ChatCompletionInput, type ChatCompletionResponse, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamChunk, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitState, type CommandResult, type ConsentCategory, type ConsentHistoryEntry, type ConsentHistoryResult, type ConsentPurposeDefaults, type ConsentType, type ContentPart, type CopyFileOptions, type CreateOrgInput, type CreatePermissionInput, type CreatePromoInput, type CreateRoleInput, type CreateRunOptions, type CreateTriggerOptions, type CriteriaOperator, type CronInput, type CronSchedule, type CronSource, type DatabaseConnectionInfo, type DatabaseStatus, type DatabaseStatusInfo, type DebugCategory, type DeduplicationConfig, type DeleteAccountResult, type DeleteDocumentInput, type DeployHistoryResponse, type DeployInfo, type DeployStatus, type DeviceApproveInput, type DeviceApproveResult, type DeviceDenyInput, type DeviceDenyResult, type DeviceGrant, type DeviceInitInput, type DevicePollResult, type DynamicRestClient, ERROR_CODE_STATUS, type EmailChangeInput, type EmailConfirmInput, type EmbedInput, type EmbedResult, type EmbeddingInput, type EmbeddingResponse, type LeaderboardEntry as EngagementLeaderboardEntry, type LeaderboardResult as EngagementLeaderboardResult, type EnvVar, type ErrorCode, type ErrorResponse, type EventSource, type ExceptionFrame, type ExceptionValue, type ExecEvent, type ExecOptions, type ExecResult, type FacetsResponse, type FileEvent, type FlagContext, type FlagResult, type GetConsentHistoryInput, type GetConsentsInput, type GetFacetsInput, type GetSecretInput, type GetSecretResult, type GetSecretsInput, type GetSecretsResult, type HttpTarget, type IdentifyInput, type ImpersonationActive, type ImpersonationEndResult, type ImpersonationInfo, type ImpersonationStartResult, type IndexDocumentInput, type IndexDocumentResult, type IngestLogsResult, InvalidConnectionUrlError, type InviteMemberInput, type InviteUserRequest, type InviteUserResponse, type KvExpireRequest, type KvHgetRequest, type KvHgetallRequest, type KvHsetRequest, type KvIncrRequest, type KvLpushRequest, type KvLrangeRequest, type KvMgetRequest, type KvMsetRequest, type KvRateLimitRequest, type KvRateLimitResult, type KvScanOptions, type KvScanResult, type KvSetOptions, type KvSetRequest, type KvZMember, type KvZaddRequest, type KvZrangeRequest, type LeaderboardAggregation, type LeaderboardDefinition, type LeaderboardEntry$1 as LeaderboardEntry, type LeaderboardOptions, type LeaderboardQueryOptions, type LeaderboardResetPeriod, type LeaderboardResult$1 as LeaderboardResult, type LeaderboardSortDirection, type LinkAnonymousConsentsInput, type ListFilesOptions, type ListPromosOptions, type ListPromosResult, type ListRedemptionsOptions, type ListRedemptionsResult, type ListRunsOptions, type ListRunsResult, type ListScheduledEmailsOptions, type ListSecretKeysInput, type ListTriggersResult, type ListUsersOptions, type ListUsersResult, type LogEntry, type LogLevel, type LoginHistoryEntry, type LoginRequest, type LoginResponse, type MeResponse, type MemberPermissionsResult, type MintAccessTokenClaims, type MintAccessTokenResult, type MonitoringResponse, type MonitoringSeverity, type NativeStepContext, type NativeTaskDefinition, type TaskRunStatus as NativeTaskRunStatus, NetworkError, NotFoundError, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthCodeExchangeInput, type OAuthProvider, type OAuthProvidersResult, type OidcDiscoveryDocument, type OidcUserInfoResponse, type OrgRole, type OrgScopedTokenResponse, type OrgTokenPayload, type OrganizationInvitation, type OrganizationMember, type OrganizationMembership, type PageInput, type PaginatedResponse, type PaginationInput, type ParsedConnectionUrl, type PasskeyRegistrationInput, type PasskeyRegistrationOptions, type PasskeySummary, type PasskeysList, type PasswordSetInput, type Permission, type PkceMethod, type Plan, type PlatformAccessTokenClaims, type PlatformFunctionsDownloadBundleResult, type PlatformLogoutInput, type PlatformPasswordChangeInput, type PlatformPasswordChangeResult, type PlatformPasswordSetInput, type PlatformPasswordSetResult, type PlatformPasswordStatusResult, type PlatformRealtimeChannel, type PlatformRealtimeCreateChannelResult, type PlatformRealtimeDeleteChannelResult, type PlatformRealtimeListChannelsResult, type PlatformRealtimeStatusResult, type PlatformRefreshInput, type PlatformRefreshResult, type PlatformSessionRenameInput, type PlatformSessionRenameResult, type PlatformSessionRevokeAllResult, type PlatformSessionRevokeInput, type PlatformSessionRevokeOtherResult, type PlatformSessionRevokeResult, type PlatformSessionsListResult, type PlatformUserDeleteInput, type PlatformUserDeleteResult, type PlatformUserExportResult, type PlatformUserRecord, type PlatformUserResolution, type ProcessEvent, type ProcessInfo, type ProcessStartOptions, type ProcessSummary, type ProjectMetadata, type PromoCode, type PromoRedemption, type PromoStatus, type PromoType, type PromoValidationPreview, type PublishEventResult, type PushCampaign, type PushCampaignStats, type PushCampaignVariant, type PushNotification, type PushNotificationPayload, type PushSegment, type PushSegmentFilter, type PushServiceWorkerConfig, type PushSubscription, type QueryLogsOptions, type QueryLogsResult, RETRYABLE_CODES, RateLimitError, type RateLimitStatusFilter, type RateLimitStatusResult, type RateLimitStrategiesFilter, type RateLimitStrategiesResult, type RateLimitStrategyDeleteInput, type RateLimitStrategyDeleteResult, type RateLimitStrategyUpsertInput, type RateLimitStrategyUpsertResult, type RealtimeEmitRequest, type RealtimeEmitResponse, type RealtimeHistoryRequest, type RealtimeHistoryResponse, type RecordActivityInput, type RecordActivityResult, type RedeemPromoInput, type RedeemPromoResult, type RedeemReferralInput, type RedeemResult, type ReferralCode, type ReferralStats, type RegisterInput, type RegisterRequest, type RegisterResponse, type ResendEmailVerificationRequest, type ResendEmailVerificationResponse, type RestClient, type RestClientConfig, type RestDynamicConfig, type RetryConfig, type RevokeTokenOptions, type Role, type RollbackDeployRequest, type Run, RunHandle, type RunLogsResult, type RunResourceSpec, type RunResult, type RunStatus, type RunTarget, type RunVolumeMount, type CreateRunOptions as RunWorkerOptions, RunsClient, SandboxClient, type SandboxFile, SandboxFiles, type SandboxOptions, SandboxProcesses, type SandboxRecord, SandboxWatch, type ScheduleEmailOptions, type ScheduledEmail, type ScheduledEmailStats, type ScheduledEmailsResult, type SearchInput, type SearchResponse, type SearchResultItem, type SearchStatsResult, type SearchType, type SecretKeyInfo, type SecurityAlert, type SecurityAlertsList, type SecurityScoreResult, type SecuritySettings, type SendEmailOptions, type SendResult, type SendTemplatedEmailOptions, type SendToUserOptions, type SessionResult, type SetConsentsInput, type SetEnvVarRequest, type SignedUrlOptions, StepCompleteSignal, StepSleepSignal, type StoredLogEntry, type StreakDefinition, type StreakFrequency, type StreakState, type StreamMessage, type SubmitScoreInput, type SubmitScoreResult, type Subscription, type SuccessResponse, type SylphxClientInput, type SylphxConfig, type SylphxConfigInput, SylphxError, type SylphxErrorCode, type SylphxErrorOptions, type TaskInput, type TaskResult, type TaskStatus, type TaskTarget, type TextCompletionInput, type TextCompletionResponse, TimeoutError, type TokenIntrospectionResult, type TokenResponse, type Tool, type ToolCall, type TrackClickInput, type TrackInput, type Trigger, type TriggerDeployRequest, type TriggerSource, type TriggerSourceType, type TriggerStatus, type TriggerTarget, type TriggerTargetType, TriggersClient, type TwoFactorEnableResult, type TwoFactorSetupResult, type TwoFactorVerifyRequest, type UpdateOrgInput, type UpdatePromoInput, type UpdateRoleInput, type UpdateTriggerOptions, type UploadCreateOptions, type UploadProgressEvent, type UpsertDocumentInput, type UpsertDocumentResult, type User, type UserAchievement, type UserConsent, type UserDataExport, type UserFullProfile, type UserProfile, type UserSecuritySettings, type UserSession, type UserSessionsList, type UserUpdateProfileInput, type ValidatePromoInput, type ValidatePromoResult, ValidationError, type VisionInput, type WatchEntry, type WatchOptions, type WebhookConfig, type WebhookConfigUpdate, type WebhookDeliveriesResult, type WebhookDelivery, type WebhookStats, RunHandle as WorkerHandle, type RunLogsResult as WorkerLogsResult, type RunResourceSpec as WorkerResourceSpec, type RunResult as WorkerResult, type Run as WorkerRun, type RunStatus as WorkerStatus, type RunVolumeMount as WorkerVolumeMount, WorkersClient, acceptAllConsents, acceptOrganizationInvitation, assignMemberRole, audit, authorizeOAuth, batchIndex, canDeleteOrganization, canManageMembers, canManageSettings, cancelScheduledEmail, cancelTask, captureException, captureExceptionRaw, captureMessage, chat, chatStream, checkFlag, complete, confirmEmailChange, cookies, createCheckout, createClient, createConfig, createCron, createDynamicRestClient, createOrganization, createPermission, createPortalSession, createPromo, createRestClient, createRole, createServerClient, createServiceWorkerScript, createStepContext, createTasksHandler, createTracker, debugError, debugLog, debugTimer, debugWarn, declineOptionalConsents, deleteCron, deleteDocument, deleteEnvVar, deleteOrganization, deletePasskey, deletePermission, deletePromo, deleteRole, deleteUser, deleteUserAccount, device, disableDebug, disableTwoFactor, disconnectOAuthProvider, dpop, embed, enableDebug, exchangeOAuthCode, exponentialBackoff, exportUserData, extendedSignUp, forgotPassword, functions, generateAnonymousId, generatePkce, getAchievement, getAchievementPoints, getAchievements, getAllFlags, getAllSecrets, getAllStreaks, getBackupCodes, getBillingBalance, getBillingUsage, getBuildLogHistory, getCircuitBreakerState, getConsentHistory, getConsentTypes, getDatabaseConnectionString, getDatabaseStatus, getDebugMode, getDeployHistory, getDeployStatus, getErrorCode, getErrorMessage, getFacets, getFlagPayload, getFlags, getLeaderboard, getMemberPermissions, getMyReferralCode, getOidcDiscoveryDocument, getOrgScopedToken, getOrganization, getOrganizationInvitations, getOrganizationMembers, getOrganizations, getPlans, getProjectMetadata, getPromo, getPushPreferences, getRealtimeHistory, getReferralLeaderboard, getReferralStats, getRestErrorMessage, getRole, getScheduledEmail, getScheduledEmailStats, getSearchStats, getSecret, getSecrets, getSecurityScore, getSession, getStreak, getSubscription, getTask, getUser, getUserByEmail, getUserConsents, getUserLeaderboardRank, getUserProfile, getUserSecurity, getVariant, getWebhookConfig, getWebhookDeliveries, getWebhookDelivery, getWebhookStats, hasAllPermissions, hasAnyPermission, hasConsent, hasError, hasPermission, hasRole, hasSecret, identify, impersonation, incrementAchievementProgress, indexDocument, ingestLogs, initPushServiceWorker, installGlobalDebugHelpers, introspectToken, inviteOrganizationMember, inviteUser, isEmailConfigured, isEnabled, isRetryableError, isSylphxError, kvDelete, kvExists, kvExpire, kvGet, kvGetJSON, kvHget, kvHgetall, kvHset, kvIncr, kvLpush, kvLrange, kvMget, kvMset, kvRateLimit, kvScan, kvSet, kvSetJSON, kvZadd, kvZrange, leaveOrganization, linkAnonymousConsents, listEnvVars, listOAuthProviders, listPasskeys, listPermissions, listPromoRedemptions, listPromos, listRoles, listScheduledEmails, listSecretKeys, listSecurityAlerts, listTasks, listUserSessions, listUsers, markAllSecurityAlertsRead, markSecurityAlertRead, oauth, page, parseOAuthCallback, password, pauseCron, platformAuth, campaigns as pushCampaigns, segments as pushSegments, queryLogs, rateLimits, realtime, realtimeEmit, recordStreakActivity, recoverStreak, redeemPromo, redeemReferralCode, refreshToken, regenerateBackupCodes, regenerateReferralCode, registerPush, registerPushServiceWorker, removeOrganizationMember, renamePasskey, renameUserSession, replayWebhookDelivery, requestEmailChange, rescheduleEmail, resendVerificationEmail, resetCircuitBreaker, resetDebugModeCache, resetPassword, resetPlatformCookieCache, resetPlatformJwksCache, resumeCron, revokeAllTokens, revokeOrganizationInvitation, revokeToken, revokeUserSession, rollbackDeploy, scheduleEmail, scheduleTask, search, sendEmail, sendEmailToUser, sendPush, sendTemplatedEmail, sessions, setConsents, setEnvVar, setPassword, setupTwoFactor, signIn, signOut, signUp, startPasskeyRegistration, storage, streamToString, submitScore, suspendUser, switchOrg, toSylphxError, track, trackBatch, trackClick, triggerDeploy, unlockAchievement, unregisterPush, updateOrganization, updateOrganizationMemberRole, updatePromo, updatePushPreferences, updateRole, updateUser, updateUserMetadata, updateUserProfile, updateWebhookConfig, upsertDocument, user, userInfo, validatePromo, verifyAccessToken, verifyChallenge, verifyEmail, verifyPasskeyRegistration, verifySignature as verifyTaskSignature, verifyTwoFactor, verifyTwoFactorEnable, withToken };
|
|
9344
|
+
export { ACHIEVEMENT_TIER_CONFIG, type AIListModelsOptions, type AIListModelsResponse, type AIMessage, type AIMessageRole, type AIModel, type AIModelInfo, type AIModelsResponse, type AIProvider, type AIRateLimitInfo, type AIRateLimitResponse, type AIRequestType, type AIStreamChunk, type AITool, type AIToolCall, type AIUsageResponse, type AIUsageStats, type AccessTokenPayload, type AchievementCategory, type AchievementCriteria, type AchievementCriterion, type AchievementDefinition, type AchievementTier, type AchievementType, type AchievementUnlockEvent, type AdminUser, type AuditQueryFilter, type AuditQueryResult, AuthenticationError, AuthorizationError, type BackupCodesResult, type BatchEvent, type BatchIndexInput, type BatchIndexResult, type Breadcrumb, type BuildLog, type BuildLogHistoryResponse, type CaptureExceptionRequest, type CaptureMessageRequest, type ChallengeMethod, type ChallengeType, type ChallengeVerifyInput, type ChallengeVerifyResult, type ChatCompletionInput, type ChatCompletionResponse, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamChunk, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitState, type CommandResult, type ConsentCategory, type ConsentHistoryEntry, type ConsentHistoryResult, type ConsentPurposeDefaults, type ConsentType, type ContentPart, type CopyFileOptions, type CreateOrgInput, type CreatePermissionInput, type CreatePromoInput, type CreateRoleInput, type CreateRunOptions, type CreateTriggerOptions, type CriteriaOperator, type CronInput, type CronSchedule, type CronSource, type DatabaseConnectionInfo, type DatabaseStatus, type DatabaseStatusInfo, type DebugCategory, type DeduplicationConfig, type DeleteAccountResult, type DeleteDocumentInput, type DeployHistoryResponse, type DeployInfo, type DeployStatus, type DeviceApproveInput, type DeviceApproveResult, type DeviceDenyInput, type DeviceDenyResult, type DeviceGrant, type DeviceInitInput, type DevicePollResult, type DynamicRestClient, ERROR_CODE_STATUS, type EmailChangeInput, type EmailConfirmInput, type EmbedInput, type EmbedResult, type EmbeddingInput, type EmbeddingResponse, type LeaderboardEntry as EngagementLeaderboardEntry, type LeaderboardResult as EngagementLeaderboardResult, type EnvVar, type ErrorCode, type ErrorResponse, type EventSource, type ExceptionFrame, type ExceptionValue, type ExecEvent, type ExecOptions, type ExecResult, type FacetsResponse, type FileEvent, type FlagContext, type FlagResult, type GetConsentHistoryInput, type GetConsentsInput, type GetFacetsInput, type GetSecretInput, type GetSecretResult, type GetSecretsInput, type GetSecretsResult, type HttpTarget, type IdentifyInput, type ImpersonationActive, type ImpersonationEndResult, type ImpersonationInfo, type ImpersonationStartResult, type IndexDocumentInput, type IndexDocumentResult, type IngestLogsResult, InvalidConnectionUrlError, type InviteMemberInput, type InviteUserRequest, type InviteUserResponse, type KvExpireRequest, type KvHgetRequest, type KvHgetallRequest, type KvHsetRequest, type KvIncrRequest, type KvLpushRequest, type KvLrangeRequest, type KvMgetRequest, type KvMsetRequest, type KvRateLimitRequest, type KvRateLimitResult, type KvScanOptions, type KvScanResult, type KvSetOptions, type KvSetRequest, type KvZMember, type KvZaddRequest, type KvZrangeRequest, type LeaderboardAggregation, type LeaderboardDefinition, type LeaderboardEntry$1 as LeaderboardEntry, type LeaderboardOptions, type LeaderboardQueryOptions, type LeaderboardResetPeriod, type LeaderboardResult$1 as LeaderboardResult, type LeaderboardSortDirection, type LinkAnonymousConsentsInput, type ListFilesOptions, type ListPromosOptions, type ListPromosResult, type ListRedemptionsOptions, type ListRedemptionsResult, type ListRunsOptions, type ListRunsResult, type ListScheduledEmailsOptions, type ListSecretKeysInput, type ListTriggersResult, type ListUsersOptions, type ListUsersResult, type LogEntry, type LogLevel, type LoginHistoryEntry, type LoginRequest, type LoginResponse, type MeResponse, type MemberPermissionsResult, type MintAccessTokenClaims, type MintAccessTokenResult, type MonitoringResponse, type MonitoringSeverity, type NativeStepContext, type NativeTaskDefinition, type TaskRunStatus as NativeTaskRunStatus, NetworkError, NotFoundError, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthCodeExchangeInput, type OAuthProvider, type OAuthProvidersResult, type OidcDiscoveryDocument, type OidcUserInfoResponse, type OrgRole, type OrgScopedTokenResponse, type OrgTokenPayload, type OrganizationInvitation, type OrganizationMember, type OrganizationMembership, type OrganizationsListResult, type PageInput, type PaginatedResponse, type PaginationInput, type ParsedConnectionUrl, type PasskeyRegistrationInput, type PasskeyRegistrationOptions, type PasskeySummary, type PasskeysList, type PasswordSetInput, type Permission, type PkceMethod, type Plan, type PlatformAccessTokenClaims, type PlatformFunctionsDownloadBundleResult, type PlatformLogoutInput, type PlatformPasswordChangeInput, type PlatformPasswordChangeResult, type PlatformPasswordSetInput, type PlatformPasswordSetResult, type PlatformPasswordStatusResult, type PlatformRealtimeChannel, type PlatformRealtimeCreateChannelResult, type PlatformRealtimeDeleteChannelResult, type PlatformRealtimeListChannelsResult, type PlatformRealtimeStatusResult, type PlatformRefreshInput, type PlatformRefreshResult, type PlatformSessionRenameInput, type PlatformSessionRenameResult, type PlatformSessionRevokeAllResult, type PlatformSessionRevokeInput, type PlatformSessionRevokeOtherResult, type PlatformSessionRevokeResult, type PlatformSessionsListResult, type PlatformUserDeleteInput, type PlatformUserDeleteResult, type PlatformUserExportResult, type PlatformUserRecord, type PlatformUserResolution, type ProcessEvent, type ProcessInfo, type ProcessStartOptions, type ProcessSummary, type ProjectMetadata, type PromoCode, type PromoRedemption, type PromoStatus, type PromoType, type PromoValidationPreview, type PublishEventResult, type PushCampaign, type PushCampaignStats, type PushCampaignVariant, type PushNotification, type PushNotificationPayload, type PushSegment, type PushSegmentFilter, type PushServiceWorkerConfig, type PushSubscription, type QueryLogsOptions, type QueryLogsResult, RETRYABLE_CODES, RateLimitError, type RateLimitStatusFilter, type RateLimitStatusResult, type RateLimitStrategiesFilter, type RateLimitStrategiesResult, type RateLimitStrategyDeleteInput, type RateLimitStrategyDeleteResult, type RateLimitStrategyUpsertInput, type RateLimitStrategyUpsertResult, type RealtimeEmitRequest, type RealtimeEmitResponse, type RealtimeHistoryRequest, type RealtimeHistoryResponse, type RecordActivityInput, type RecordActivityResult, type RedeemPromoInput, type RedeemPromoResult, type RedeemReferralInput, type RedeemResult, type ReferralCode, type ReferralStats, type RegisterInput, type RegisterRequest, type RegisterResponse, type ResendEmailVerificationRequest, type ResendEmailVerificationResponse, type RestClient, type RestClientConfig, type RestDynamicConfig, type RetryConfig, type RevokeTokenOptions, type Role, type RollbackDeployRequest, type Run, RunHandle, type RunLogsResult, type RunResourceSpec, type RunResult, type RunStatus, type RunTarget, type RunVolumeMount, type CreateRunOptions as RunWorkerOptions, RunsClient, SandboxClient, type SandboxFile, SandboxFiles, type SandboxOptions, SandboxProcesses, type SandboxRecord, SandboxWatch, type ScheduleEmailOptions, type ScheduledEmail, type ScheduledEmailStats, type ScheduledEmailsResult, type SearchInput, type SearchResponse, type SearchResultItem, type SearchStatsResult, type SearchType, type SecretKeyInfo, type SecurityAlert, type SecurityAlertsList, type SecurityScoreResult, type SecuritySettings, type SendEmailOptions, type SendResult, type SendTemplatedEmailOptions, type SendToUserOptions, type SessionResult, type SetConsentsInput, type SetEnvVarRequest, type SignedUrlOptions, StepCompleteSignal, StepSleepSignal, type StoredLogEntry, type StreakDefinition, type StreakFrequency, type StreakState, type StreamMessage, type SubmitScoreInput, type SubmitScoreResult, type Subscription, type SuccessResponse, type SylphxClientInput, type SylphxConfig, type SylphxConfigInput, SylphxError, type SylphxErrorCode, type SylphxErrorOptions, type TaskInput, type TaskResult, type TaskStatus, type TaskTarget, type TextCompletionInput, type TextCompletionResponse, TimeoutError, type TokenIntrospectionResult, type TokenResponse, type Tool, type ToolCall, type TrackClickInput, type TrackInput, type Trigger, type TriggerDeployRequest, type TriggerSource, type TriggerSourceType, type TriggerStatus, type TriggerTarget, type TriggerTargetType, TriggersClient, type TwoFactorEnableResult, type TwoFactorSetupResult, type TwoFactorVerifyRequest, type UpdateOrgInput, type UpdatePromoInput, type UpdateRoleInput, type UpdateTriggerOptions, type UploadCreateOptions, type UploadProgressEvent, type UpsertDocumentInput, type UpsertDocumentResult, type User, type UserAchievement, type UserConsent, type UserDataExport, type UserFullProfile, type UserOrganization, type UserProfile, type UserSecuritySettings, type UserSession, type UserSessionsList, type UserUpdateProfileInput, type ValidatePromoInput, type ValidatePromoResult, ValidationError, type VisionInput, type WatchEntry, type WatchOptions, type WebhookConfig, type WebhookConfigUpdate, type WebhookDeliveriesResult, type WebhookDelivery, type WebhookStats, RunHandle as WorkerHandle, type RunLogsResult as WorkerLogsResult, type RunResourceSpec as WorkerResourceSpec, type RunResult as WorkerResult, type Run as WorkerRun, type RunStatus as WorkerStatus, type RunVolumeMount as WorkerVolumeMount, WorkersClient, acceptAllConsents, acceptOrganizationInvitation, assignMemberRole, audit, authorizeOAuth, batchIndex, canDeleteOrganization, canManageMembers, canManageSettings, cancelScheduledEmail, cancelTask, captureException, captureExceptionRaw, captureMessage, chat, chatStream, checkFlag, complete, confirmEmailChange, cookies, createCheckout, createClient, createConfig, createCron, createDynamicRestClient, createOrganization, createPermission, createPortalSession, createPromo, createRestClient, createRole, createServerClient, createServiceWorkerScript, createStepContext, createTasksHandler, createTracker, debugError, debugLog, debugTimer, debugWarn, declineOptionalConsents, deleteCron, deleteDocument, deleteEnvVar, deleteOrganization, deletePasskey, deletePermission, deletePromo, deleteRole, deleteUser, deleteUserAccount, device, disableDebug, disableTwoFactor, disconnectOAuthProvider, dpop, embed, enableDebug, exchangeOAuthCode, exponentialBackoff, exportUserData, extendedSignUp, forgotPassword, functions, generateAnonymousId, generatePkce, getAchievement, getAchievementPoints, getAchievements, getAllFlags, getAllSecrets, getAllStreaks, getBackupCodes, getBillingBalance, getBillingUsage, getBuildLogHistory, getCircuitBreakerState, getConsentHistory, getConsentTypes, getDatabaseConnectionString, getDatabaseStatus, getDebugMode, getDeployHistory, getDeployStatus, getErrorCode, getErrorMessage, getFacets, getFlagPayload, getFlags, getLeaderboard, getMemberPermissions, getMyReferralCode, getOidcDiscoveryDocument, getOrgScopedToken, getOrganization, getOrganizationInvitations, getOrganizationMembers, getOrganizations, getPlans, getProjectMetadata, getPromo, getPushPreferences, getRealtimeHistory, getReferralLeaderboard, getReferralStats, getRestErrorMessage, getRole, getScheduledEmail, getScheduledEmailStats, getSearchStats, getSecret, getSecrets, getSecurityScore, getSession, getStreak, getSubscription, getTask, getUser, getUserByEmail, getUserConsents, getUserLeaderboardRank, getUserProfile, getUserSecurity, getVariant, getWebhookConfig, getWebhookDeliveries, getWebhookDelivery, getWebhookStats, hasAllPermissions, hasAnyPermission, hasConsent, hasError, hasPermission, hasRole, hasSecret, identify, impersonation, incrementAchievementProgress, indexDocument, ingestLogs, initPushServiceWorker, installGlobalDebugHelpers, introspectToken, inviteOrganizationMember, inviteUser, isEmailConfigured, isEnabled, isRetryableError, isSylphxError, kvDelete, kvExists, kvExpire, kvGet, kvGetJSON, kvHget, kvHgetall, kvHset, kvIncr, kvLpush, kvLrange, kvMget, kvMset, kvRateLimit, kvScan, kvSet, kvSetJSON, kvZadd, kvZrange, leaveOrganization, linkAnonymousConsents, listEnvVars, listOAuthProviders, listOrganizations, listPasskeys, listPermissions, listPromoRedemptions, listPromos, listRoles, listScheduledEmails, listSecretKeys, listSecurityAlerts, listTasks, listUserSessions, listUsers, markAllSecurityAlertsRead, markSecurityAlertRead, oauth, page, parseOAuthCallback, password, pauseCron, platformAuth, campaigns as pushCampaigns, segments as pushSegments, queryLogs, rateLimits, realtime, realtimeEmit, recordStreakActivity, recoverStreak, redeemPromo, redeemReferralCode, refreshToken, regenerateBackupCodes, regenerateReferralCode, registerPush, registerPushServiceWorker, removeOrganizationMember, renamePasskey, renameUserSession, replayWebhookDelivery, requestEmailChange, rescheduleEmail, resendVerificationEmail, resetCircuitBreaker, resetDebugModeCache, resetPassword, resetPlatformCookieCache, resetPlatformJwksCache, resumeCron, revokeAllTokens, revokeOrganizationInvitation, revokeToken, revokeUserSession, rollbackDeploy, scheduleEmail, scheduleTask, search, sendEmail, sendEmailToUser, sendPush, sendTemplatedEmail, sessions, setConsents, setEnvVar, setPassword, setupTwoFactor, signIn, signOut, signUp, startPasskeyRegistration, storage, streamToString, submitScore, suspendUser, switchOrg, toSylphxError, track, trackBatch, trackClick, triggerDeploy, unlockAchievement, unregisterPush, updateOrganization, updateOrganizationMemberRole, updatePromo, updatePushPreferences, updateRole, updateUser, updateUserMetadata, updateUserProfile, updateWebhookConfig, upsertDocument, user, userInfo, validatePromo, verifyAccessToken, verifyChallenge, verifyEmail, verifyPasskeyRegistration, verifySignature as verifyTaskSignature, verifyTwoFactor, verifyTwoFactorEnable, withToken };
|
package/dist/index.mjs
CHANGED
|
@@ -8138,6 +8138,7 @@ var PATHS = {
|
|
|
8138
8138
|
uploadPart: (id, n) => `/storage/uploads/${encodeURIComponent(String(id))}/parts/${n}`,
|
|
8139
8139
|
files: "/storage/files",
|
|
8140
8140
|
file: (id) => `/storage/files/${encodeURIComponent(String(id))}`,
|
|
8141
|
+
fileTakedown: (id) => `/storage/files/${encodeURIComponent(String(id))}:takedown`,
|
|
8141
8142
|
fileRestore: (id) => `/storage/files/${encodeURIComponent(String(id))}:restore`,
|
|
8142
8143
|
fileSignedUrl: (id) => `/storage/files/${encodeURIComponent(String(id))}:signedUrl`,
|
|
8143
8144
|
fileCopy: (id) => `/storage/files/${encodeURIComponent(String(id))}:copy`,
|
|
@@ -8462,6 +8463,12 @@ async function filesGet(config, fileId) {
|
|
|
8462
8463
|
async function filesDelete(config, fileId) {
|
|
8463
8464
|
return callApi(config, PATHS.file(fileId), { method: "DELETE" });
|
|
8464
8465
|
}
|
|
8466
|
+
async function filesTakedown(config, fileId, options) {
|
|
8467
|
+
return callApi(config, PATHS.fileTakedown(fileId), {
|
|
8468
|
+
method: "POST",
|
|
8469
|
+
body: options
|
|
8470
|
+
});
|
|
8471
|
+
}
|
|
8465
8472
|
async function filesRestore(config, fileId) {
|
|
8466
8473
|
return callApi(config, PATHS.fileRestore(fileId), { method: "POST" });
|
|
8467
8474
|
}
|
|
@@ -8506,6 +8513,7 @@ var storage = {
|
|
|
8506
8513
|
list: filesList,
|
|
8507
8514
|
get: filesGet,
|
|
8508
8515
|
delete: filesDelete,
|
|
8516
|
+
takedown: filesTakedown,
|
|
8509
8517
|
restore: filesRestore,
|
|
8510
8518
|
signedUrl: filesSignedUrl,
|
|
8511
8519
|
copy: filesCopy,
|
|
@@ -8668,6 +8676,16 @@ async function registerPushServiceWorker(swPath = "/sw.js") {
|
|
|
8668
8676
|
}
|
|
8669
8677
|
|
|
8670
8678
|
// src/notifications.ts
|
|
8679
|
+
function resolveSentCount(result) {
|
|
8680
|
+
if (result.sent !== void 0) return result.sent;
|
|
8681
|
+
if (result.sentTo !== void 0) return result.sentTo;
|
|
8682
|
+
return result.status === "delivered" ? 1 : 0;
|
|
8683
|
+
}
|
|
8684
|
+
function resolveFailedCount(result) {
|
|
8685
|
+
if (result.failed !== void 0) return result.failed;
|
|
8686
|
+
if (result.expired !== void 0) return result.expired;
|
|
8687
|
+
return result.status === "failed" ? 1 : 0;
|
|
8688
|
+
}
|
|
8671
8689
|
async function registerPush(config, subscription) {
|
|
8672
8690
|
await callApi(config, "/notifications/register", {
|
|
8673
8691
|
method: "POST",
|
|
@@ -8688,10 +8706,19 @@ async function sendPush(config, userId, notification) {
|
|
|
8688
8706
|
...notification.icon !== void 0 && { icon: notification.icon },
|
|
8689
8707
|
...notification.url !== void 0 && { url: notification.url }
|
|
8690
8708
|
};
|
|
8691
|
-
|
|
8709
|
+
const result = await callApi(config, "/notifications/send", {
|
|
8692
8710
|
method: "POST",
|
|
8693
8711
|
body
|
|
8694
8712
|
});
|
|
8713
|
+
const sent = resolveSentCount(result);
|
|
8714
|
+
const failed = resolveFailedCount(result);
|
|
8715
|
+
return {
|
|
8716
|
+
...result,
|
|
8717
|
+
sent,
|
|
8718
|
+
failed,
|
|
8719
|
+
sentTo: result.sentTo ?? sent,
|
|
8720
|
+
expired: result.expired ?? failed
|
|
8721
|
+
};
|
|
8695
8722
|
}
|
|
8696
8723
|
async function getPushPreferences(config) {
|
|
8697
8724
|
return callApi(config, "/notifications/preferences", { method: "GET" });
|
|
@@ -9367,8 +9394,21 @@ async function getAchievementPoints(config, userId) {
|
|
|
9367
9394
|
}
|
|
9368
9395
|
|
|
9369
9396
|
// src/orgs.ts
|
|
9397
|
+
import {
|
|
9398
|
+
organizationsEndpoints
|
|
9399
|
+
} from "@sylphx/contract";
|
|
9370
9400
|
async function getOrganizations(config) {
|
|
9371
|
-
|
|
9401
|
+
const endpoint = organizationsEndpoints.memberships;
|
|
9402
|
+
return callApi(config, endpoint.path, {
|
|
9403
|
+
method: endpoint.method
|
|
9404
|
+
});
|
|
9405
|
+
}
|
|
9406
|
+
async function listOrganizations(config, options = {}) {
|
|
9407
|
+
const endpoint = organizationsEndpoints.list;
|
|
9408
|
+
return callApi(config, endpoint.path, {
|
|
9409
|
+
method: endpoint.method,
|
|
9410
|
+
query: options
|
|
9411
|
+
});
|
|
9372
9412
|
}
|
|
9373
9413
|
async function getOrganization(config, orgIdOrSlug) {
|
|
9374
9414
|
return callApi(config, `/orgs/${orgIdOrSlug}`);
|
|
@@ -9711,13 +9751,39 @@ function interpolatePath2(template, params) {
|
|
|
9711
9751
|
}
|
|
9712
9752
|
return path;
|
|
9713
9753
|
}
|
|
9754
|
+
var KV_PATHS = {
|
|
9755
|
+
mset: "/kv/mset",
|
|
9756
|
+
mget: "/kv/mget",
|
|
9757
|
+
hset: "/kv/hset",
|
|
9758
|
+
hget: "/kv/hget",
|
|
9759
|
+
hgetall: "/kv/hgetall",
|
|
9760
|
+
lpush: "/kv/lpush",
|
|
9761
|
+
lrange: "/kv/lrange",
|
|
9762
|
+
zadd: "/kv/zadd",
|
|
9763
|
+
zrange: "/kv/zrange"
|
|
9764
|
+
};
|
|
9765
|
+
function toLegacyOkResult(result) {
|
|
9766
|
+
if (result.success !== void 0) return { ok: result.success };
|
|
9767
|
+
if (result.ok !== void 0) return { ok: result.ok };
|
|
9768
|
+
return { ok: false };
|
|
9769
|
+
}
|
|
9770
|
+
function resolveCreatedCount(result) {
|
|
9771
|
+
if (result.created !== void 0) return result.created;
|
|
9772
|
+
if (result.count !== void 0) return result.count;
|
|
9773
|
+
return 0;
|
|
9774
|
+
}
|
|
9714
9775
|
async function kvSet(config, request) {
|
|
9715
|
-
const
|
|
9776
|
+
const { ttl, ...rest } = request;
|
|
9777
|
+
const body = {
|
|
9778
|
+
...rest,
|
|
9779
|
+
...rest.ex === void 0 && ttl !== void 0 ? { ex: ttl } : {}
|
|
9780
|
+
};
|
|
9716
9781
|
const endpoint = kvEndpoints.set;
|
|
9717
|
-
|
|
9782
|
+
const result = await callApi(config, endpoint.path, {
|
|
9718
9783
|
method: endpoint.method,
|
|
9719
9784
|
body
|
|
9720
9785
|
});
|
|
9786
|
+
return toLegacyOkResult(result);
|
|
9721
9787
|
}
|
|
9722
9788
|
async function kvGet(config, key) {
|
|
9723
9789
|
const endpoint = kvEndpoints.get;
|
|
@@ -9743,10 +9809,11 @@ async function kvExists(config, key) {
|
|
|
9743
9809
|
async function kvExpire(config, request) {
|
|
9744
9810
|
const body = request;
|
|
9745
9811
|
const endpoint = kvEndpoints.expire;
|
|
9746
|
-
|
|
9812
|
+
const result = await callApi(config, endpoint.path, {
|
|
9747
9813
|
method: endpoint.method,
|
|
9748
9814
|
body
|
|
9749
9815
|
});
|
|
9816
|
+
return toLegacyOkResult(result);
|
|
9750
9817
|
}
|
|
9751
9818
|
async function kvIncr(config, request) {
|
|
9752
9819
|
const body = request;
|
|
@@ -9757,66 +9824,88 @@ async function kvIncr(config, request) {
|
|
|
9757
9824
|
});
|
|
9758
9825
|
}
|
|
9759
9826
|
async function kvMset(config, request) {
|
|
9760
|
-
|
|
9827
|
+
const result = await callApi(config, KV_PATHS.mset, {
|
|
9761
9828
|
method: "POST",
|
|
9762
9829
|
body: request
|
|
9763
9830
|
});
|
|
9831
|
+
return toLegacyOkResult(result);
|
|
9764
9832
|
}
|
|
9765
9833
|
async function kvMget(config, request) {
|
|
9766
|
-
const result = await callApi(
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9834
|
+
const result = await callApi(
|
|
9835
|
+
config,
|
|
9836
|
+
KV_PATHS.mget,
|
|
9837
|
+
{
|
|
9838
|
+
method: "POST",
|
|
9839
|
+
body: request
|
|
9840
|
+
}
|
|
9841
|
+
);
|
|
9842
|
+
const values = result.values;
|
|
9843
|
+
if (Array.isArray(values)) {
|
|
9844
|
+
return values;
|
|
9845
|
+
}
|
|
9846
|
+
return request.keys.map((key) => values[key] ?? null);
|
|
9771
9847
|
}
|
|
9772
9848
|
async function kvHset(config, request) {
|
|
9773
|
-
|
|
9849
|
+
const result = await callApi(config, KV_PATHS.hset, {
|
|
9774
9850
|
method: "POST",
|
|
9775
9851
|
body: request
|
|
9776
9852
|
});
|
|
9853
|
+
return { count: resolveCreatedCount(result) };
|
|
9777
9854
|
}
|
|
9778
9855
|
async function kvHget(config, request) {
|
|
9779
|
-
const result = await callApi(config,
|
|
9856
|
+
const result = await callApi(config, KV_PATHS.hget, {
|
|
9780
9857
|
method: "POST",
|
|
9781
9858
|
body: request
|
|
9782
9859
|
});
|
|
9783
9860
|
return result.value;
|
|
9784
9861
|
}
|
|
9785
9862
|
async function kvHgetall(config, request) {
|
|
9786
|
-
const result = await callApi(config,
|
|
9863
|
+
const result = await callApi(config, KV_PATHS.hgetall, {
|
|
9787
9864
|
method: "POST",
|
|
9788
9865
|
body: request
|
|
9789
9866
|
});
|
|
9790
|
-
return result.
|
|
9867
|
+
if (result.fields !== void 0) return result.fields;
|
|
9868
|
+
if (result.value !== void 0) return result.value;
|
|
9869
|
+
return null;
|
|
9791
9870
|
}
|
|
9792
9871
|
async function kvLpush(config, request) {
|
|
9793
|
-
return callApi(config,
|
|
9872
|
+
return callApi(config, KV_PATHS.lpush, {
|
|
9794
9873
|
method: "POST",
|
|
9795
9874
|
body: request
|
|
9796
9875
|
});
|
|
9797
9876
|
}
|
|
9798
9877
|
async function kvLrange(config, request) {
|
|
9799
|
-
const result = await callApi(config,
|
|
9878
|
+
const result = await callApi(config, KV_PATHS.lrange, {
|
|
9800
9879
|
method: "POST",
|
|
9801
9880
|
body: request
|
|
9802
9881
|
});
|
|
9803
|
-
return result.
|
|
9882
|
+
if (result.values !== void 0) return result.values;
|
|
9883
|
+
if (result.items !== void 0) return result.items;
|
|
9884
|
+
return [];
|
|
9804
9885
|
}
|
|
9805
9886
|
async function kvZadd(config, request) {
|
|
9806
|
-
return callApi(config,
|
|
9887
|
+
return callApi(config, KV_PATHS.zadd, {
|
|
9807
9888
|
method: "POST",
|
|
9808
9889
|
body: request
|
|
9809
9890
|
});
|
|
9810
9891
|
}
|
|
9811
9892
|
async function kvZrange(config, request) {
|
|
9812
|
-
const result = await callApi(config,
|
|
9893
|
+
const result = await callApi(config, KV_PATHS.zrange, {
|
|
9813
9894
|
method: "POST",
|
|
9814
9895
|
body: request
|
|
9815
9896
|
});
|
|
9816
9897
|
return result.members;
|
|
9817
9898
|
}
|
|
9818
9899
|
async function kvRateLimit(config, request) {
|
|
9819
|
-
const
|
|
9900
|
+
const key = request.key ?? request.identifier;
|
|
9901
|
+
if (!key) {
|
|
9902
|
+
throw new Error("kvRateLimit requires `key`");
|
|
9903
|
+
}
|
|
9904
|
+
const body = {
|
|
9905
|
+
key,
|
|
9906
|
+
limit: request.limit,
|
|
9907
|
+
window: typeof request.window === "number" ? `${request.window}s` : request.window
|
|
9908
|
+
};
|
|
9820
9909
|
const endpoint = kvEndpoints.rateLimit;
|
|
9821
9910
|
return callApi(config, endpoint.path, {
|
|
9822
9911
|
method: endpoint.method,
|
|
@@ -11089,6 +11178,7 @@ export {
|
|
|
11089
11178
|
linkAnonymousConsents,
|
|
11090
11179
|
listEnvVars,
|
|
11091
11180
|
listOAuthProviders,
|
|
11181
|
+
listOrganizations,
|
|
11092
11182
|
listPasskeys,
|
|
11093
11183
|
listPermissions,
|
|
11094
11184
|
listPromoRedemptions,
|