@blinkdotnew/dev-sdk 2.1.1 → 2.1.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/dist/index.d.mts +9 -163
- package/dist/index.d.ts +9 -163
- package/dist/index.js +140 -307
- package/dist/index.mjs +141 -305
- package/package.json +3 -5
package/dist/index.d.mts
CHANGED
|
@@ -61,39 +61,6 @@ interface BlinkClientConfig {
|
|
|
61
61
|
projectId: string;
|
|
62
62
|
authRequired?: boolean;
|
|
63
63
|
auth?: BlinkAuthConfig;
|
|
64
|
-
/**
|
|
65
|
-
* Publishable key (client-safe).
|
|
66
|
-
*
|
|
67
|
-
* Used for **public endpoints** when no user JWT is present (e.g. analytics ingest, storage upload,
|
|
68
|
-
* optional public DB reads). Never use for privileged operations.
|
|
69
|
-
*/
|
|
70
|
-
publishableKey?: string;
|
|
71
|
-
/**
|
|
72
|
-
* Secret key (server-only, privileged). Permanent, never expires.
|
|
73
|
-
*
|
|
74
|
-
* Used in **server runtimes** (Edge Functions, Workers) for privileged operations that require
|
|
75
|
-
* service-role access (e.g. raw SQL, bypassing row-level security).
|
|
76
|
-
*
|
|
77
|
-
* Format: `blnk_sk_{projectId-last-8}_{random}` (similar to Stripe's `sk_live_...`)
|
|
78
|
-
*
|
|
79
|
-
* **Security**: Never expose this key in client-side code. It is injected by the platform
|
|
80
|
-
* into edge function environments as `BLINK_SECRET_KEY`.
|
|
81
|
-
*
|
|
82
|
-
* When present, this key takes precedence over user JWTs for all requests.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* // Edge function (Deno)
|
|
86
|
-
* const blink = createClient({
|
|
87
|
-
* projectId: Deno.env.get('BLINK_PROJECT_ID')!,
|
|
88
|
-
* secretKey: Deno.env.get('BLINK_SECRET_KEY'),
|
|
89
|
-
* })
|
|
90
|
-
*/
|
|
91
|
-
secretKey?: string;
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated Use `secretKey` instead. Service tokens are JWT-based and expire after 365 days.
|
|
94
|
-
* Secret keys are permanent and never expire.
|
|
95
|
-
*/
|
|
96
|
-
serviceToken?: string;
|
|
97
64
|
/**
|
|
98
65
|
* Storage adapter for cross-platform token persistence
|
|
99
66
|
*
|
|
@@ -314,9 +281,6 @@ declare class BlinkError extends Error {
|
|
|
314
281
|
constructor(message: string, code?: string | undefined, status?: number | undefined, details?: any);
|
|
315
282
|
}
|
|
316
283
|
interface StorageUploadOptions {
|
|
317
|
-
/**
|
|
318
|
-
* @deprecated Blink storage uploads are add-only by default. This option is ignored.
|
|
319
|
-
*/
|
|
320
284
|
upsert?: boolean;
|
|
321
285
|
onProgress?: (percent: number) => void;
|
|
322
286
|
}
|
|
@@ -767,61 +731,13 @@ interface BlinkNotifications {
|
|
|
767
731
|
email(params: SendEmailRequest): Promise<SendEmailResponse>;
|
|
768
732
|
}
|
|
769
733
|
|
|
770
|
-
type ConnectorProvider = 'discord' | 'notion' | 'google_drive' | 'google_calendar' | 'ai';
|
|
771
|
-
type ConnectorAuthMode = 'oauth' | 'api_key' | 'blink_managed' | 'hybrid';
|
|
772
|
-
interface ConnectorStatusData {
|
|
773
|
-
connected: boolean;
|
|
774
|
-
provider: ConnectorProvider;
|
|
775
|
-
auth_mode?: ConnectorAuthMode;
|
|
776
|
-
account_id?: string;
|
|
777
|
-
metadata?: Record<string, unknown>;
|
|
778
|
-
expires_at?: any;
|
|
779
|
-
scopes?: string[];
|
|
780
|
-
}
|
|
781
|
-
interface ConnectorStatusResponse {
|
|
782
|
-
success: boolean;
|
|
783
|
-
data: ConnectorStatusData;
|
|
784
|
-
}
|
|
785
|
-
interface ConnectorExecuteRequest<TParams = Record<string, unknown>> {
|
|
786
|
-
method: string;
|
|
787
|
-
params?: TParams;
|
|
788
|
-
account_id?: string;
|
|
789
|
-
http_method?: string;
|
|
790
|
-
}
|
|
791
|
-
interface ConnectorExecuteResponse<TData = any> {
|
|
792
|
-
success: boolean;
|
|
793
|
-
data: TData;
|
|
794
|
-
}
|
|
795
|
-
interface ConnectorApiKeyRequest<TMetadata = Record<string, unknown>> {
|
|
796
|
-
api_key: string;
|
|
797
|
-
account_id?: string;
|
|
798
|
-
metadata?: TMetadata;
|
|
799
|
-
}
|
|
800
|
-
interface ConnectorApiKeyResponse {
|
|
801
|
-
success: boolean;
|
|
802
|
-
data: {
|
|
803
|
-
id: string;
|
|
804
|
-
account_id?: string;
|
|
805
|
-
};
|
|
806
|
-
}
|
|
807
|
-
interface BlinkConnectors {
|
|
808
|
-
status(provider: ConnectorProvider, options?: {
|
|
809
|
-
account_id?: string;
|
|
810
|
-
}): Promise<ConnectorStatusResponse>;
|
|
811
|
-
execute<TParams = Record<string, unknown>, TData = any>(provider: ConnectorProvider, request: ConnectorExecuteRequest<TParams>): Promise<ConnectorExecuteResponse<TData>>;
|
|
812
|
-
saveApiKey<TMetadata = Record<string, unknown>>(provider: ConnectorProvider, request: ConnectorApiKeyRequest<TMetadata>): Promise<ConnectorApiKeyResponse>;
|
|
813
|
-
}
|
|
814
|
-
declare class BlinkConnectorError extends BlinkError {
|
|
815
|
-
constructor(message: string, status?: number, details?: any);
|
|
816
|
-
}
|
|
817
|
-
|
|
818
734
|
/**
|
|
819
735
|
* HTTP client for Blink API requests
|
|
820
736
|
* Handles authentication, error handling, and request/response processing
|
|
821
737
|
*/
|
|
822
738
|
|
|
823
739
|
interface RequestOptions {
|
|
824
|
-
method?: 'GET' | 'POST' | '
|
|
740
|
+
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
825
741
|
headers?: Record<string, string>;
|
|
826
742
|
body?: any;
|
|
827
743
|
searchParams?: Record<string, string>;
|
|
@@ -836,14 +752,9 @@ declare class HttpClient {
|
|
|
836
752
|
private readonly authUrl;
|
|
837
753
|
private readonly coreUrl;
|
|
838
754
|
readonly projectId: string;
|
|
839
|
-
private readonly publishableKey?;
|
|
840
|
-
private readonly secretKey?;
|
|
841
755
|
private getToken;
|
|
842
756
|
private getValidToken?;
|
|
843
757
|
constructor(config: BlinkClientConfig, getToken: () => string | null, getValidToken?: () => Promise<string | null>);
|
|
844
|
-
private shouldAttachPublishableKey;
|
|
845
|
-
private shouldSkipSecretKey;
|
|
846
|
-
private getAuthorizationHeader;
|
|
847
758
|
/**
|
|
848
759
|
* Make an authenticated request to the Blink API
|
|
849
760
|
*/
|
|
@@ -925,7 +836,7 @@ declare class HttpClient {
|
|
|
925
836
|
signal?: AbortSignal;
|
|
926
837
|
}): Promise<BlinkResponse<any>>;
|
|
927
838
|
/**
|
|
928
|
-
* Stream AI text generation
|
|
839
|
+
* Stream AI text generation with Vercel AI SDK data stream format
|
|
929
840
|
*/
|
|
930
841
|
streamAiText(prompt: string, options: {
|
|
931
842
|
model?: string | undefined;
|
|
@@ -949,7 +860,7 @@ declare class HttpClient {
|
|
|
949
860
|
signal?: AbortSignal;
|
|
950
861
|
}): Promise<BlinkResponse<any>>;
|
|
951
862
|
/**
|
|
952
|
-
* Stream AI object generation
|
|
863
|
+
* Stream AI object generation with Vercel AI SDK data stream format
|
|
953
864
|
*/
|
|
954
865
|
streamAiObject(prompt: string, options: {
|
|
955
866
|
model?: string | undefined;
|
|
@@ -993,13 +904,6 @@ declare class HttpClient {
|
|
|
993
904
|
dataScreenshot(projectId: string, request: ScreenshotRequest): Promise<BlinkResponse<ScreenshotResponse>>;
|
|
994
905
|
dataFetch(projectId: string, request: FetchRequest): Promise<BlinkResponse<FetchResponse | AsyncFetchResponse>>;
|
|
995
906
|
dataSearch(projectId: string, request: SearchRequest): Promise<BlinkResponse<SearchResponse>>;
|
|
996
|
-
/**
|
|
997
|
-
* Connector requests
|
|
998
|
-
*/
|
|
999
|
-
private formatProviderForPath;
|
|
1000
|
-
connectorStatus(provider: ConnectorProvider): Promise<BlinkResponse<ConnectorStatusResponse>>;
|
|
1001
|
-
connectorExecute<TParams = Record<string, unknown>, TData = any>(provider: ConnectorProvider, request: ConnectorExecuteRequest<TParams>): Promise<BlinkResponse<ConnectorExecuteResponse<TData>>>;
|
|
1002
|
-
connectorSaveApiKey<TMetadata = Record<string, unknown>>(provider: ConnectorProvider, request: ConnectorApiKeyRequest<TMetadata>): Promise<BlinkResponse<ConnectorApiKeyResponse>>;
|
|
1003
907
|
/**
|
|
1004
908
|
* Realtime-specific requests
|
|
1005
909
|
*/
|
|
@@ -1037,17 +941,17 @@ declare class HttpClient {
|
|
|
1037
941
|
private parseResponse;
|
|
1038
942
|
private handleErrorResponse;
|
|
1039
943
|
/**
|
|
1040
|
-
* Parse Vercel AI SDK
|
|
1041
|
-
*
|
|
944
|
+
* Parse Vercel AI SDK data stream format
|
|
945
|
+
* Handles text chunks (0:"text"), partial objects (2:[...]), and metadata (d:, e:)
|
|
1042
946
|
*/
|
|
1043
|
-
private
|
|
947
|
+
private parseDataStream;
|
|
1044
948
|
}
|
|
1045
949
|
|
|
1046
950
|
/**
|
|
1047
951
|
* Platform detection for cross-platform compatibility
|
|
1048
|
-
* Detects whether code is running on web, React Native, Node.js
|
|
952
|
+
* Detects whether code is running on web, React Native, or Node.js
|
|
1049
953
|
*/
|
|
1050
|
-
type Platform = 'web' | 'react-native' | 'node'
|
|
954
|
+
type Platform = 'web' | 'react-native' | 'node';
|
|
1051
955
|
/**
|
|
1052
956
|
* Current platform
|
|
1053
957
|
*/
|
|
@@ -1058,9 +962,7 @@ declare const platform: Platform;
|
|
|
1058
962
|
declare const isWeb: boolean;
|
|
1059
963
|
declare const isReactNative: boolean;
|
|
1060
964
|
declare const isNode: boolean;
|
|
1061
|
-
declare const isDeno: boolean;
|
|
1062
965
|
declare const isBrowser: boolean;
|
|
1063
|
-
declare const isServer: boolean;
|
|
1064
966
|
|
|
1065
967
|
/**
|
|
1066
968
|
* Blink Auth Module - Client-side authentication management
|
|
@@ -1731,50 +1633,6 @@ declare class BlinkAnalyticsImpl implements BlinkAnalytics {
|
|
|
1731
1633
|
private detectChannel;
|
|
1732
1634
|
}
|
|
1733
1635
|
|
|
1734
|
-
/**
|
|
1735
|
-
* Blink Functions - Edge function invocation helper
|
|
1736
|
-
* Provides a simple interface for calling Blink Edge Functions with automatic JWT attachment
|
|
1737
|
-
*/
|
|
1738
|
-
|
|
1739
|
-
interface FunctionsInvokeOptions {
|
|
1740
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
1741
|
-
body?: any;
|
|
1742
|
-
headers?: Record<string, string>;
|
|
1743
|
-
searchParams?: Record<string, string>;
|
|
1744
|
-
}
|
|
1745
|
-
interface FunctionsInvokeResponse<T = any> {
|
|
1746
|
-
data: T;
|
|
1747
|
-
status: number;
|
|
1748
|
-
headers: Headers;
|
|
1749
|
-
}
|
|
1750
|
-
interface BlinkFunctions {
|
|
1751
|
-
/**
|
|
1752
|
-
* Invoke a Blink Edge Function.
|
|
1753
|
-
*
|
|
1754
|
-
* Automatically attaches the user's JWT for authenticated requests.
|
|
1755
|
-
* The function URL is constructed as: https://{projectSuffix}--{functionSlug}.functions.blink.new
|
|
1756
|
-
*
|
|
1757
|
-
* @param functionSlug - The slug of the edge function to invoke
|
|
1758
|
-
* @param options - Request options (method, body, headers, etc.)
|
|
1759
|
-
* @returns The function response
|
|
1760
|
-
*
|
|
1761
|
-
* @example
|
|
1762
|
-
* // Simple POST request
|
|
1763
|
-
* const { data } = await blink.functions.invoke('my-function', {
|
|
1764
|
-
* method: 'POST',
|
|
1765
|
-
* body: { message: 'Hello' }
|
|
1766
|
-
* })
|
|
1767
|
-
*
|
|
1768
|
-
* @example
|
|
1769
|
-
* // GET request with query params
|
|
1770
|
-
* const { data } = await blink.functions.invoke('my-function', {
|
|
1771
|
-
* method: 'GET',
|
|
1772
|
-
* searchParams: { limit: '10' }
|
|
1773
|
-
* })
|
|
1774
|
-
*/
|
|
1775
|
-
invoke<T = any>(functionSlug: string, options?: FunctionsInvokeOptions): Promise<FunctionsInvokeResponse<T>>;
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
1636
|
/**
|
|
1779
1637
|
* Blink Client - Main SDK entry point
|
|
1780
1638
|
* Factory function and client class for the Blink SDK
|
|
@@ -1789,8 +1647,6 @@ interface BlinkClient {
|
|
|
1789
1647
|
realtime: BlinkRealtime;
|
|
1790
1648
|
notifications: BlinkNotifications;
|
|
1791
1649
|
analytics: BlinkAnalytics;
|
|
1792
|
-
connectors: BlinkConnectors;
|
|
1793
|
-
functions: BlinkFunctions;
|
|
1794
1650
|
}
|
|
1795
1651
|
/**
|
|
1796
1652
|
* Create a new Blink client instance
|
|
@@ -2440,14 +2296,4 @@ declare class BlinkRealtimeImpl implements BlinkRealtime {
|
|
|
2440
2296
|
onPresence(channelName: string, callback: (users: PresenceUser[]) => void): () => void;
|
|
2441
2297
|
}
|
|
2442
2298
|
|
|
2443
|
-
|
|
2444
|
-
private httpClient;
|
|
2445
|
-
constructor(httpClient: HttpClient);
|
|
2446
|
-
status(provider: ConnectorProvider, options?: {
|
|
2447
|
-
account_id?: string;
|
|
2448
|
-
}): Promise<ConnectorStatusResponse>;
|
|
2449
|
-
execute<TParams = Record<string, unknown>, TData = any>(provider: ConnectorProvider, request: ConnectorExecuteRequest<TParams>): Promise<ConnectorExecuteResponse<TData>>;
|
|
2450
|
-
saveApiKey<TMetadata = Record<string, unknown>>(provider: ConnectorProvider, request: ConnectorApiKeyRequest<TMetadata>): Promise<ConnectorApiKeyResponse>;
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
export { type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, BlinkConnectorError, type BlinkConnectors, BlinkConnectorsImpl, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkUser, type ConnectorApiKeyRequest, type ConnectorApiKeyResponse, type ConnectorAuthMode, type ConnectorExecuteRequest, type ConnectorExecuteResponse, type ConnectorProvider, type ConnectorStatusResponse, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type ImageGenerationRequest, type ImageGenerationResponse, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenUsage, type TranscriptionRequest, type TranscriptionResponse, type UpdateOptions, type UpsertOptions, type WebBrowserModule, WebStorageAdapter, createClient, getDefaultStorageAdapter, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, platform };
|
|
2299
|
+
export { type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkUser, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type ImageGenerationRequest, type ImageGenerationResponse, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenUsage, type TranscriptionRequest, type TranscriptionResponse, type UpdateOptions, type UpsertOptions, type WebBrowserModule, WebStorageAdapter, createClient, getDefaultStorageAdapter, isBrowser, isNode, isReactNative, isWeb, platform };
|
package/dist/index.d.ts
CHANGED
|
@@ -61,39 +61,6 @@ interface BlinkClientConfig {
|
|
|
61
61
|
projectId: string;
|
|
62
62
|
authRequired?: boolean;
|
|
63
63
|
auth?: BlinkAuthConfig;
|
|
64
|
-
/**
|
|
65
|
-
* Publishable key (client-safe).
|
|
66
|
-
*
|
|
67
|
-
* Used for **public endpoints** when no user JWT is present (e.g. analytics ingest, storage upload,
|
|
68
|
-
* optional public DB reads). Never use for privileged operations.
|
|
69
|
-
*/
|
|
70
|
-
publishableKey?: string;
|
|
71
|
-
/**
|
|
72
|
-
* Secret key (server-only, privileged). Permanent, never expires.
|
|
73
|
-
*
|
|
74
|
-
* Used in **server runtimes** (Edge Functions, Workers) for privileged operations that require
|
|
75
|
-
* service-role access (e.g. raw SQL, bypassing row-level security).
|
|
76
|
-
*
|
|
77
|
-
* Format: `blnk_sk_{projectId-last-8}_{random}` (similar to Stripe's `sk_live_...`)
|
|
78
|
-
*
|
|
79
|
-
* **Security**: Never expose this key in client-side code. It is injected by the platform
|
|
80
|
-
* into edge function environments as `BLINK_SECRET_KEY`.
|
|
81
|
-
*
|
|
82
|
-
* When present, this key takes precedence over user JWTs for all requests.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* // Edge function (Deno)
|
|
86
|
-
* const blink = createClient({
|
|
87
|
-
* projectId: Deno.env.get('BLINK_PROJECT_ID')!,
|
|
88
|
-
* secretKey: Deno.env.get('BLINK_SECRET_KEY'),
|
|
89
|
-
* })
|
|
90
|
-
*/
|
|
91
|
-
secretKey?: string;
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated Use `secretKey` instead. Service tokens are JWT-based and expire after 365 days.
|
|
94
|
-
* Secret keys are permanent and never expire.
|
|
95
|
-
*/
|
|
96
|
-
serviceToken?: string;
|
|
97
64
|
/**
|
|
98
65
|
* Storage adapter for cross-platform token persistence
|
|
99
66
|
*
|
|
@@ -314,9 +281,6 @@ declare class BlinkError extends Error {
|
|
|
314
281
|
constructor(message: string, code?: string | undefined, status?: number | undefined, details?: any);
|
|
315
282
|
}
|
|
316
283
|
interface StorageUploadOptions {
|
|
317
|
-
/**
|
|
318
|
-
* @deprecated Blink storage uploads are add-only by default. This option is ignored.
|
|
319
|
-
*/
|
|
320
284
|
upsert?: boolean;
|
|
321
285
|
onProgress?: (percent: number) => void;
|
|
322
286
|
}
|
|
@@ -767,61 +731,13 @@ interface BlinkNotifications {
|
|
|
767
731
|
email(params: SendEmailRequest): Promise<SendEmailResponse>;
|
|
768
732
|
}
|
|
769
733
|
|
|
770
|
-
type ConnectorProvider = 'discord' | 'notion' | 'google_drive' | 'google_calendar' | 'ai';
|
|
771
|
-
type ConnectorAuthMode = 'oauth' | 'api_key' | 'blink_managed' | 'hybrid';
|
|
772
|
-
interface ConnectorStatusData {
|
|
773
|
-
connected: boolean;
|
|
774
|
-
provider: ConnectorProvider;
|
|
775
|
-
auth_mode?: ConnectorAuthMode;
|
|
776
|
-
account_id?: string;
|
|
777
|
-
metadata?: Record<string, unknown>;
|
|
778
|
-
expires_at?: any;
|
|
779
|
-
scopes?: string[];
|
|
780
|
-
}
|
|
781
|
-
interface ConnectorStatusResponse {
|
|
782
|
-
success: boolean;
|
|
783
|
-
data: ConnectorStatusData;
|
|
784
|
-
}
|
|
785
|
-
interface ConnectorExecuteRequest<TParams = Record<string, unknown>> {
|
|
786
|
-
method: string;
|
|
787
|
-
params?: TParams;
|
|
788
|
-
account_id?: string;
|
|
789
|
-
http_method?: string;
|
|
790
|
-
}
|
|
791
|
-
interface ConnectorExecuteResponse<TData = any> {
|
|
792
|
-
success: boolean;
|
|
793
|
-
data: TData;
|
|
794
|
-
}
|
|
795
|
-
interface ConnectorApiKeyRequest<TMetadata = Record<string, unknown>> {
|
|
796
|
-
api_key: string;
|
|
797
|
-
account_id?: string;
|
|
798
|
-
metadata?: TMetadata;
|
|
799
|
-
}
|
|
800
|
-
interface ConnectorApiKeyResponse {
|
|
801
|
-
success: boolean;
|
|
802
|
-
data: {
|
|
803
|
-
id: string;
|
|
804
|
-
account_id?: string;
|
|
805
|
-
};
|
|
806
|
-
}
|
|
807
|
-
interface BlinkConnectors {
|
|
808
|
-
status(provider: ConnectorProvider, options?: {
|
|
809
|
-
account_id?: string;
|
|
810
|
-
}): Promise<ConnectorStatusResponse>;
|
|
811
|
-
execute<TParams = Record<string, unknown>, TData = any>(provider: ConnectorProvider, request: ConnectorExecuteRequest<TParams>): Promise<ConnectorExecuteResponse<TData>>;
|
|
812
|
-
saveApiKey<TMetadata = Record<string, unknown>>(provider: ConnectorProvider, request: ConnectorApiKeyRequest<TMetadata>): Promise<ConnectorApiKeyResponse>;
|
|
813
|
-
}
|
|
814
|
-
declare class BlinkConnectorError extends BlinkError {
|
|
815
|
-
constructor(message: string, status?: number, details?: any);
|
|
816
|
-
}
|
|
817
|
-
|
|
818
734
|
/**
|
|
819
735
|
* HTTP client for Blink API requests
|
|
820
736
|
* Handles authentication, error handling, and request/response processing
|
|
821
737
|
*/
|
|
822
738
|
|
|
823
739
|
interface RequestOptions {
|
|
824
|
-
method?: 'GET' | 'POST' | '
|
|
740
|
+
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
825
741
|
headers?: Record<string, string>;
|
|
826
742
|
body?: any;
|
|
827
743
|
searchParams?: Record<string, string>;
|
|
@@ -836,14 +752,9 @@ declare class HttpClient {
|
|
|
836
752
|
private readonly authUrl;
|
|
837
753
|
private readonly coreUrl;
|
|
838
754
|
readonly projectId: string;
|
|
839
|
-
private readonly publishableKey?;
|
|
840
|
-
private readonly secretKey?;
|
|
841
755
|
private getToken;
|
|
842
756
|
private getValidToken?;
|
|
843
757
|
constructor(config: BlinkClientConfig, getToken: () => string | null, getValidToken?: () => Promise<string | null>);
|
|
844
|
-
private shouldAttachPublishableKey;
|
|
845
|
-
private shouldSkipSecretKey;
|
|
846
|
-
private getAuthorizationHeader;
|
|
847
758
|
/**
|
|
848
759
|
* Make an authenticated request to the Blink API
|
|
849
760
|
*/
|
|
@@ -925,7 +836,7 @@ declare class HttpClient {
|
|
|
925
836
|
signal?: AbortSignal;
|
|
926
837
|
}): Promise<BlinkResponse<any>>;
|
|
927
838
|
/**
|
|
928
|
-
* Stream AI text generation
|
|
839
|
+
* Stream AI text generation with Vercel AI SDK data stream format
|
|
929
840
|
*/
|
|
930
841
|
streamAiText(prompt: string, options: {
|
|
931
842
|
model?: string | undefined;
|
|
@@ -949,7 +860,7 @@ declare class HttpClient {
|
|
|
949
860
|
signal?: AbortSignal;
|
|
950
861
|
}): Promise<BlinkResponse<any>>;
|
|
951
862
|
/**
|
|
952
|
-
* Stream AI object generation
|
|
863
|
+
* Stream AI object generation with Vercel AI SDK data stream format
|
|
953
864
|
*/
|
|
954
865
|
streamAiObject(prompt: string, options: {
|
|
955
866
|
model?: string | undefined;
|
|
@@ -993,13 +904,6 @@ declare class HttpClient {
|
|
|
993
904
|
dataScreenshot(projectId: string, request: ScreenshotRequest): Promise<BlinkResponse<ScreenshotResponse>>;
|
|
994
905
|
dataFetch(projectId: string, request: FetchRequest): Promise<BlinkResponse<FetchResponse | AsyncFetchResponse>>;
|
|
995
906
|
dataSearch(projectId: string, request: SearchRequest): Promise<BlinkResponse<SearchResponse>>;
|
|
996
|
-
/**
|
|
997
|
-
* Connector requests
|
|
998
|
-
*/
|
|
999
|
-
private formatProviderForPath;
|
|
1000
|
-
connectorStatus(provider: ConnectorProvider): Promise<BlinkResponse<ConnectorStatusResponse>>;
|
|
1001
|
-
connectorExecute<TParams = Record<string, unknown>, TData = any>(provider: ConnectorProvider, request: ConnectorExecuteRequest<TParams>): Promise<BlinkResponse<ConnectorExecuteResponse<TData>>>;
|
|
1002
|
-
connectorSaveApiKey<TMetadata = Record<string, unknown>>(provider: ConnectorProvider, request: ConnectorApiKeyRequest<TMetadata>): Promise<BlinkResponse<ConnectorApiKeyResponse>>;
|
|
1003
907
|
/**
|
|
1004
908
|
* Realtime-specific requests
|
|
1005
909
|
*/
|
|
@@ -1037,17 +941,17 @@ declare class HttpClient {
|
|
|
1037
941
|
private parseResponse;
|
|
1038
942
|
private handleErrorResponse;
|
|
1039
943
|
/**
|
|
1040
|
-
* Parse Vercel AI SDK
|
|
1041
|
-
*
|
|
944
|
+
* Parse Vercel AI SDK data stream format
|
|
945
|
+
* Handles text chunks (0:"text"), partial objects (2:[...]), and metadata (d:, e:)
|
|
1042
946
|
*/
|
|
1043
|
-
private
|
|
947
|
+
private parseDataStream;
|
|
1044
948
|
}
|
|
1045
949
|
|
|
1046
950
|
/**
|
|
1047
951
|
* Platform detection for cross-platform compatibility
|
|
1048
|
-
* Detects whether code is running on web, React Native, Node.js
|
|
952
|
+
* Detects whether code is running on web, React Native, or Node.js
|
|
1049
953
|
*/
|
|
1050
|
-
type Platform = 'web' | 'react-native' | 'node'
|
|
954
|
+
type Platform = 'web' | 'react-native' | 'node';
|
|
1051
955
|
/**
|
|
1052
956
|
* Current platform
|
|
1053
957
|
*/
|
|
@@ -1058,9 +962,7 @@ declare const platform: Platform;
|
|
|
1058
962
|
declare const isWeb: boolean;
|
|
1059
963
|
declare const isReactNative: boolean;
|
|
1060
964
|
declare const isNode: boolean;
|
|
1061
|
-
declare const isDeno: boolean;
|
|
1062
965
|
declare const isBrowser: boolean;
|
|
1063
|
-
declare const isServer: boolean;
|
|
1064
966
|
|
|
1065
967
|
/**
|
|
1066
968
|
* Blink Auth Module - Client-side authentication management
|
|
@@ -1731,50 +1633,6 @@ declare class BlinkAnalyticsImpl implements BlinkAnalytics {
|
|
|
1731
1633
|
private detectChannel;
|
|
1732
1634
|
}
|
|
1733
1635
|
|
|
1734
|
-
/**
|
|
1735
|
-
* Blink Functions - Edge function invocation helper
|
|
1736
|
-
* Provides a simple interface for calling Blink Edge Functions with automatic JWT attachment
|
|
1737
|
-
*/
|
|
1738
|
-
|
|
1739
|
-
interface FunctionsInvokeOptions {
|
|
1740
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
1741
|
-
body?: any;
|
|
1742
|
-
headers?: Record<string, string>;
|
|
1743
|
-
searchParams?: Record<string, string>;
|
|
1744
|
-
}
|
|
1745
|
-
interface FunctionsInvokeResponse<T = any> {
|
|
1746
|
-
data: T;
|
|
1747
|
-
status: number;
|
|
1748
|
-
headers: Headers;
|
|
1749
|
-
}
|
|
1750
|
-
interface BlinkFunctions {
|
|
1751
|
-
/**
|
|
1752
|
-
* Invoke a Blink Edge Function.
|
|
1753
|
-
*
|
|
1754
|
-
* Automatically attaches the user's JWT for authenticated requests.
|
|
1755
|
-
* The function URL is constructed as: https://{projectSuffix}--{functionSlug}.functions.blink.new
|
|
1756
|
-
*
|
|
1757
|
-
* @param functionSlug - The slug of the edge function to invoke
|
|
1758
|
-
* @param options - Request options (method, body, headers, etc.)
|
|
1759
|
-
* @returns The function response
|
|
1760
|
-
*
|
|
1761
|
-
* @example
|
|
1762
|
-
* // Simple POST request
|
|
1763
|
-
* const { data } = await blink.functions.invoke('my-function', {
|
|
1764
|
-
* method: 'POST',
|
|
1765
|
-
* body: { message: 'Hello' }
|
|
1766
|
-
* })
|
|
1767
|
-
*
|
|
1768
|
-
* @example
|
|
1769
|
-
* // GET request with query params
|
|
1770
|
-
* const { data } = await blink.functions.invoke('my-function', {
|
|
1771
|
-
* method: 'GET',
|
|
1772
|
-
* searchParams: { limit: '10' }
|
|
1773
|
-
* })
|
|
1774
|
-
*/
|
|
1775
|
-
invoke<T = any>(functionSlug: string, options?: FunctionsInvokeOptions): Promise<FunctionsInvokeResponse<T>>;
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
1636
|
/**
|
|
1779
1637
|
* Blink Client - Main SDK entry point
|
|
1780
1638
|
* Factory function and client class for the Blink SDK
|
|
@@ -1789,8 +1647,6 @@ interface BlinkClient {
|
|
|
1789
1647
|
realtime: BlinkRealtime;
|
|
1790
1648
|
notifications: BlinkNotifications;
|
|
1791
1649
|
analytics: BlinkAnalytics;
|
|
1792
|
-
connectors: BlinkConnectors;
|
|
1793
|
-
functions: BlinkFunctions;
|
|
1794
1650
|
}
|
|
1795
1651
|
/**
|
|
1796
1652
|
* Create a new Blink client instance
|
|
@@ -2440,14 +2296,4 @@ declare class BlinkRealtimeImpl implements BlinkRealtime {
|
|
|
2440
2296
|
onPresence(channelName: string, callback: (users: PresenceUser[]) => void): () => void;
|
|
2441
2297
|
}
|
|
2442
2298
|
|
|
2443
|
-
|
|
2444
|
-
private httpClient;
|
|
2445
|
-
constructor(httpClient: HttpClient);
|
|
2446
|
-
status(provider: ConnectorProvider, options?: {
|
|
2447
|
-
account_id?: string;
|
|
2448
|
-
}): Promise<ConnectorStatusResponse>;
|
|
2449
|
-
execute<TParams = Record<string, unknown>, TData = any>(provider: ConnectorProvider, request: ConnectorExecuteRequest<TParams>): Promise<ConnectorExecuteResponse<TData>>;
|
|
2450
|
-
saveApiKey<TMetadata = Record<string, unknown>>(provider: ConnectorProvider, request: ConnectorApiKeyRequest<TMetadata>): Promise<ConnectorApiKeyResponse>;
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
export { type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, BlinkConnectorError, type BlinkConnectors, BlinkConnectorsImpl, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkUser, type ConnectorApiKeyRequest, type ConnectorApiKeyResponse, type ConnectorAuthMode, type ConnectorExecuteRequest, type ConnectorExecuteResponse, type ConnectorProvider, type ConnectorStatusResponse, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type ImageGenerationRequest, type ImageGenerationResponse, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenUsage, type TranscriptionRequest, type TranscriptionResponse, type UpdateOptions, type UpsertOptions, type WebBrowserModule, WebStorageAdapter, createClient, getDefaultStorageAdapter, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, platform };
|
|
2299
|
+
export { type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkUser, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type ImageGenerationRequest, type ImageGenerationResponse, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenUsage, type TranscriptionRequest, type TranscriptionResponse, type UpdateOptions, type UpsertOptions, type WebBrowserModule, WebStorageAdapter, createClient, getDefaultStorageAdapter, isBrowser, isNode, isReactNative, isWeb, platform };
|