@sylphx/sdk 0.8.0-rc.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +48 -3
- package/dist/index.mjs +41 -5
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.d.ts +17 -6
- package/dist/nextjs/index.mjs +181 -15
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +123 -4
- package/dist/react/index.mjs +4918 -46455
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +27 -3
- package/dist/server/index.mjs +2 -2
- package/dist/server/index.mjs.map +1 -1
- package/dist/web-analytics.mjs.map +1 -1
- package/package.json +2 -3
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { SdkBillingPlan, SdkConsentType } from '@sylphx/contract';
|
|
2
|
-
import { OAuthProvider } from '@sylphx/ui';
|
|
3
|
-
export { OAuthProvider } from '@sylphx/ui';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* REST Client for Sylphx Platform
|
|
@@ -622,6 +620,32 @@ declare function validateAndSanitizeKey(key: string | undefined | null): string;
|
|
|
622
620
|
*/
|
|
623
621
|
declare function isDevelopmentRuntime(): boolean;
|
|
624
622
|
|
|
623
|
+
/**
|
|
624
|
+
* OAuth SDK — customer-app-facing social login (ADR-089 Phase 4a)
|
|
625
|
+
*
|
|
626
|
+
* Backed by `apps/runtime/src/server/runtime/routes/oauth.ts`:
|
|
627
|
+
*
|
|
628
|
+
* POST /oauth/authorize — initiate OAuth flow, returns provider URL
|
|
629
|
+
*
|
|
630
|
+
* The per-provider callback handler is a browser-side redirect endpoint
|
|
631
|
+
* on the runtime (`GET /oauth/callback/{provider}`); SDK consumers
|
|
632
|
+
* redirect the user to `authorizationUrl`, then receive a `code` on
|
|
633
|
+
* their own `redirect_uri` which they exchange via `signIn()` or
|
|
634
|
+
* `auth/login` with grant_type=authorization_code.
|
|
635
|
+
*
|
|
636
|
+
* PKCE is required per OAuth 2.1. Callers MUST generate `code_verifier`
|
|
637
|
+
* + `code_challenge` and persist the verifier in session / cookie for
|
|
638
|
+
* the subsequent token exchange — this SDK does not retain state.
|
|
639
|
+
*
|
|
640
|
+
* ## Distinction from `auth.oauth`
|
|
641
|
+
*
|
|
642
|
+
* `auth.oauth.*` (from `./auth`) targets platform-plane admin mint
|
|
643
|
+
* (`/auth/platform-jwt/mint`) used by Console / CLI. The functions
|
|
644
|
+
* here target the customer-app social-login flow.
|
|
645
|
+
*/
|
|
646
|
+
|
|
647
|
+
type OAuthProvider = OAuthProviderId | (string & {});
|
|
648
|
+
|
|
625
649
|
/**
|
|
626
650
|
* Functions Client — Serverless V8 Isolate Functions (ADR-043)
|
|
627
651
|
*
|
|
@@ -1843,4 +1867,4 @@ declare function getDatabaseConnection(options: AuthenticatedFetchOptions): Prom
|
|
|
1843
1867
|
*/
|
|
1844
1868
|
declare function getDatabaseStatus(options: AuthenticatedFetchOptions): Promise<DatabaseStatusInfo>;
|
|
1845
1869
|
|
|
1846
|
-
export { type AIClient, type AIClientOptions, type AppConfig, type AppMetadata, type ChannelHelper, type ChatCompletionChunk, type ChatCompletionOptions, type ChatCompletionResponse, type ChatCompletionStreamOptions, type ChatMessage, type ConsentType, type DatabaseConnectionInfo, type DatabaseStatusInfo, type EmbeddingOptions, type EmbeddingResponse, type EngagementLeaderboardEntry, type EngagementLeaderboardResult, type EnvironmentType, type FeatureFlagDefinition, type FunctionDeployOptions, type FunctionDeployResult, type FunctionInvokeOptions, type FunctionListOptions, type FunctionLogEntry, type FunctionLogsOptions, type FunctionRecord, type FunctionRuntime, type FunctionStatus, FunctionsClient, type GetAppConfigOptions, InvalidConnectionUrlError, type KeyType, type KeyValidationResult, type KvClient, type KvClientOptions, type KvRateLimitResult, type KvSetOptions, type KvZMember, type ModelInfo, type ModelsResponse, type OAuthProviderInfo, type Plan, type ReferralLeaderboardEntry, type ReferralLeaderboardResult, type RestClient, type RestClientConfig as ServerClientConfig, type ServerConfig, type StreamHistoryOptions, type StreamMessage, type StreamsClient, type StreamsClientOptions, type SylphxClientInput, type SylphxConfig, type WebhookPayload, type WebhookVerifyOptions, type WebhookVerifyResult, createAI, createAuthenticatedServerClient, createClient, createKv, createServerClient, createServerRestClient, createStreams, createWebhookHandler, decodeUserId, detectEnvironment, detectKeyType, encodeUserId, getAI, getAppConfig, getAppMetadata, getConsentTypes, getCookieNamespace, getDatabaseConnection, getDatabaseStatus, getEngagementLeaderboard, getFeatureFlags, getJwks, getKv, getOAuthProviders, getOAuthProvidersWithInfo, getPlans, getReferralLeaderboard, getStreams, isAppId, isDevelopmentKey, isDevelopmentRuntime, isProductionKey, isSecretKey, resetJwksCache, validateAndSanitizeAppId, validateAndSanitizeKey, validateAndSanitizeSecretKey, validateAppId, validateKey, validateSecretKey, verifyAccessToken, verifyWebhook };
|
|
1870
|
+
export { type AIClient, type AIClientOptions, type AppConfig, type AppMetadata, type ChannelHelper, type ChatCompletionChunk, type ChatCompletionOptions, type ChatCompletionResponse, type ChatCompletionStreamOptions, type ChatMessage, type ConsentType, type DatabaseConnectionInfo, type DatabaseStatusInfo, type EmbeddingOptions, type EmbeddingResponse, type EngagementLeaderboardEntry, type EngagementLeaderboardResult, type EnvironmentType, type FeatureFlagDefinition, type FunctionDeployOptions, type FunctionDeployResult, type FunctionInvokeOptions, type FunctionListOptions, type FunctionLogEntry, type FunctionLogsOptions, type FunctionRecord, type FunctionRuntime, type FunctionStatus, FunctionsClient, type GetAppConfigOptions, InvalidConnectionUrlError, type KeyType, type KeyValidationResult, type KvClient, type KvClientOptions, type KvRateLimitResult, type KvSetOptions, type KvZMember, type ModelInfo, type ModelsResponse, type OAuthProvider, type OAuthProviderInfo, type Plan, type ReferralLeaderboardEntry, type ReferralLeaderboardResult, type RestClient, type RestClientConfig as ServerClientConfig, type ServerConfig, type StreamHistoryOptions, type StreamMessage, type StreamsClient, type StreamsClientOptions, type SylphxClientInput, type SylphxConfig, type WebhookPayload, type WebhookVerifyOptions, type WebhookVerifyResult, createAI, createAuthenticatedServerClient, createClient, createKv, createServerClient, createServerRestClient, createStreams, createWebhookHandler, decodeUserId, detectEnvironment, detectKeyType, encodeUserId, getAI, getAppConfig, getAppMetadata, getConsentTypes, getCookieNamespace, getDatabaseConnection, getDatabaseStatus, getEngagementLeaderboard, getFeatureFlags, getJwks, getKv, getOAuthProviders, getOAuthProvidersWithInfo, getPlans, getReferralLeaderboard, getStreams, isAppId, isDevelopmentKey, isDevelopmentRuntime, isProductionKey, isSecretKey, resetJwksCache, validateAndSanitizeAppId, validateAndSanitizeKey, validateAndSanitizeSecretKey, validateAppId, validateKey, validateSecretKey, verifyAccessToken, verifyWebhook };
|
package/dist/server/index.mjs
CHANGED
|
@@ -2209,7 +2209,7 @@ function createConfigFromComponents(input) {
|
|
|
2209
2209
|
const credentialType = match[1];
|
|
2210
2210
|
const env = match[2];
|
|
2211
2211
|
const slug = resolvedSlug.trim().toLowerCase();
|
|
2212
|
-
const domain = input.domain?.trim() ||
|
|
2212
|
+
const domain = input.domain?.trim() || DEFAULT_SDK_API_HOST;
|
|
2213
2213
|
const baseUrl = `https://${slug}.${domain}/v1`;
|
|
2214
2214
|
return freezeConfig({
|
|
2215
2215
|
credential: trimmedCred,
|
|
@@ -2232,7 +2232,7 @@ function createConfigFromComponents(input) {
|
|
|
2232
2232
|
const platform = input.platformUrl.trim().replace(/\/$/, "");
|
|
2233
2233
|
baseUrl = platform.includes("/v1") ? platform : `${platform}/v1`;
|
|
2234
2234
|
} else {
|
|
2235
|
-
const domain = input.domain?.trim() ||
|
|
2235
|
+
const domain = input.domain?.trim() || DEFAULT_SDK_API_HOST;
|
|
2236
2236
|
baseUrl = `https://${slug}.${domain}/v1`;
|
|
2237
2237
|
}
|
|
2238
2238
|
return freezeConfig({
|