connectbase-client 3.0.1 → 3.1.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/CHANGELOG.md +28 -0
- package/README.md +92 -0
- package/dist/cli.js +53 -0
- package/dist/connect-base.umd.js +3 -3
- package/dist/index.d.mts +104 -1
- package/dist/index.d.ts +104 -1
- package/dist/index.js +52 -0
- package/dist/index.mjs +51 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6696,6 +6696,103 @@ declare class AIAPI {
|
|
|
6696
6696
|
}): Promise<void>;
|
|
6697
6697
|
}
|
|
6698
6698
|
|
|
6699
|
+
/**
|
|
6700
|
+
* EndpointAPI — 사용자 PC GPU 모델을 `cb_pk_*` 한 키로 호출하는 dumb pipe.
|
|
6701
|
+
*
|
|
6702
|
+
* 핵심 비전: ConnectBase 는 **모델·API·워크플로우를 알지 않는다**. 사용자가 자기 PC 에서
|
|
6703
|
+
* 자기 모델을 띄우고 자기 API 를 정한다. SDK 는 라벨 → tunnel 매핑만 알고 페이로드
|
|
6704
|
+
* 그대로 forward.
|
|
6705
|
+
*
|
|
6706
|
+
* @example ComfyUI 호출
|
|
6707
|
+
* ```typescript
|
|
6708
|
+
* const cb = new ConnectBase({ publicKey: "cb_pk_..." })
|
|
6709
|
+
* const res = await cb.endpoint.call("comfyui-main", {
|
|
6710
|
+
* method: "POST",
|
|
6711
|
+
* path: "/prompt",
|
|
6712
|
+
* body: JSON.stringify({
|
|
6713
|
+
* prompt: {
|
|
6714
|
+
* // ComfyUI 노드 그래프
|
|
6715
|
+
* },
|
|
6716
|
+
* }),
|
|
6717
|
+
* headers: { "Content-Type": "application/json" },
|
|
6718
|
+
* })
|
|
6719
|
+
* const data = await res.json()
|
|
6720
|
+
* ```
|
|
6721
|
+
*
|
|
6722
|
+
* @example 스트리밍 응답 (SSE / chunked)
|
|
6723
|
+
* ```typescript
|
|
6724
|
+
* const res = await cb.endpoint.call("vllm-local", {
|
|
6725
|
+
* method: "POST",
|
|
6726
|
+
* path: "/v1/chat/completions",
|
|
6727
|
+
* body: JSON.stringify({
|
|
6728
|
+
* stream: true,
|
|
6729
|
+
* messages: [
|
|
6730
|
+
* // { role, content }
|
|
6731
|
+
* ],
|
|
6732
|
+
* }),
|
|
6733
|
+
* headers: { "Content-Type": "application/json" },
|
|
6734
|
+
* })
|
|
6735
|
+
* if (!res.body) throw new Error("no stream")
|
|
6736
|
+
* const reader = res.body.getReader()
|
|
6737
|
+
* while (true) {
|
|
6738
|
+
* const { done, value } = await reader.read()
|
|
6739
|
+
* if (done) break
|
|
6740
|
+
* // value 는 Uint8Array — 디코드 후 처리
|
|
6741
|
+
* }
|
|
6742
|
+
* ```
|
|
6743
|
+
*
|
|
6744
|
+
* @example AbortSignal 으로 취소
|
|
6745
|
+
* ```typescript
|
|
6746
|
+
* const ctrl = new AbortController()
|
|
6747
|
+
* setTimeout(() => ctrl.abort(), 30_000) // 30초 후 취소
|
|
6748
|
+
* const res = await cb.endpoint.call("hunyuan-laptop", {
|
|
6749
|
+
* method: "POST",
|
|
6750
|
+
* path: "/generate",
|
|
6751
|
+
* signal: ctrl.signal,
|
|
6752
|
+
* body: JSON.stringify({
|
|
6753
|
+
* // 모델 입력
|
|
6754
|
+
* }),
|
|
6755
|
+
* })
|
|
6756
|
+
* ```
|
|
6757
|
+
*/
|
|
6758
|
+
declare class EndpointAPI {
|
|
6759
|
+
private http;
|
|
6760
|
+
constructor(http: HttpClient);
|
|
6761
|
+
/**
|
|
6762
|
+
* 라벨 + path 로 사용자 PC 모델 호출. fetch() 시그니처 호환.
|
|
6763
|
+
*
|
|
6764
|
+
* 동작:
|
|
6765
|
+
* - URL 조립: `${baseUrl}/v1/proxy/${label}${path}`
|
|
6766
|
+
* - X-Public-Key 헤더 자동 주입 (호출자가 명시하면 그 값 우선)
|
|
6767
|
+
* - body / method / 추가 헤더 / signal 그대로 전달
|
|
6768
|
+
* - 응답 그대로 반환 (Response 객체) — 스트리밍은 res.body 로 read
|
|
6769
|
+
*
|
|
6770
|
+
* @param label - 콘솔에서 등록한 endpoint 라벨 (예: "comfyui-main")
|
|
6771
|
+
* @param init - fetch() 의 RequestInit + path. path 는 사용자 모델 서버의 엔드포인트 경로 (예: "/prompt", "/v1/chat/completions").
|
|
6772
|
+
*/
|
|
6773
|
+
call(label: string, init: EndpointCallInit): Promise<Response>;
|
|
6774
|
+
}
|
|
6775
|
+
/**
|
|
6776
|
+
* EndpointAPI.call 의 init 인자.
|
|
6777
|
+
*
|
|
6778
|
+
* 표준 RequestInit 와 거의 동일하지만 `path` 가 필수 (URL 은 SDK 가 조립).
|
|
6779
|
+
*/
|
|
6780
|
+
interface EndpointCallInit {
|
|
6781
|
+
/**
|
|
6782
|
+
* 사용자 모델 서버의 엔드포인트 경로. 반드시 `/` 로 시작.
|
|
6783
|
+
* 예: `"/prompt"`, `"/v1/chat/completions"`, `"/sdapi/v1/txt2img"`.
|
|
6784
|
+
*/
|
|
6785
|
+
path: string;
|
|
6786
|
+
/** HTTP 메서드 (기본: GET). */
|
|
6787
|
+
method?: string;
|
|
6788
|
+
/** 추가 요청 헤더. Content-Type / Authorization 등 사용자 모델 서버가 요구하는 것 그대로. */
|
|
6789
|
+
headers?: HeadersInit;
|
|
6790
|
+
/** 요청 본문. Blob / ArrayBuffer / FormData / string / ReadableStream 모두 지원. */
|
|
6791
|
+
body?: BodyInit | null;
|
|
6792
|
+
/** 취소 신호. */
|
|
6793
|
+
signal?: AbortSignal;
|
|
6794
|
+
}
|
|
6795
|
+
|
|
6699
6796
|
interface PublishMessageRequest {
|
|
6700
6797
|
body: unknown;
|
|
6701
6798
|
headers?: Record<string, string>;
|
|
@@ -7170,6 +7267,12 @@ declare class ConnectBase {
|
|
|
7170
7267
|
* 페이지뷰, 커스텀 이벤트, 세션 추적. GA4 수준의 웹 분석 제공.
|
|
7171
7268
|
*/
|
|
7172
7269
|
readonly analytics: AnalyticsAPI;
|
|
7270
|
+
/**
|
|
7271
|
+
* Endpoint API (로컬 모델 터널 dumb pipe)
|
|
7272
|
+
* 사용자 PC GPU 모델 (ComfyUI / A1111 / Hunyuan3D / 자체 FastAPI 등) 을 `cb_pk_*`
|
|
7273
|
+
* 한 키로 호출. 라벨로 라우팅, 페이로드/응답은 그대로 통과.
|
|
7274
|
+
*/
|
|
7275
|
+
readonly endpoint: EndpointAPI;
|
|
7173
7276
|
constructor(config?: ConnectBaseConfig);
|
|
7174
7277
|
/**
|
|
7175
7278
|
* 수동으로 토큰 설정 (기존 토큰으로 세션 복원 시)
|
|
@@ -7185,4 +7288,4 @@ declare class ConnectBase {
|
|
|
7185
7288
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
7186
7289
|
}
|
|
7187
7290
|
|
|
7188
|
-
export { AIAPI, type AIChatRequest, type AIChatResponse, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchSetPageMetaRequest, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type Channel, type ChannelMembership, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConnectionState, type GameConnectionStatus, type GameDelta, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GeoWithin, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoomInfo, type RoomStats, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionWrite, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, isWebTransportSupported };
|
|
7291
|
+
export { AIAPI, type AIChatRequest, type AIChatResponse, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchSetPageMetaRequest, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type Channel, type ChannelMembership, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConnectionState, type GameConnectionStatus, type GameDelta, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GeoWithin, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoomInfo, type RoomStats, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionWrite, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, isWebTransportSupported };
|
package/dist/index.d.ts
CHANGED
|
@@ -6696,6 +6696,103 @@ declare class AIAPI {
|
|
|
6696
6696
|
}): Promise<void>;
|
|
6697
6697
|
}
|
|
6698
6698
|
|
|
6699
|
+
/**
|
|
6700
|
+
* EndpointAPI — 사용자 PC GPU 모델을 `cb_pk_*` 한 키로 호출하는 dumb pipe.
|
|
6701
|
+
*
|
|
6702
|
+
* 핵심 비전: ConnectBase 는 **모델·API·워크플로우를 알지 않는다**. 사용자가 자기 PC 에서
|
|
6703
|
+
* 자기 모델을 띄우고 자기 API 를 정한다. SDK 는 라벨 → tunnel 매핑만 알고 페이로드
|
|
6704
|
+
* 그대로 forward.
|
|
6705
|
+
*
|
|
6706
|
+
* @example ComfyUI 호출
|
|
6707
|
+
* ```typescript
|
|
6708
|
+
* const cb = new ConnectBase({ publicKey: "cb_pk_..." })
|
|
6709
|
+
* const res = await cb.endpoint.call("comfyui-main", {
|
|
6710
|
+
* method: "POST",
|
|
6711
|
+
* path: "/prompt",
|
|
6712
|
+
* body: JSON.stringify({
|
|
6713
|
+
* prompt: {
|
|
6714
|
+
* // ComfyUI 노드 그래프
|
|
6715
|
+
* },
|
|
6716
|
+
* }),
|
|
6717
|
+
* headers: { "Content-Type": "application/json" },
|
|
6718
|
+
* })
|
|
6719
|
+
* const data = await res.json()
|
|
6720
|
+
* ```
|
|
6721
|
+
*
|
|
6722
|
+
* @example 스트리밍 응답 (SSE / chunked)
|
|
6723
|
+
* ```typescript
|
|
6724
|
+
* const res = await cb.endpoint.call("vllm-local", {
|
|
6725
|
+
* method: "POST",
|
|
6726
|
+
* path: "/v1/chat/completions",
|
|
6727
|
+
* body: JSON.stringify({
|
|
6728
|
+
* stream: true,
|
|
6729
|
+
* messages: [
|
|
6730
|
+
* // { role, content }
|
|
6731
|
+
* ],
|
|
6732
|
+
* }),
|
|
6733
|
+
* headers: { "Content-Type": "application/json" },
|
|
6734
|
+
* })
|
|
6735
|
+
* if (!res.body) throw new Error("no stream")
|
|
6736
|
+
* const reader = res.body.getReader()
|
|
6737
|
+
* while (true) {
|
|
6738
|
+
* const { done, value } = await reader.read()
|
|
6739
|
+
* if (done) break
|
|
6740
|
+
* // value 는 Uint8Array — 디코드 후 처리
|
|
6741
|
+
* }
|
|
6742
|
+
* ```
|
|
6743
|
+
*
|
|
6744
|
+
* @example AbortSignal 으로 취소
|
|
6745
|
+
* ```typescript
|
|
6746
|
+
* const ctrl = new AbortController()
|
|
6747
|
+
* setTimeout(() => ctrl.abort(), 30_000) // 30초 후 취소
|
|
6748
|
+
* const res = await cb.endpoint.call("hunyuan-laptop", {
|
|
6749
|
+
* method: "POST",
|
|
6750
|
+
* path: "/generate",
|
|
6751
|
+
* signal: ctrl.signal,
|
|
6752
|
+
* body: JSON.stringify({
|
|
6753
|
+
* // 모델 입력
|
|
6754
|
+
* }),
|
|
6755
|
+
* })
|
|
6756
|
+
* ```
|
|
6757
|
+
*/
|
|
6758
|
+
declare class EndpointAPI {
|
|
6759
|
+
private http;
|
|
6760
|
+
constructor(http: HttpClient);
|
|
6761
|
+
/**
|
|
6762
|
+
* 라벨 + path 로 사용자 PC 모델 호출. fetch() 시그니처 호환.
|
|
6763
|
+
*
|
|
6764
|
+
* 동작:
|
|
6765
|
+
* - URL 조립: `${baseUrl}/v1/proxy/${label}${path}`
|
|
6766
|
+
* - X-Public-Key 헤더 자동 주입 (호출자가 명시하면 그 값 우선)
|
|
6767
|
+
* - body / method / 추가 헤더 / signal 그대로 전달
|
|
6768
|
+
* - 응답 그대로 반환 (Response 객체) — 스트리밍은 res.body 로 read
|
|
6769
|
+
*
|
|
6770
|
+
* @param label - 콘솔에서 등록한 endpoint 라벨 (예: "comfyui-main")
|
|
6771
|
+
* @param init - fetch() 의 RequestInit + path. path 는 사용자 모델 서버의 엔드포인트 경로 (예: "/prompt", "/v1/chat/completions").
|
|
6772
|
+
*/
|
|
6773
|
+
call(label: string, init: EndpointCallInit): Promise<Response>;
|
|
6774
|
+
}
|
|
6775
|
+
/**
|
|
6776
|
+
* EndpointAPI.call 의 init 인자.
|
|
6777
|
+
*
|
|
6778
|
+
* 표준 RequestInit 와 거의 동일하지만 `path` 가 필수 (URL 은 SDK 가 조립).
|
|
6779
|
+
*/
|
|
6780
|
+
interface EndpointCallInit {
|
|
6781
|
+
/**
|
|
6782
|
+
* 사용자 모델 서버의 엔드포인트 경로. 반드시 `/` 로 시작.
|
|
6783
|
+
* 예: `"/prompt"`, `"/v1/chat/completions"`, `"/sdapi/v1/txt2img"`.
|
|
6784
|
+
*/
|
|
6785
|
+
path: string;
|
|
6786
|
+
/** HTTP 메서드 (기본: GET). */
|
|
6787
|
+
method?: string;
|
|
6788
|
+
/** 추가 요청 헤더. Content-Type / Authorization 등 사용자 모델 서버가 요구하는 것 그대로. */
|
|
6789
|
+
headers?: HeadersInit;
|
|
6790
|
+
/** 요청 본문. Blob / ArrayBuffer / FormData / string / ReadableStream 모두 지원. */
|
|
6791
|
+
body?: BodyInit | null;
|
|
6792
|
+
/** 취소 신호. */
|
|
6793
|
+
signal?: AbortSignal;
|
|
6794
|
+
}
|
|
6795
|
+
|
|
6699
6796
|
interface PublishMessageRequest {
|
|
6700
6797
|
body: unknown;
|
|
6701
6798
|
headers?: Record<string, string>;
|
|
@@ -7170,6 +7267,12 @@ declare class ConnectBase {
|
|
|
7170
7267
|
* 페이지뷰, 커스텀 이벤트, 세션 추적. GA4 수준의 웹 분석 제공.
|
|
7171
7268
|
*/
|
|
7172
7269
|
readonly analytics: AnalyticsAPI;
|
|
7270
|
+
/**
|
|
7271
|
+
* Endpoint API (로컬 모델 터널 dumb pipe)
|
|
7272
|
+
* 사용자 PC GPU 모델 (ComfyUI / A1111 / Hunyuan3D / 자체 FastAPI 등) 을 `cb_pk_*`
|
|
7273
|
+
* 한 키로 호출. 라벨로 라우팅, 페이로드/응답은 그대로 통과.
|
|
7274
|
+
*/
|
|
7275
|
+
readonly endpoint: EndpointAPI;
|
|
7173
7276
|
constructor(config?: ConnectBaseConfig);
|
|
7174
7277
|
/**
|
|
7175
7278
|
* 수동으로 토큰 설정 (기존 토큰으로 세션 복원 시)
|
|
@@ -7185,4 +7288,4 @@ declare class ConnectBase {
|
|
|
7185
7288
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
7186
7289
|
}
|
|
7187
7290
|
|
|
7188
|
-
export { AIAPI, type AIChatRequest, type AIChatResponse, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchSetPageMetaRequest, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type Channel, type ChannelMembership, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConnectionState, type GameConnectionStatus, type GameDelta, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GeoWithin, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoomInfo, type RoomStats, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionWrite, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, isWebTransportSupported };
|
|
7291
|
+
export { AIAPI, type AIChatRequest, type AIChatResponse, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchSetPageMetaRequest, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type Channel, type ChannelMembership, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConnectionState, type GameConnectionStatus, type GameDelta, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GeoWithin, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoomInfo, type RoomStats, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionWrite, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, isWebTransportSupported };
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
ApiError: () => ApiError,
|
|
26
26
|
AuthError: () => AuthError,
|
|
27
27
|
ConnectBase: () => ConnectBase,
|
|
28
|
+
EndpointAPI: () => EndpointAPI,
|
|
28
29
|
GameAPI: () => GameAPI,
|
|
29
30
|
GameRoom: () => GameRoom,
|
|
30
31
|
GameRoomTransport: () => GameRoomTransport,
|
|
@@ -7670,6 +7671,55 @@ var AIAPI = class {
|
|
|
7670
7671
|
}
|
|
7671
7672
|
};
|
|
7672
7673
|
|
|
7674
|
+
// src/api/endpoint.ts
|
|
7675
|
+
var EndpointAPI = class {
|
|
7676
|
+
constructor(http) {
|
|
7677
|
+
this.http = http;
|
|
7678
|
+
}
|
|
7679
|
+
/**
|
|
7680
|
+
* 라벨 + path 로 사용자 PC 모델 호출. fetch() 시그니처 호환.
|
|
7681
|
+
*
|
|
7682
|
+
* 동작:
|
|
7683
|
+
* - URL 조립: `${baseUrl}/v1/proxy/${label}${path}`
|
|
7684
|
+
* - X-Public-Key 헤더 자동 주입 (호출자가 명시하면 그 값 우선)
|
|
7685
|
+
* - body / method / 추가 헤더 / signal 그대로 전달
|
|
7686
|
+
* - 응답 그대로 반환 (Response 객체) — 스트리밍은 res.body 로 read
|
|
7687
|
+
*
|
|
7688
|
+
* @param label - 콘솔에서 등록한 endpoint 라벨 (예: "comfyui-main")
|
|
7689
|
+
* @param init - fetch() 의 RequestInit + path. path 는 사용자 모델 서버의 엔드포인트 경로 (예: "/prompt", "/v1/chat/completions").
|
|
7690
|
+
*/
|
|
7691
|
+
async call(label, init) {
|
|
7692
|
+
if (!label) {
|
|
7693
|
+
throw new Error("EndpointAPI.call: label required");
|
|
7694
|
+
}
|
|
7695
|
+
if (!init.path || !init.path.startsWith("/")) {
|
|
7696
|
+
throw new Error(
|
|
7697
|
+
`EndpointAPI.call: path must start with '/', got ${JSON.stringify(init.path)}`
|
|
7698
|
+
);
|
|
7699
|
+
}
|
|
7700
|
+
const baseUrl = this.http.getBaseUrl().replace(/\/+$/, "");
|
|
7701
|
+
const url = `${baseUrl}/v1/proxy/${encodeURIComponent(label)}${init.path}`;
|
|
7702
|
+
const headers = new Headers(init.headers ?? {});
|
|
7703
|
+
if (!headers.has("X-Public-Key")) {
|
|
7704
|
+
const pk = this.http.getPublicKey();
|
|
7705
|
+
if (!pk) {
|
|
7706
|
+
throw new Error(
|
|
7707
|
+
"EndpointAPI.call: publicKey not configured. Pass `publicKey` to ConnectBase constructor."
|
|
7708
|
+
);
|
|
7709
|
+
}
|
|
7710
|
+
headers.set("X-Public-Key", pk);
|
|
7711
|
+
}
|
|
7712
|
+
return fetch(url, {
|
|
7713
|
+
method: init.method ?? "GET",
|
|
7714
|
+
headers,
|
|
7715
|
+
body: init.body,
|
|
7716
|
+
signal: init.signal,
|
|
7717
|
+
// streaming 응답 (SSE / chunked) 을 바로 reader 로 받기 위해 'manual' redirect 회피.
|
|
7718
|
+
redirect: "follow"
|
|
7719
|
+
});
|
|
7720
|
+
}
|
|
7721
|
+
};
|
|
7722
|
+
|
|
7673
7723
|
// src/api/queue.ts
|
|
7674
7724
|
var QueueAPI = class {
|
|
7675
7725
|
constructor(http) {
|
|
@@ -9208,6 +9258,7 @@ var ConnectBase = class {
|
|
|
9208
9258
|
this.ai = new AIAPI(this.http);
|
|
9209
9259
|
this.queue = new QueueAPI(this.http);
|
|
9210
9260
|
this.analytics = new AnalyticsAPI(this.http);
|
|
9261
|
+
this.endpoint = new EndpointAPI(this.http);
|
|
9211
9262
|
this.auth._attachAnalytics(this.analytics);
|
|
9212
9263
|
}
|
|
9213
9264
|
/**
|
|
@@ -9237,6 +9288,7 @@ var index_default = ConnectBase;
|
|
|
9237
9288
|
ApiError,
|
|
9238
9289
|
AuthError,
|
|
9239
9290
|
ConnectBase,
|
|
9291
|
+
EndpointAPI,
|
|
9240
9292
|
GameAPI,
|
|
9241
9293
|
GameRoom,
|
|
9242
9294
|
GameRoomTransport,
|
package/dist/index.mjs
CHANGED
|
@@ -7632,6 +7632,55 @@ var AIAPI = class {
|
|
|
7632
7632
|
}
|
|
7633
7633
|
};
|
|
7634
7634
|
|
|
7635
|
+
// src/api/endpoint.ts
|
|
7636
|
+
var EndpointAPI = class {
|
|
7637
|
+
constructor(http) {
|
|
7638
|
+
this.http = http;
|
|
7639
|
+
}
|
|
7640
|
+
/**
|
|
7641
|
+
* 라벨 + path 로 사용자 PC 모델 호출. fetch() 시그니처 호환.
|
|
7642
|
+
*
|
|
7643
|
+
* 동작:
|
|
7644
|
+
* - URL 조립: `${baseUrl}/v1/proxy/${label}${path}`
|
|
7645
|
+
* - X-Public-Key 헤더 자동 주입 (호출자가 명시하면 그 값 우선)
|
|
7646
|
+
* - body / method / 추가 헤더 / signal 그대로 전달
|
|
7647
|
+
* - 응답 그대로 반환 (Response 객체) — 스트리밍은 res.body 로 read
|
|
7648
|
+
*
|
|
7649
|
+
* @param label - 콘솔에서 등록한 endpoint 라벨 (예: "comfyui-main")
|
|
7650
|
+
* @param init - fetch() 의 RequestInit + path. path 는 사용자 모델 서버의 엔드포인트 경로 (예: "/prompt", "/v1/chat/completions").
|
|
7651
|
+
*/
|
|
7652
|
+
async call(label, init) {
|
|
7653
|
+
if (!label) {
|
|
7654
|
+
throw new Error("EndpointAPI.call: label required");
|
|
7655
|
+
}
|
|
7656
|
+
if (!init.path || !init.path.startsWith("/")) {
|
|
7657
|
+
throw new Error(
|
|
7658
|
+
`EndpointAPI.call: path must start with '/', got ${JSON.stringify(init.path)}`
|
|
7659
|
+
);
|
|
7660
|
+
}
|
|
7661
|
+
const baseUrl = this.http.getBaseUrl().replace(/\/+$/, "");
|
|
7662
|
+
const url = `${baseUrl}/v1/proxy/${encodeURIComponent(label)}${init.path}`;
|
|
7663
|
+
const headers = new Headers(init.headers ?? {});
|
|
7664
|
+
if (!headers.has("X-Public-Key")) {
|
|
7665
|
+
const pk = this.http.getPublicKey();
|
|
7666
|
+
if (!pk) {
|
|
7667
|
+
throw new Error(
|
|
7668
|
+
"EndpointAPI.call: publicKey not configured. Pass `publicKey` to ConnectBase constructor."
|
|
7669
|
+
);
|
|
7670
|
+
}
|
|
7671
|
+
headers.set("X-Public-Key", pk);
|
|
7672
|
+
}
|
|
7673
|
+
return fetch(url, {
|
|
7674
|
+
method: init.method ?? "GET",
|
|
7675
|
+
headers,
|
|
7676
|
+
body: init.body,
|
|
7677
|
+
signal: init.signal,
|
|
7678
|
+
// streaming 응답 (SSE / chunked) 을 바로 reader 로 받기 위해 'manual' redirect 회피.
|
|
7679
|
+
redirect: "follow"
|
|
7680
|
+
});
|
|
7681
|
+
}
|
|
7682
|
+
};
|
|
7683
|
+
|
|
7635
7684
|
// src/api/queue.ts
|
|
7636
7685
|
var QueueAPI = class {
|
|
7637
7686
|
constructor(http) {
|
|
@@ -9170,6 +9219,7 @@ var ConnectBase = class {
|
|
|
9170
9219
|
this.ai = new AIAPI(this.http);
|
|
9171
9220
|
this.queue = new QueueAPI(this.http);
|
|
9172
9221
|
this.analytics = new AnalyticsAPI(this.http);
|
|
9222
|
+
this.endpoint = new EndpointAPI(this.http);
|
|
9173
9223
|
this.auth._attachAnalytics(this.analytics);
|
|
9174
9224
|
}
|
|
9175
9225
|
/**
|
|
@@ -9198,6 +9248,7 @@ export {
|
|
|
9198
9248
|
ApiError,
|
|
9199
9249
|
AuthError,
|
|
9200
9250
|
ConnectBase,
|
|
9251
|
+
EndpointAPI,
|
|
9201
9252
|
GameAPI,
|
|
9202
9253
|
GameRoom,
|
|
9203
9254
|
GameRoomTransport,
|