@sylphx/sdk 0.10.0 → 0.10.2
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 +13 -12
- package/dist/health/index.d.ts +681 -0
- package/dist/index.d.ts +43 -23
- package/dist/index.mjs +81 -102
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.d.ts +19 -6
- package/dist/nextjs/index.mjs +127 -22
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +20 -12
- package/dist/react/index.mjs +199 -153
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +41 -34
- package/dist/server/index.mjs +81 -66
- package/dist/server/index.mjs.map +1 -1
- package/dist/web-analytics.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ interface PlatformRealtimeDeleteChannelResult {
|
|
|
95
95
|
*
|
|
96
96
|
* Invariants:
|
|
97
97
|
* - Protocol is always `sylphx:` (no exceptions)
|
|
98
|
-
* - Credential matches `(pk|sk)_(dev|stg|prod|prev)_
|
|
98
|
+
* - Credential matches `(pk|sk)_(dev|stg|prod|prev)(_{ref})?_{hex}`
|
|
99
99
|
* - Host's first DNS label is the resource slug (validated by slug regex)
|
|
100
100
|
* - `apiBaseUrl` is always HTTPS, with `/v{version}` appended (default `v1`)
|
|
101
101
|
*
|
|
@@ -135,7 +135,7 @@ declare class InvalidConnectionUrlError extends Error {
|
|
|
135
135
|
* import { createClient } from '@sylphx/sdk'
|
|
136
136
|
*
|
|
137
137
|
* const sylphx = createClient(process.env.SYLPHX_URL!)
|
|
138
|
-
* // Parses: sylphx://pk_prod_{hex}@bold-river-a1b2c3.api.sylphx.com
|
|
138
|
+
* // Parses: sylphx://pk_prod_{ref?}_{hex}@bold-river-a1b2c3.api.sylphx.com
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
141
|
|
|
@@ -207,7 +207,7 @@ interface SylphxClientInput {
|
|
|
207
207
|
* @example Connection URL (recommended)
|
|
208
208
|
* ```typescript
|
|
209
209
|
* const sylphx = createClient(process.env.NEXT_PUBLIC_SYLPHX_URL!)
|
|
210
|
-
* // Parses: sylphx://pk_prod_{hex}@bold-river-a1b2c3.api.sylphx.com
|
|
210
|
+
* // Parses: sylphx://pk_prod_{ref?}_{hex}@bold-river-a1b2c3.api.sylphx.com
|
|
211
211
|
* ```
|
|
212
212
|
*
|
|
213
213
|
* @example Explicit components
|
|
@@ -228,7 +228,7 @@ declare function createClient(input: string | SylphxClientInput): SylphxConfig;
|
|
|
228
228
|
* @example Connection URL (recommended)
|
|
229
229
|
* ```typescript
|
|
230
230
|
* const sylphx = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
231
|
-
* // Parses: sylphx://sk_prod_{hex}@bold-river-a1b2c3.api.sylphx.com
|
|
231
|
+
* // Parses: sylphx://sk_prod_{ref?}_{hex}@bold-river-a1b2c3.api.sylphx.com
|
|
232
232
|
* ```
|
|
233
233
|
*
|
|
234
234
|
* @example Explicit components
|
|
@@ -354,7 +354,7 @@ declare function installGlobalDebugHelpers(): void;
|
|
|
354
354
|
* import { createRestClient } from '@sylphx/sdk'
|
|
355
355
|
*
|
|
356
356
|
* const client = createRestClient({
|
|
357
|
-
* secretKey: process.env.
|
|
357
|
+
* secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey!,
|
|
358
358
|
* })
|
|
359
359
|
*
|
|
360
360
|
* const { data: user, error } = await client.GET('/auth/me')
|
|
@@ -488,6 +488,10 @@ interface Middleware {
|
|
|
488
488
|
onRequest?: (ctx: {
|
|
489
489
|
request: Request;
|
|
490
490
|
}) => Promise<Request | undefined> | Request | undefined;
|
|
491
|
+
onFetch?: (ctx: {
|
|
492
|
+
request: Request;
|
|
493
|
+
next: (request: Request) => Promise<Response>;
|
|
494
|
+
}) => Promise<Response | undefined> | Response | undefined;
|
|
491
495
|
onResponse?: (ctx: {
|
|
492
496
|
request: Request;
|
|
493
497
|
response: Response;
|
|
@@ -573,7 +577,7 @@ declare function getCircuitBreakerState(): {
|
|
|
573
577
|
* @example
|
|
574
578
|
* ```typescript
|
|
575
579
|
* const client = createRestClient({
|
|
576
|
-
* secretKey: process.env.
|
|
580
|
+
* secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey!,
|
|
577
581
|
* })
|
|
578
582
|
*
|
|
579
583
|
* const { data: user } = await client.GET('/auth/me')
|
|
@@ -594,7 +598,7 @@ declare function createRestClient(config: RestClientConfig): RestClient;
|
|
|
594
598
|
* @example
|
|
595
599
|
* ```typescript
|
|
596
600
|
* const client = createDynamicRestClient({
|
|
597
|
-
* secretKey: process.env.
|
|
601
|
+
* secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey!,
|
|
598
602
|
* getAccessToken: async () => (await cookies()).get('session')?.value,
|
|
599
603
|
* })
|
|
600
604
|
* ```
|
|
@@ -1912,6 +1916,18 @@ interface OrgTokenPayload {
|
|
|
1912
1916
|
/** RBAC role key (e.g. "hr_manager", "admin"). Permissions resolved server-side. */
|
|
1913
1917
|
org_role: string;
|
|
1914
1918
|
}
|
|
1919
|
+
interface OrgScopedTokenResponse {
|
|
1920
|
+
/** Org-scoped access token. */
|
|
1921
|
+
token: string;
|
|
1922
|
+
/** Org-scoped access token, matching the SDK's token naming convention. */
|
|
1923
|
+
accessToken: string;
|
|
1924
|
+
/** Token lifetime in seconds, when provided by the runtime. */
|
|
1925
|
+
expiresIn?: number;
|
|
1926
|
+
/** Bearer token type, when provided by the runtime. */
|
|
1927
|
+
tokenType?: string;
|
|
1928
|
+
/** User envelope returned by the runtime for session hydration. */
|
|
1929
|
+
user?: User;
|
|
1930
|
+
}
|
|
1915
1931
|
/**
|
|
1916
1932
|
* Invite a user request payload.
|
|
1917
1933
|
*/
|
|
@@ -2129,9 +2145,14 @@ declare function inviteUser(config: SylphxConfig, input: InviteUserRequest): Pro
|
|
|
2129
2145
|
* The returned access_token JWT includes org_id, org_slug, org_role claims.
|
|
2130
2146
|
*
|
|
2131
2147
|
* @example
|
|
2132
|
-
* const
|
|
2148
|
+
* const { token } = await getOrgScopedToken(withToken(config, currentToken), 'org_xxx')
|
|
2149
|
+
*/
|
|
2150
|
+
declare function getOrgScopedToken(config: SylphxConfig, orgId: string): Promise<OrgScopedTokenResponse>;
|
|
2151
|
+
/**
|
|
2152
|
+
* @deprecated Use getOrgScopedToken(config, orgId). Kept as the shorter
|
|
2153
|
+
* organization switch alias for existing SDK callers.
|
|
2133
2154
|
*/
|
|
2134
|
-
declare function switchOrg(config: SylphxConfig, orgId: string): Promise<
|
|
2155
|
+
declare function switchOrg(config: SylphxConfig, orgId: string): Promise<OrgScopedTokenResponse>;
|
|
2135
2156
|
type DeviceInitInput = DeviceInitRequest;
|
|
2136
2157
|
type DeviceGrant = DeviceInitResponse;
|
|
2137
2158
|
type DevicePollResult = DevicePollResponse;
|
|
@@ -3371,7 +3392,7 @@ interface StreamMessage<T = unknown> {
|
|
|
3371
3392
|
* import { createConfig, realtimeEmit } from '@sylphx/sdk'
|
|
3372
3393
|
*
|
|
3373
3394
|
* // Server: emit events to connected clients
|
|
3374
|
-
* const config = createConfig({ secretKey: process.env.
|
|
3395
|
+
* const config = createConfig({ secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey! })
|
|
3375
3396
|
* await realtimeEmit(config, {
|
|
3376
3397
|
* channel: 'orders',
|
|
3377
3398
|
* event: 'order.created',
|
|
@@ -3694,9 +3715,8 @@ declare function createTracker(config: SylphxConfig, defaultAnonymousId?: string
|
|
|
3694
3715
|
* Features (built-in defaults, ADR-100 §2.8):
|
|
3695
3716
|
* - Idempotency-Key auto-generated (UUIDv7) on every POST
|
|
3696
3717
|
* - Single-part PUT or multipart, picked server-side from `size`
|
|
3697
|
-
* - Streaming SHA-256
|
|
3698
|
-
* - Resumable: persists `(uploadId, completedParts[])` to localStorage
|
|
3699
|
-
* (browser) or `~/.sylphx/uploads.json` (node)
|
|
3718
|
+
* - Streaming SHA-256 via the Web Crypto API
|
|
3719
|
+
* - Resumable: persists `(uploadId, completedParts[])` to localStorage when available
|
|
3700
3720
|
* - AbortSignal cancellation; auto-DELETE upload session on abort
|
|
3701
3721
|
* - Exponential backoff with full jitter (5 retries, 1s base, 30s cap)
|
|
3702
3722
|
* - Progress: byte-accurate via XHR (browser) or stream sampling (node)
|
|
@@ -6075,7 +6095,7 @@ declare function assignMemberRole(config: SylphxConfig, orgIdOrSlug: string, mem
|
|
|
6075
6095
|
* import { createConfig, getSecret, getSecrets, listSecretKeys } from '@sylphx/sdk'
|
|
6076
6096
|
*
|
|
6077
6097
|
* const config = createConfig({
|
|
6078
|
-
* secretKey: process.env.
|
|
6098
|
+
* secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey!,
|
|
6079
6099
|
* })
|
|
6080
6100
|
*
|
|
6081
6101
|
* // Get a single secret
|
|
@@ -6226,7 +6246,7 @@ declare function getAllSecrets(config: SylphxConfig, environmentId?: string): Pr
|
|
|
6226
6246
|
* import { createConfig, indexDocument, search, batchIndex } from '@sylphx/sdk'
|
|
6227
6247
|
*
|
|
6228
6248
|
* const config = createConfig({
|
|
6229
|
-
* secretKey: process.env.
|
|
6249
|
+
* secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey!,
|
|
6230
6250
|
* })
|
|
6231
6251
|
*
|
|
6232
6252
|
* // Index a document
|
|
@@ -6642,7 +6662,7 @@ declare function trackClick(config: SylphxConfig, input: TrackClickInput): Promi
|
|
|
6642
6662
|
* ```ts
|
|
6643
6663
|
* import { createConfig, getDatabaseConnectionString } from '@sylphx/sdk'
|
|
6644
6664
|
*
|
|
6645
|
-
* const config = createConfig({ secretKey: process.env.
|
|
6665
|
+
* const config = createConfig({ secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey! })
|
|
6646
6666
|
* const { connectionString } = await getDatabaseConnectionString(config)
|
|
6647
6667
|
*
|
|
6648
6668
|
* const pool = new Pool({ connectionString })
|
|
@@ -6757,7 +6777,7 @@ interface KvZMember {
|
|
|
6757
6777
|
* ```ts
|
|
6758
6778
|
* import { createConfig, kvSet, kvGet, kvDelete } from '@sylphx/sdk'
|
|
6759
6779
|
*
|
|
6760
|
-
* const config = createConfig({ secretKey: process.env.
|
|
6780
|
+
* const config = createConfig({ secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey! })
|
|
6761
6781
|
*
|
|
6762
6782
|
* // Basic key-value operations
|
|
6763
6783
|
* await kvSet(config, { key: 'user:123', value: { name: 'Alice' }, ex: 3600 })
|
|
@@ -7103,7 +7123,7 @@ declare function kvSetJSON<T>(config: SylphxConfig, key: string, value: T, optio
|
|
|
7103
7123
|
* ```ts
|
|
7104
7124
|
* import { createConfig, triggerDeploy, getDeployStatus } from '@sylphx/sdk'
|
|
7105
7125
|
*
|
|
7106
|
-
* const config = createConfig({ secretKey: process.env.
|
|
7126
|
+
* const config = createConfig({ secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey! })
|
|
7107
7127
|
*
|
|
7108
7128
|
* // Trigger a deployment
|
|
7109
7129
|
* const deploy = await triggerDeploy(config, { envId: 'env_prod_xxx' })
|
|
@@ -7462,7 +7482,7 @@ declare function captureMessage(config: SylphxConfig, message: string, options?:
|
|
|
7462
7482
|
* ```typescript
|
|
7463
7483
|
* import { createServerClient, SandboxClient } from '@sylphx/sdk'
|
|
7464
7484
|
*
|
|
7465
|
-
* const config = createServerClient(process.env.
|
|
7485
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
7466
7486
|
*
|
|
7467
7487
|
* // Create sandbox (Platform waits for pod ready before returning)
|
|
7468
7488
|
* const sandbox = await SandboxClient.create(config)
|
|
@@ -7817,7 +7837,7 @@ declare class SandboxClient {
|
|
|
7817
7837
|
* ```typescript
|
|
7818
7838
|
* import { createServerClient, RunsClient } from '@sylphx/sdk'
|
|
7819
7839
|
*
|
|
7820
|
-
* const config = createServerClient(process.env.
|
|
7840
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
7821
7841
|
*
|
|
7822
7842
|
* const run = await RunsClient.create(config, {
|
|
7823
7843
|
* image: 'registry.sylphx.com/sylphx/my-trainer:abc123',
|
|
@@ -8052,7 +8072,7 @@ declare class RunHandle {
|
|
|
8052
8072
|
*
|
|
8053
8073
|
* @example
|
|
8054
8074
|
* ```typescript
|
|
8055
|
-
* const config = createServerClient(process.env.
|
|
8075
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
8056
8076
|
*
|
|
8057
8077
|
* // Run a worker and wait for completion
|
|
8058
8078
|
* const result = await RunsClient.create(config, { ... }).then(w => w.wait())
|
|
@@ -8197,7 +8217,7 @@ declare const WorkersClient: {
|
|
|
8197
8217
|
* ### Cron → Task
|
|
8198
8218
|
* ```typescript
|
|
8199
8219
|
* import { createServerClient, TriggersClient } from '@sylphx/sdk'
|
|
8200
|
-
* const config = createServerClient(process.env.
|
|
8220
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
8201
8221
|
*
|
|
8202
8222
|
* const trigger = await TriggersClient.create(config, {
|
|
8203
8223
|
* name: 'daily-cleanup',
|
|
@@ -9274,4 +9294,4 @@ declare const functions: {
|
|
|
9274
9294
|
};
|
|
9275
9295
|
};
|
|
9276
9296
|
|
|
9277
|
-
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 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, 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 };
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -4783,7 +4783,7 @@ var init_webapi = __esm({
|
|
|
4783
4783
|
// src/connection-url.ts
|
|
4784
4784
|
var SYLPHX_PROTOCOL = "sylphx:";
|
|
4785
4785
|
var DEFAULT_VERSION = "v1";
|
|
4786
|
-
var CREDENTIAL_REGEX = /^(pk|sk)_(dev|stg|prod|prev)_[a-f0-9]{32,64}$/;
|
|
4786
|
+
var CREDENTIAL_REGEX = /^(pk|sk)_(dev|stg|prod|prev)(?:_[a-z0-9]{12})?_[a-f0-9]{32,64}$/;
|
|
4787
4787
|
var VERSION_REGEX = /^v[0-9]+$/;
|
|
4788
4788
|
var SLUG_REGEX = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
|
|
4789
4789
|
var InvalidConnectionUrlError = class _InvalidConnectionUrlError extends Error {
|
|
@@ -4800,7 +4800,7 @@ function fail(reason) {
|
|
|
4800
4800
|
function parseCredential(raw) {
|
|
4801
4801
|
const match = CREDENTIAL_REGEX.exec(raw);
|
|
4802
4802
|
if (!match) {
|
|
4803
|
-
fail(`credential must match (pk|sk)_(dev|stg|prod|prev)_
|
|
4803
|
+
fail(`credential must match (pk|sk)_(dev|stg|prod|prev)(_{ref})?_{hex}, got "${raw}"`);
|
|
4804
4804
|
}
|
|
4805
4805
|
return {
|
|
4806
4806
|
credentialType: match[1],
|
|
@@ -4879,7 +4879,7 @@ init_constants();
|
|
|
4879
4879
|
init_errors();
|
|
4880
4880
|
var LEGACY_EMBEDDED_REF_PATTERN = /^(pk|sk)_(dev|stg|prod|prev)_[a-z0-9]{12}_[a-f0-9]+$/;
|
|
4881
4881
|
var LEGACY_APP_KEY_PATTERN = /^app_(dev|stg|prod|prev)_/;
|
|
4882
|
-
var MIGRATION_MESSAGE = "API key format has changed. Use a sylphx:// connection URL instead.\n\nNew format: sylphx://pk_prod_{hex}@your-slug.api.sylphx.com\n\nGenerate new credentials from the Sylphx Console \u2192 Your App \u2192 Environments.\nSee https://docs.sylphx.com/migration for details.";
|
|
4882
|
+
var MIGRATION_MESSAGE = "API key format has changed. Use a sylphx:// connection URL instead.\n\nNew format: sylphx://pk_prod_{ref?}_{hex}@your-slug.api.sylphx.com\n\nGenerate new credentials from the Sylphx Console \u2192 Your App \u2192 Environments.\nSee https://docs.sylphx.com/migration for details.";
|
|
4883
4883
|
function rejectLegacyKeyFormat(input) {
|
|
4884
4884
|
const trimmed = input.trim().toLowerCase();
|
|
4885
4885
|
if (LEGACY_APP_KEY_PATTERN.test(trimmed)) {
|
|
@@ -5012,7 +5012,7 @@ function createConfigFromComponents(input) {
|
|
|
5012
5012
|
});
|
|
5013
5013
|
}
|
|
5014
5014
|
throw new SylphxError(
|
|
5015
|
-
`[Sylphx] Invalid credential format. Expected (pk|sk)_(dev|stg|prod|prev)_
|
|
5015
|
+
`[Sylphx] Invalid credential format. Expected (pk|sk)_(dev|stg|prod|prev)(_{ref})?_{hex}. Got: "${trimmedCred.slice(0, 30)}..."`,
|
|
5016
5016
|
{ code: "BAD_REQUEST" }
|
|
5017
5017
|
);
|
|
5018
5018
|
}
|
|
@@ -5291,11 +5291,12 @@ init_constants();
|
|
|
5291
5291
|
init_errors();
|
|
5292
5292
|
|
|
5293
5293
|
// src/key-validation.ts
|
|
5294
|
-
var SECRET_KEY_PATTERN = /^sk_(dev|stg|prod)_[a-z0-9_-]+$/;
|
|
5294
|
+
var SECRET_KEY_PATTERN = /^sk_(dev|stg|prod|prev)_[a-z0-9_-]+$/;
|
|
5295
5295
|
var ENV_PREFIX_MAP = {
|
|
5296
5296
|
dev: "development",
|
|
5297
5297
|
stg: "staging",
|
|
5298
|
-
prod: "production"
|
|
5298
|
+
prod: "production",
|
|
5299
|
+
prev: "preview"
|
|
5299
5300
|
};
|
|
5300
5301
|
function detectKeyIssues(key) {
|
|
5301
5302
|
const issues = [];
|
|
@@ -5320,7 +5321,7 @@ The SDK will automatically sanitize the key, but fixing the source is recommende
|
|
|
5320
5321
|
}
|
|
5321
5322
|
function createInvalidKeyError(keyType, key, envVarName) {
|
|
5322
5323
|
const maskedKey = key.length > 20 ? `${key.slice(0, 20)}...` : key;
|
|
5323
|
-
const formatHint = keyType === "appId" ? "pk_(dev|stg|prod)_{ref}_{hex} or app_(dev|stg|prod)_[id]" : "sk_(dev|stg|prod)_{ref}_{hex}";
|
|
5324
|
+
const formatHint = keyType === "appId" ? "pk_(dev|stg|prod|prev)_{ref}_{hex} or app_(dev|stg|prod|prev)_[id]" : "sk_(dev|stg|prod|prev)_{ref}_{hex}";
|
|
5324
5325
|
const keyTypeName = keyType === "appId" ? "App ID" : "Secret Key";
|
|
5325
5326
|
return `[Sylphx] Invalid ${keyTypeName} format.
|
|
5326
5327
|
|
|
@@ -5333,7 +5334,7 @@ You can find your keys in the Sylphx Console \u2192 API Keys.
|
|
|
5333
5334
|
Common issues:
|
|
5334
5335
|
\u2022 Key has uppercase characters (must be lowercase)
|
|
5335
5336
|
\u2022 Key has wrong prefix (App ID: pk_ or app_, Secret Key: sk_)
|
|
5336
|
-
\u2022 Key has invalid environment (must be dev, stg, or
|
|
5337
|
+
\u2022 Key has invalid environment (must be dev, stg, prod, or prev)
|
|
5337
5338
|
\u2022 Key was copied with extra whitespace`;
|
|
5338
5339
|
}
|
|
5339
5340
|
function extractEnvironment(key) {
|
|
@@ -5380,7 +5381,7 @@ function validateKeyForType(key, keyType, pattern, envVarName) {
|
|
|
5380
5381
|
};
|
|
5381
5382
|
}
|
|
5382
5383
|
function validateSecretKey(key) {
|
|
5383
|
-
return validateKeyForType(key, "secret", SECRET_KEY_PATTERN, "
|
|
5384
|
+
return validateKeyForType(key, "secret", SECRET_KEY_PATTERN, "secret credential");
|
|
5384
5385
|
}
|
|
5385
5386
|
function validateAndSanitizeSecretKey(key) {
|
|
5386
5387
|
const result = validateSecretKey(key);
|
|
@@ -5402,7 +5403,14 @@ async function runPipeline(middlewares, initial) {
|
|
|
5402
5403
|
if (next) request = next;
|
|
5403
5404
|
}
|
|
5404
5405
|
}
|
|
5405
|
-
|
|
5406
|
+
const fetchWithMiddleware = middlewares.reduceRight(
|
|
5407
|
+
(next, mw) => mw.onFetch ? async (request2) => {
|
|
5408
|
+
const response2 = await mw.onFetch?.({ request: request2, next });
|
|
5409
|
+
return response2 ?? next(request2);
|
|
5410
|
+
} : next,
|
|
5411
|
+
(request2) => fetch(request2)
|
|
5412
|
+
);
|
|
5413
|
+
let response = await fetchWithMiddleware(request);
|
|
5406
5414
|
for (const mw of middlewares) {
|
|
5407
5415
|
if (mw.onResponse) {
|
|
5408
5416
|
const next = await mw.onResponse({ request, response });
|
|
@@ -5421,6 +5429,11 @@ function buildUrl(baseUrl, path, params) {
|
|
|
5421
5429
|
).toString();
|
|
5422
5430
|
return `${url}?${search2}`;
|
|
5423
5431
|
}
|
|
5432
|
+
function cloneRequestWithHeaders(request, updateHeaders) {
|
|
5433
|
+
const headers = new Headers(request.headers);
|
|
5434
|
+
updateHeaders(headers);
|
|
5435
|
+
return new Request(request, { headers });
|
|
5436
|
+
}
|
|
5424
5437
|
function interpolatePath(path, pathParams) {
|
|
5425
5438
|
if (!pathParams) return path;
|
|
5426
5439
|
return path.replace(/\{(\w+)\}/g, (_match, key) => {
|
|
@@ -5483,66 +5496,51 @@ function buildClient(baseUrl, baseHeaders) {
|
|
|
5483
5496
|
function createAuthMiddleware(config) {
|
|
5484
5497
|
return {
|
|
5485
5498
|
async onRequest({ request }) {
|
|
5486
|
-
request
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5499
|
+
return cloneRequestWithHeaders(request, (headers) => {
|
|
5500
|
+
headers.set("X-SDK-Version", SDK_VERSION);
|
|
5501
|
+
headers.set("X-SDK-Platform", SDK_PLATFORM);
|
|
5502
|
+
if (config.secretKey) {
|
|
5503
|
+
headers.set("x-app-secret", config.secretKey);
|
|
5504
|
+
}
|
|
5505
|
+
const token = config.getAccessToken?.();
|
|
5506
|
+
if (token) {
|
|
5507
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
5508
|
+
}
|
|
5509
|
+
});
|
|
5496
5510
|
}
|
|
5497
5511
|
};
|
|
5498
5512
|
}
|
|
5499
5513
|
function isRetryableStatus(status) {
|
|
5500
5514
|
return status >= 500 || status === 429;
|
|
5501
5515
|
}
|
|
5502
|
-
var inFlightRequests = /* @__PURE__ */ new Map();
|
|
5503
5516
|
async function getRequestKey(request) {
|
|
5504
5517
|
const body = request.body ? await request.clone().text() : "";
|
|
5505
5518
|
return `${request.method}:${request.url}:${body}`;
|
|
5506
5519
|
}
|
|
5507
5520
|
function createDeduplicationMiddleware(config = {}) {
|
|
5508
5521
|
const { enabled = true, methods = ["GET"] } = config;
|
|
5509
|
-
if (!enabled) {
|
|
5510
|
-
|
|
5511
|
-
async onRequest({ request }) {
|
|
5512
|
-
return request;
|
|
5513
|
-
}
|
|
5514
|
-
};
|
|
5515
|
-
}
|
|
5522
|
+
if (!enabled) return {};
|
|
5523
|
+
const inFlightRequests = /* @__PURE__ */ new Map();
|
|
5516
5524
|
return {
|
|
5517
|
-
async
|
|
5518
|
-
|
|
5519
|
-
|
|
5525
|
+
async onFetch({ request, next }) {
|
|
5526
|
+
const method = request.method.toUpperCase();
|
|
5527
|
+
if (!methods.includes(method)) {
|
|
5528
|
+
return next(request);
|
|
5520
5529
|
}
|
|
5521
5530
|
const key = await getRequestKey(request);
|
|
5522
5531
|
const existing = inFlightRequests.get(key);
|
|
5523
5532
|
if (existing) {
|
|
5524
|
-
const deduped = request.clone();
|
|
5525
|
-
deduped._dedupKey = key;
|
|
5526
|
-
return deduped;
|
|
5527
|
-
}
|
|
5528
|
-
;
|
|
5529
|
-
request._dedupKey = key;
|
|
5530
|
-
return request;
|
|
5531
|
-
},
|
|
5532
|
-
async onResponse({ request, response }) {
|
|
5533
|
-
const key = request._dedupKey;
|
|
5534
|
-
if (!key) return response;
|
|
5535
|
-
const existing = inFlightRequests.get(key);
|
|
5536
|
-
if (existing && inFlightRequests.get(key) !== void 0) {
|
|
5537
5533
|
const cachedResponse = await existing;
|
|
5538
5534
|
return cachedResponse.clone();
|
|
5539
5535
|
}
|
|
5540
|
-
const responsePromise =
|
|
5536
|
+
const responsePromise = next(request).then((response) => response.clone());
|
|
5541
5537
|
inFlightRequests.set(key, responsePromise);
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5538
|
+
try {
|
|
5539
|
+
const response = await responsePromise;
|
|
5540
|
+
return response.clone();
|
|
5541
|
+
} finally {
|
|
5542
|
+
inFlightRequests.delete(key);
|
|
5543
|
+
}
|
|
5546
5544
|
}
|
|
5547
5545
|
};
|
|
5548
5546
|
}
|
|
@@ -5708,7 +5706,9 @@ function createETagMiddleware(config) {
|
|
|
5708
5706
|
if (Date.now() - cached.timestamp > ttlMs) {
|
|
5709
5707
|
etagCache.delete(cacheKey);
|
|
5710
5708
|
} else {
|
|
5711
|
-
request
|
|
5709
|
+
return cloneRequestWithHeaders(request, (headers) => {
|
|
5710
|
+
headers.set("If-None-Match", cached.etag);
|
|
5711
|
+
});
|
|
5712
5712
|
}
|
|
5713
5713
|
}
|
|
5714
5714
|
return request;
|
|
@@ -6000,11 +6000,28 @@ async function inviteUser(config, input) {
|
|
|
6000
6000
|
body: input
|
|
6001
6001
|
});
|
|
6002
6002
|
}
|
|
6003
|
-
|
|
6004
|
-
|
|
6003
|
+
function normalizeOrgScopedTokenResponse(data) {
|
|
6004
|
+
const accessToken = data.accessToken ?? data.access_token;
|
|
6005
|
+
if (!accessToken) {
|
|
6006
|
+
throw new Error("Invalid org-scoped token response: missing access token");
|
|
6007
|
+
}
|
|
6008
|
+
return {
|
|
6009
|
+
token: accessToken,
|
|
6010
|
+
accessToken,
|
|
6011
|
+
expiresIn: data.expiresIn ?? data.expires_in,
|
|
6012
|
+
tokenType: data.tokenType ?? data.token_type,
|
|
6013
|
+
user: data.user
|
|
6014
|
+
};
|
|
6015
|
+
}
|
|
6016
|
+
async function getOrgScopedToken(config, orgId) {
|
|
6017
|
+
const data = await callApi(config, "/auth/switch-org", {
|
|
6005
6018
|
method: "POST",
|
|
6006
6019
|
body: { orgId }
|
|
6007
6020
|
});
|
|
6021
|
+
return normalizeOrgScopedTokenResponse(data);
|
|
6022
|
+
}
|
|
6023
|
+
async function switchOrg(config, orgId) {
|
|
6024
|
+
return getOrgScopedToken(config, orgId);
|
|
6008
6025
|
}
|
|
6009
6026
|
var device = {
|
|
6010
6027
|
/**
|
|
@@ -8002,6 +8019,9 @@ async function getBillingUsage(config, options) {
|
|
|
8002
8019
|
});
|
|
8003
8020
|
}
|
|
8004
8021
|
|
|
8022
|
+
// src/storage.ts
|
|
8023
|
+
init_errors();
|
|
8024
|
+
|
|
8005
8025
|
// src/lib/retry.ts
|
|
8006
8026
|
init_constants();
|
|
8007
8027
|
var DEFAULT_RETRY_CONFIG = {
|
|
@@ -8124,7 +8144,6 @@ var PATHS = {
|
|
|
8124
8144
|
versions: (id) => `/storage/files/${encodeURIComponent(String(id))}/versions`,
|
|
8125
8145
|
versionRestore: (id, vid) => `/storage/files/${encodeURIComponent(String(id))}/versions/${encodeURIComponent(String(vid))}:restore`
|
|
8126
8146
|
};
|
|
8127
|
-
var isBrowser = () => typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
|
|
8128
8147
|
var hasXhr = () => typeof globalThis.XMLHttpRequest !== "undefined";
|
|
8129
8148
|
var hasLocalStorage = () => {
|
|
8130
8149
|
try {
|
|
@@ -8136,16 +8155,14 @@ var hasLocalStorage = () => {
|
|
|
8136
8155
|
};
|
|
8137
8156
|
async function computeSha256Hex(blob) {
|
|
8138
8157
|
const subtle = globalThis.crypto?.subtle;
|
|
8139
|
-
if (subtle?.digest) {
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8158
|
+
if (!subtle?.digest) {
|
|
8159
|
+
throw new SylphxError("Web Crypto SHA-256 support is required for storage uploads", {
|
|
8160
|
+
code: "NOT_IMPLEMENTED"
|
|
8161
|
+
});
|
|
8143
8162
|
}
|
|
8144
|
-
const
|
|
8145
|
-
const
|
|
8146
|
-
|
|
8147
|
-
hash.update(buf);
|
|
8148
|
-
return hash.digest("hex");
|
|
8163
|
+
const buf = await blob.arrayBuffer();
|
|
8164
|
+
const digest2 = await subtle.digest("SHA-256", buf);
|
|
8165
|
+
return bytesToHex(new Uint8Array(digest2));
|
|
8149
8166
|
}
|
|
8150
8167
|
function bytesToHex(b) {
|
|
8151
8168
|
let s = "";
|
|
@@ -8162,10 +8179,6 @@ function persistResume(rec) {
|
|
|
8162
8179
|
localStorage.setItem(resumeKey(rec.uploadId), JSON.stringify(rec));
|
|
8163
8180
|
} catch {
|
|
8164
8181
|
}
|
|
8165
|
-
return;
|
|
8166
|
-
}
|
|
8167
|
-
if (!isBrowser()) {
|
|
8168
|
-
void persistResumeNode(rec);
|
|
8169
8182
|
}
|
|
8170
8183
|
}
|
|
8171
8184
|
function clearResume(uploadId) {
|
|
@@ -8174,41 +8187,6 @@ function clearResume(uploadId) {
|
|
|
8174
8187
|
localStorage.removeItem(resumeKey(uploadId));
|
|
8175
8188
|
} catch {
|
|
8176
8189
|
}
|
|
8177
|
-
return;
|
|
8178
|
-
}
|
|
8179
|
-
if (!isBrowser()) void clearResumeNode(uploadId);
|
|
8180
|
-
}
|
|
8181
|
-
async function persistResumeNode(rec) {
|
|
8182
|
-
try {
|
|
8183
|
-
const fs = await import("fs/promises");
|
|
8184
|
-
const path = await import("path");
|
|
8185
|
-
const os = await import("os");
|
|
8186
|
-
const dir = path.join(os.homedir(), ".sylphx");
|
|
8187
|
-
await fs.mkdir(dir, { recursive: true });
|
|
8188
|
-
const file = path.join(dir, "uploads.json");
|
|
8189
|
-
let store = {};
|
|
8190
|
-
try {
|
|
8191
|
-
const text = await fs.readFile(file, "utf8");
|
|
8192
|
-
store = JSON.parse(text);
|
|
8193
|
-
} catch {
|
|
8194
|
-
store = {};
|
|
8195
|
-
}
|
|
8196
|
-
store[rec.uploadId] = rec;
|
|
8197
|
-
await fs.writeFile(file, JSON.stringify(store), "utf8");
|
|
8198
|
-
} catch {
|
|
8199
|
-
}
|
|
8200
|
-
}
|
|
8201
|
-
async function clearResumeNode(uploadId) {
|
|
8202
|
-
try {
|
|
8203
|
-
const fs = await import("fs/promises");
|
|
8204
|
-
const path = await import("path");
|
|
8205
|
-
const os = await import("os");
|
|
8206
|
-
const file = path.join(os.homedir(), ".sylphx", "uploads.json");
|
|
8207
|
-
const text = await fs.readFile(file, "utf8");
|
|
8208
|
-
const store = JSON.parse(text);
|
|
8209
|
-
delete store[uploadId];
|
|
8210
|
-
await fs.writeFile(file, JSON.stringify(store), "utf8");
|
|
8211
|
-
} catch {
|
|
8212
8190
|
}
|
|
8213
8191
|
}
|
|
8214
8192
|
function putBlob(url, body, headers, signal, onProgress) {
|
|
@@ -8925,7 +8903,7 @@ function createTasksHandler(taskDefs, options = {}) {
|
|
|
8925
8903
|
{ status: 400 }
|
|
8926
8904
|
);
|
|
8927
8905
|
}
|
|
8928
|
-
const signingSecret = options.signingSecret ?? process.env.SYLPHX_SIGNING_SECRET ??
|
|
8906
|
+
const signingSecret = options.signingSecret ?? process.env.SYLPHX_SIGNING_SECRET ?? "";
|
|
8929
8907
|
if (signingSecret) {
|
|
8930
8908
|
const signature = req.headers.get("x-sylphx-signature") ?? "";
|
|
8931
8909
|
if (!signature) {
|
|
@@ -11032,6 +11010,7 @@ export {
|
|
|
11032
11010
|
getMemberPermissions,
|
|
11033
11011
|
getMyReferralCode,
|
|
11034
11012
|
getOidcDiscoveryDocument,
|
|
11013
|
+
getOrgScopedToken,
|
|
11035
11014
|
getOrganization,
|
|
11036
11015
|
getOrganizationInvitations,
|
|
11037
11016
|
getOrganizationMembers,
|