connectbase-client 0.3.0 → 0.3.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 +39 -8
- package/dist/cli.js +49 -7
- package/dist/connect-base.umd.js +2 -2
- package/dist/index.d.mts +149 -1
- package/dist/index.d.ts +149 -1
- package/dist/index.js +149 -2
- package/dist/index.mjs +148 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -392,6 +392,28 @@ interface RenameFileResponse {
|
|
|
392
392
|
interface FetchFilesResponse {
|
|
393
393
|
files: FileItem[];
|
|
394
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* 경로 기반 업로드 옵션
|
|
397
|
+
*/
|
|
398
|
+
interface UploadByPathOptions {
|
|
399
|
+
/** true면 기존 파일 덮어쓰기 (기본값: true) */
|
|
400
|
+
overwrite?: boolean;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* 경로로 파일 조회 응답
|
|
404
|
+
*/
|
|
405
|
+
interface GetFileByPathResponse {
|
|
406
|
+
id: string;
|
|
407
|
+
name: string;
|
|
408
|
+
path: string;
|
|
409
|
+
type: string;
|
|
410
|
+
mime_type: string;
|
|
411
|
+
size: number;
|
|
412
|
+
url: string;
|
|
413
|
+
parent_id?: string;
|
|
414
|
+
created_at: string;
|
|
415
|
+
updated_at: string;
|
|
416
|
+
}
|
|
395
417
|
|
|
396
418
|
declare class StorageAPI {
|
|
397
419
|
private http;
|
|
@@ -436,6 +458,51 @@ declare class StorageAPI {
|
|
|
436
458
|
* 이미지 파일 여부 확인
|
|
437
459
|
*/
|
|
438
460
|
isImageFile(file: FileItem): boolean;
|
|
461
|
+
/**
|
|
462
|
+
* 경로 기반 파일 업로드 (Firebase Storage 스타일)
|
|
463
|
+
*
|
|
464
|
+
* 같은 경로에 파일이 이미 존재하면 덮어쓰기합니다.
|
|
465
|
+
* URL이 변경되지 않아 고정 URL이 필요한 경우에 유용합니다.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* // 프로필 이미지 업로드 (항상 같은 URL 유지)
|
|
470
|
+
* const result = await storage.uploadByPath(
|
|
471
|
+
* storageId,
|
|
472
|
+
* '/profiles/user123/avatar.png',
|
|
473
|
+
* file
|
|
474
|
+
* )
|
|
475
|
+
* console.log(result.url) // 항상 동일한 URL
|
|
476
|
+
*
|
|
477
|
+
* // 같은 경로로 다시 업로드하면 파일만 교체
|
|
478
|
+
* await storage.uploadByPath(storageId, '/profiles/user123/avatar.png', newFile)
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
uploadByPath(storageId: string, path: string, file: File, options?: UploadByPathOptions): Promise<UploadFileResponse>;
|
|
482
|
+
/**
|
|
483
|
+
* 경로로 파일 조회
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```ts
|
|
487
|
+
* const file = await storage.getByPath(storageId, '/profiles/user123/avatar.png')
|
|
488
|
+
* console.log(file.url) // 파일의 공개 URL
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
getByPath(storageId: string, path: string): Promise<GetFileByPathResponse>;
|
|
492
|
+
/**
|
|
493
|
+
* 경로로 파일 URL 가져오기
|
|
494
|
+
*
|
|
495
|
+
* 파일이 존재하지 않으면 null 반환
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* const url = await storage.getUrlByPath(storageId, '/profiles/user123/avatar.png')
|
|
500
|
+
* if (url) {
|
|
501
|
+
* console.log('이미지 URL:', url)
|
|
502
|
+
* }
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
getUrlByPath(storageId: string, path: string): Promise<string | null>;
|
|
439
506
|
}
|
|
440
507
|
|
|
441
508
|
/**
|
|
@@ -2996,6 +3063,83 @@ declare class GameAPI {
|
|
|
2996
3063
|
private getHeaders;
|
|
2997
3064
|
}
|
|
2998
3065
|
|
|
3066
|
+
interface GoogleConnectionStatus {
|
|
3067
|
+
is_connected: boolean;
|
|
3068
|
+
email?: string;
|
|
3069
|
+
adsense_account_id?: string;
|
|
3070
|
+
}
|
|
3071
|
+
interface AdReportSummary {
|
|
3072
|
+
total_earnings: number;
|
|
3073
|
+
total_impressions: number;
|
|
3074
|
+
total_clicks: number;
|
|
3075
|
+
ctr: number;
|
|
3076
|
+
cpc: number;
|
|
3077
|
+
rpm: number;
|
|
3078
|
+
}
|
|
3079
|
+
interface DailyReport {
|
|
3080
|
+
date: string;
|
|
3081
|
+
earnings: number;
|
|
3082
|
+
impressions: number;
|
|
3083
|
+
clicks: number;
|
|
3084
|
+
ctr: number;
|
|
3085
|
+
}
|
|
3086
|
+
interface AdReportResponse {
|
|
3087
|
+
summary: AdReportSummary;
|
|
3088
|
+
daily: DailyReport[];
|
|
3089
|
+
}
|
|
3090
|
+
declare class AdsAPI {
|
|
3091
|
+
private http;
|
|
3092
|
+
constructor(http: HttpClient);
|
|
3093
|
+
/**
|
|
3094
|
+
* API Key 인증 시 /v1/public 접두사 반환
|
|
3095
|
+
*/
|
|
3096
|
+
private getPublicPrefix;
|
|
3097
|
+
/**
|
|
3098
|
+
* AdSense 연결 상태 확인
|
|
3099
|
+
*
|
|
3100
|
+
* @returns 연결 상태, 이메일, AdSense 계정 ID
|
|
3101
|
+
*
|
|
3102
|
+
* @example
|
|
3103
|
+
* ```typescript
|
|
3104
|
+
* const status = await cb.ads.getConnectionStatus()
|
|
3105
|
+
* if (status.is_connected) {
|
|
3106
|
+
* console.log('연결됨:', status.email)
|
|
3107
|
+
* }
|
|
3108
|
+
* ```
|
|
3109
|
+
*/
|
|
3110
|
+
getConnectionStatus(): Promise<GoogleConnectionStatus>;
|
|
3111
|
+
/**
|
|
3112
|
+
* AdSense 리포트 조회 (일별 데이터 + 요약)
|
|
3113
|
+
*
|
|
3114
|
+
* @param startDate - 시작일 (YYYY-MM-DD), 미지정 시 최근 30일
|
|
3115
|
+
* @param endDate - 종료일 (YYYY-MM-DD), 미지정 시 최근 30일
|
|
3116
|
+
* @returns 요약 + 일별 데이터
|
|
3117
|
+
*
|
|
3118
|
+
* @example
|
|
3119
|
+
* ```typescript
|
|
3120
|
+
* const report = await cb.ads.getReport('2025-01-01', '2025-01-31')
|
|
3121
|
+
* console.log('총 수익:', report.summary.total_earnings)
|
|
3122
|
+
* report.daily.forEach(day => {
|
|
3123
|
+
* console.log(`${day.date}: $${day.earnings}`)
|
|
3124
|
+
* })
|
|
3125
|
+
* ```
|
|
3126
|
+
*/
|
|
3127
|
+
getReport(startDate?: string, endDate?: string): Promise<AdReportResponse>;
|
|
3128
|
+
/**
|
|
3129
|
+
* 최근 30일 AdSense 요약 조회
|
|
3130
|
+
*
|
|
3131
|
+
* @returns 30일 합산 수익, 노출, 클릭, CTR, CPC, RPM
|
|
3132
|
+
*
|
|
3133
|
+
* @example
|
|
3134
|
+
* ```typescript
|
|
3135
|
+
* const summary = await cb.ads.getReportSummary()
|
|
3136
|
+
* console.log(`총 수익: $${summary.total_earnings}`)
|
|
3137
|
+
* console.log(`RPM: $${summary.rpm}`)
|
|
3138
|
+
* ```
|
|
3139
|
+
*/
|
|
3140
|
+
getReportSummary(): Promise<AdReportSummary>;
|
|
3141
|
+
}
|
|
3142
|
+
|
|
2999
3143
|
/**
|
|
3000
3144
|
* WebTransport-based Game Client
|
|
3001
3145
|
*
|
|
@@ -3271,6 +3415,10 @@ declare class ConnectBase {
|
|
|
3271
3415
|
* 게임 API (실시간 멀티플레이어)
|
|
3272
3416
|
*/
|
|
3273
3417
|
readonly game: GameAPI;
|
|
3418
|
+
/**
|
|
3419
|
+
* 광고 API (Google AdSense)
|
|
3420
|
+
*/
|
|
3421
|
+
readonly ads: AdsAPI;
|
|
3274
3422
|
constructor(config?: ConnectBaseConfig);
|
|
3275
3423
|
/**
|
|
3276
3424
|
* 수동으로 토큰 설정 (기존 토큰으로 세션 복원 시)
|
|
@@ -3286,4 +3434,4 @@ declare class ConnectBase {
|
|
|
3286
3434
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
3287
3435
|
}
|
|
3288
3436
|
|
|
3289
|
-
export { ApiError, type ApiKeyItem, type AppStatsResponse, AuthError, type AuthSettingsResponse, type BillingCycle, type BillingKeyResponse, type BulkCreateResponse, type BulkError, 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 ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateChannelRequest, type CreateColumnRequest, type CreateDataRequest, type CreateFolderRequest, type CreateFolderResponse, type CreatePlaylistRequest, type CreateSubscriptionRequest, type CreateTableRequest, type DataItem, type DataType, type DeleteWhereResponse, type DeviceInfo, type EnabledProviderInfo, type EnabledProvidersResponse, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type FetchApiKeysResponse, type FetchDataResponse, type FetchFilesResponse, type FileItem, 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 GetAuthorizationURLResponse, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinRoomRequest, type JoinRoomResponse, type ListBillingKeysResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MessageHandler, type MoveFileRequest, type OAuthCallbackResponse, type OAuthProvider, type PauseSubscriptionRequest, type PaymentDetail, type PaymentStatus, type PeerInfo, type PlayerEvent, type Playlist, type PlaylistItem, type PongMessage, type PreparePaymentRequest, type PreparePaymentResponse, type PushPlatform, type QualityProgress, type QueryOptions, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RenameFileRequest, type RenameFileResponse, type RoomInfo, type RoomStats, type RoomsResponse, type SendOptions, type ServerMessage, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type StateChange, type StateChangeHandler, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type TableSchema, type TranscodeStatus, type TransportType, type UpdateApiKeyRequest, type UpdateApiKeyResponse, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateDataRequest, type UpdateSubscriptionRequest, type UpdateVideoRequest, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoVisibility, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, isWebTransportSupported };
|
|
3437
|
+
export { type AdReportResponse, type AdReportSummary, AdsAPI, ApiError, type ApiKeyItem, type AppStatsResponse, AuthError, type AuthSettingsResponse, type BillingCycle, type BillingKeyResponse, type BulkCreateResponse, type BulkError, 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 ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateChannelRequest, type CreateColumnRequest, type CreateDataRequest, type CreateFolderRequest, type CreateFolderResponse, type CreatePlaylistRequest, type CreateSubscriptionRequest, type CreateTableRequest, type DailyReport, type DataItem, type DataType, type DeleteWhereResponse, type DeviceInfo, type EnabledProviderInfo, type EnabledProvidersResponse, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type FetchApiKeysResponse, type FetchDataResponse, type FetchFilesResponse, type FileItem, 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 GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinRoomRequest, type JoinRoomResponse, type ListBillingKeysResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MessageHandler, type MoveFileRequest, type OAuthCallbackResponse, type OAuthProvider, type PauseSubscriptionRequest, type PaymentDetail, type PaymentStatus, type PeerInfo, type PlayerEvent, type Playlist, type PlaylistItem, type PongMessage, type PreparePaymentRequest, type PreparePaymentResponse, type PushPlatform, type QualityProgress, type QueryOptions, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RenameFileRequest, type RenameFileResponse, type RoomInfo, type RoomStats, type RoomsResponse, type SendOptions, type ServerMessage, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type StateChange, type StateChangeHandler, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type TableSchema, type TranscodeStatus, type TransportType, type UpdateApiKeyRequest, type UpdateApiKeyResponse, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateDataRequest, type UpdateSubscriptionRequest, type UpdateVideoRequest, type UploadByPathOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoVisibility, 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
|
@@ -392,6 +392,28 @@ interface RenameFileResponse {
|
|
|
392
392
|
interface FetchFilesResponse {
|
|
393
393
|
files: FileItem[];
|
|
394
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* 경로 기반 업로드 옵션
|
|
397
|
+
*/
|
|
398
|
+
interface UploadByPathOptions {
|
|
399
|
+
/** true면 기존 파일 덮어쓰기 (기본값: true) */
|
|
400
|
+
overwrite?: boolean;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* 경로로 파일 조회 응답
|
|
404
|
+
*/
|
|
405
|
+
interface GetFileByPathResponse {
|
|
406
|
+
id: string;
|
|
407
|
+
name: string;
|
|
408
|
+
path: string;
|
|
409
|
+
type: string;
|
|
410
|
+
mime_type: string;
|
|
411
|
+
size: number;
|
|
412
|
+
url: string;
|
|
413
|
+
parent_id?: string;
|
|
414
|
+
created_at: string;
|
|
415
|
+
updated_at: string;
|
|
416
|
+
}
|
|
395
417
|
|
|
396
418
|
declare class StorageAPI {
|
|
397
419
|
private http;
|
|
@@ -436,6 +458,51 @@ declare class StorageAPI {
|
|
|
436
458
|
* 이미지 파일 여부 확인
|
|
437
459
|
*/
|
|
438
460
|
isImageFile(file: FileItem): boolean;
|
|
461
|
+
/**
|
|
462
|
+
* 경로 기반 파일 업로드 (Firebase Storage 스타일)
|
|
463
|
+
*
|
|
464
|
+
* 같은 경로에 파일이 이미 존재하면 덮어쓰기합니다.
|
|
465
|
+
* URL이 변경되지 않아 고정 URL이 필요한 경우에 유용합니다.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* // 프로필 이미지 업로드 (항상 같은 URL 유지)
|
|
470
|
+
* const result = await storage.uploadByPath(
|
|
471
|
+
* storageId,
|
|
472
|
+
* '/profiles/user123/avatar.png',
|
|
473
|
+
* file
|
|
474
|
+
* )
|
|
475
|
+
* console.log(result.url) // 항상 동일한 URL
|
|
476
|
+
*
|
|
477
|
+
* // 같은 경로로 다시 업로드하면 파일만 교체
|
|
478
|
+
* await storage.uploadByPath(storageId, '/profiles/user123/avatar.png', newFile)
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
uploadByPath(storageId: string, path: string, file: File, options?: UploadByPathOptions): Promise<UploadFileResponse>;
|
|
482
|
+
/**
|
|
483
|
+
* 경로로 파일 조회
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```ts
|
|
487
|
+
* const file = await storage.getByPath(storageId, '/profiles/user123/avatar.png')
|
|
488
|
+
* console.log(file.url) // 파일의 공개 URL
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
getByPath(storageId: string, path: string): Promise<GetFileByPathResponse>;
|
|
492
|
+
/**
|
|
493
|
+
* 경로로 파일 URL 가져오기
|
|
494
|
+
*
|
|
495
|
+
* 파일이 존재하지 않으면 null 반환
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* const url = await storage.getUrlByPath(storageId, '/profiles/user123/avatar.png')
|
|
500
|
+
* if (url) {
|
|
501
|
+
* console.log('이미지 URL:', url)
|
|
502
|
+
* }
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
getUrlByPath(storageId: string, path: string): Promise<string | null>;
|
|
439
506
|
}
|
|
440
507
|
|
|
441
508
|
/**
|
|
@@ -2996,6 +3063,83 @@ declare class GameAPI {
|
|
|
2996
3063
|
private getHeaders;
|
|
2997
3064
|
}
|
|
2998
3065
|
|
|
3066
|
+
interface GoogleConnectionStatus {
|
|
3067
|
+
is_connected: boolean;
|
|
3068
|
+
email?: string;
|
|
3069
|
+
adsense_account_id?: string;
|
|
3070
|
+
}
|
|
3071
|
+
interface AdReportSummary {
|
|
3072
|
+
total_earnings: number;
|
|
3073
|
+
total_impressions: number;
|
|
3074
|
+
total_clicks: number;
|
|
3075
|
+
ctr: number;
|
|
3076
|
+
cpc: number;
|
|
3077
|
+
rpm: number;
|
|
3078
|
+
}
|
|
3079
|
+
interface DailyReport {
|
|
3080
|
+
date: string;
|
|
3081
|
+
earnings: number;
|
|
3082
|
+
impressions: number;
|
|
3083
|
+
clicks: number;
|
|
3084
|
+
ctr: number;
|
|
3085
|
+
}
|
|
3086
|
+
interface AdReportResponse {
|
|
3087
|
+
summary: AdReportSummary;
|
|
3088
|
+
daily: DailyReport[];
|
|
3089
|
+
}
|
|
3090
|
+
declare class AdsAPI {
|
|
3091
|
+
private http;
|
|
3092
|
+
constructor(http: HttpClient);
|
|
3093
|
+
/**
|
|
3094
|
+
* API Key 인증 시 /v1/public 접두사 반환
|
|
3095
|
+
*/
|
|
3096
|
+
private getPublicPrefix;
|
|
3097
|
+
/**
|
|
3098
|
+
* AdSense 연결 상태 확인
|
|
3099
|
+
*
|
|
3100
|
+
* @returns 연결 상태, 이메일, AdSense 계정 ID
|
|
3101
|
+
*
|
|
3102
|
+
* @example
|
|
3103
|
+
* ```typescript
|
|
3104
|
+
* const status = await cb.ads.getConnectionStatus()
|
|
3105
|
+
* if (status.is_connected) {
|
|
3106
|
+
* console.log('연결됨:', status.email)
|
|
3107
|
+
* }
|
|
3108
|
+
* ```
|
|
3109
|
+
*/
|
|
3110
|
+
getConnectionStatus(): Promise<GoogleConnectionStatus>;
|
|
3111
|
+
/**
|
|
3112
|
+
* AdSense 리포트 조회 (일별 데이터 + 요약)
|
|
3113
|
+
*
|
|
3114
|
+
* @param startDate - 시작일 (YYYY-MM-DD), 미지정 시 최근 30일
|
|
3115
|
+
* @param endDate - 종료일 (YYYY-MM-DD), 미지정 시 최근 30일
|
|
3116
|
+
* @returns 요약 + 일별 데이터
|
|
3117
|
+
*
|
|
3118
|
+
* @example
|
|
3119
|
+
* ```typescript
|
|
3120
|
+
* const report = await cb.ads.getReport('2025-01-01', '2025-01-31')
|
|
3121
|
+
* console.log('총 수익:', report.summary.total_earnings)
|
|
3122
|
+
* report.daily.forEach(day => {
|
|
3123
|
+
* console.log(`${day.date}: $${day.earnings}`)
|
|
3124
|
+
* })
|
|
3125
|
+
* ```
|
|
3126
|
+
*/
|
|
3127
|
+
getReport(startDate?: string, endDate?: string): Promise<AdReportResponse>;
|
|
3128
|
+
/**
|
|
3129
|
+
* 최근 30일 AdSense 요약 조회
|
|
3130
|
+
*
|
|
3131
|
+
* @returns 30일 합산 수익, 노출, 클릭, CTR, CPC, RPM
|
|
3132
|
+
*
|
|
3133
|
+
* @example
|
|
3134
|
+
* ```typescript
|
|
3135
|
+
* const summary = await cb.ads.getReportSummary()
|
|
3136
|
+
* console.log(`총 수익: $${summary.total_earnings}`)
|
|
3137
|
+
* console.log(`RPM: $${summary.rpm}`)
|
|
3138
|
+
* ```
|
|
3139
|
+
*/
|
|
3140
|
+
getReportSummary(): Promise<AdReportSummary>;
|
|
3141
|
+
}
|
|
3142
|
+
|
|
2999
3143
|
/**
|
|
3000
3144
|
* WebTransport-based Game Client
|
|
3001
3145
|
*
|
|
@@ -3271,6 +3415,10 @@ declare class ConnectBase {
|
|
|
3271
3415
|
* 게임 API (실시간 멀티플레이어)
|
|
3272
3416
|
*/
|
|
3273
3417
|
readonly game: GameAPI;
|
|
3418
|
+
/**
|
|
3419
|
+
* 광고 API (Google AdSense)
|
|
3420
|
+
*/
|
|
3421
|
+
readonly ads: AdsAPI;
|
|
3274
3422
|
constructor(config?: ConnectBaseConfig);
|
|
3275
3423
|
/**
|
|
3276
3424
|
* 수동으로 토큰 설정 (기존 토큰으로 세션 복원 시)
|
|
@@ -3286,4 +3434,4 @@ declare class ConnectBase {
|
|
|
3286
3434
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
3287
3435
|
}
|
|
3288
3436
|
|
|
3289
|
-
export { ApiError, type ApiKeyItem, type AppStatsResponse, AuthError, type AuthSettingsResponse, type BillingCycle, type BillingKeyResponse, type BulkCreateResponse, type BulkError, 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 ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateChannelRequest, type CreateColumnRequest, type CreateDataRequest, type CreateFolderRequest, type CreateFolderResponse, type CreatePlaylistRequest, type CreateSubscriptionRequest, type CreateTableRequest, type DataItem, type DataType, type DeleteWhereResponse, type DeviceInfo, type EnabledProviderInfo, type EnabledProvidersResponse, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type FetchApiKeysResponse, type FetchDataResponse, type FetchFilesResponse, type FileItem, 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 GetAuthorizationURLResponse, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinRoomRequest, type JoinRoomResponse, type ListBillingKeysResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MessageHandler, type MoveFileRequest, type OAuthCallbackResponse, type OAuthProvider, type PauseSubscriptionRequest, type PaymentDetail, type PaymentStatus, type PeerInfo, type PlayerEvent, type Playlist, type PlaylistItem, type PongMessage, type PreparePaymentRequest, type PreparePaymentResponse, type PushPlatform, type QualityProgress, type QueryOptions, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RenameFileRequest, type RenameFileResponse, type RoomInfo, type RoomStats, type RoomsResponse, type SendOptions, type ServerMessage, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type StateChange, type StateChangeHandler, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type TableSchema, type TranscodeStatus, type TransportType, type UpdateApiKeyRequest, type UpdateApiKeyResponse, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateDataRequest, type UpdateSubscriptionRequest, type UpdateVideoRequest, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoVisibility, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, isWebTransportSupported };
|
|
3437
|
+
export { type AdReportResponse, type AdReportSummary, AdsAPI, ApiError, type ApiKeyItem, type AppStatsResponse, AuthError, type AuthSettingsResponse, type BillingCycle, type BillingKeyResponse, type BulkCreateResponse, type BulkError, 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 ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateChannelRequest, type CreateColumnRequest, type CreateDataRequest, type CreateFolderRequest, type CreateFolderResponse, type CreatePlaylistRequest, type CreateSubscriptionRequest, type CreateTableRequest, type DailyReport, type DataItem, type DataType, type DeleteWhereResponse, type DeviceInfo, type EnabledProviderInfo, type EnabledProvidersResponse, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type FetchApiKeysResponse, type FetchDataResponse, type FetchFilesResponse, type FileItem, 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 GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type GuestMemberSignInResponse, type HistoryResponse, type ICEServer, type ICEServersResponse, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinRoomRequest, type JoinRoomResponse, type ListBillingKeysResponse, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MessageHandler, type MoveFileRequest, type OAuthCallbackResponse, type OAuthProvider, type PauseSubscriptionRequest, type PaymentDetail, type PaymentStatus, type PeerInfo, type PlayerEvent, type Playlist, type PlaylistItem, type PongMessage, type PreparePaymentRequest, type PreparePaymentResponse, type PushPlatform, type QualityProgress, type QueryOptions, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RenameFileRequest, type RenameFileResponse, type RoomInfo, type RoomStats, type RoomsResponse, type SendOptions, type ServerMessage, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type StateChange, type StateChangeHandler, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamMessage, type StreamOptions, type StreamSession, type StreamTokenCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type TableSchema, type TranscodeStatus, type TransportType, type UpdateApiKeyRequest, type UpdateApiKeyResponse, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateDataRequest, type UpdateSubscriptionRequest, type UpdateVideoRequest, type UploadByPathOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type Video, type VideoComment, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoVisibility, 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
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AdsAPI: () => AdsAPI,
|
|
23
24
|
ApiError: () => ApiError,
|
|
24
25
|
AuthError: () => AuthError,
|
|
25
26
|
ConnectBase: () => ConnectBase,
|
|
@@ -707,6 +708,75 @@ var StorageAPI = class {
|
|
|
707
708
|
isImageFile(file) {
|
|
708
709
|
return file.mime_type?.startsWith("image/") || false;
|
|
709
710
|
}
|
|
711
|
+
/**
|
|
712
|
+
* 경로 기반 파일 업로드 (Firebase Storage 스타일)
|
|
713
|
+
*
|
|
714
|
+
* 같은 경로에 파일이 이미 존재하면 덮어쓰기합니다.
|
|
715
|
+
* URL이 변경되지 않아 고정 URL이 필요한 경우에 유용합니다.
|
|
716
|
+
*
|
|
717
|
+
* @example
|
|
718
|
+
* ```ts
|
|
719
|
+
* // 프로필 이미지 업로드 (항상 같은 URL 유지)
|
|
720
|
+
* const result = await storage.uploadByPath(
|
|
721
|
+
* storageId,
|
|
722
|
+
* '/profiles/user123/avatar.png',
|
|
723
|
+
* file
|
|
724
|
+
* )
|
|
725
|
+
* console.log(result.url) // 항상 동일한 URL
|
|
726
|
+
*
|
|
727
|
+
* // 같은 경로로 다시 업로드하면 파일만 교체
|
|
728
|
+
* await storage.uploadByPath(storageId, '/profiles/user123/avatar.png', newFile)
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
731
|
+
async uploadByPath(storageId, path, file, options) {
|
|
732
|
+
const prefix = this.getPublicPrefix();
|
|
733
|
+
const formData = new FormData();
|
|
734
|
+
formData.append("file", file);
|
|
735
|
+
const overwrite = options?.overwrite !== false;
|
|
736
|
+
formData.append("overwrite", overwrite.toString());
|
|
737
|
+
const cleanPath = path.startsWith("/") ? path.slice(1) : path;
|
|
738
|
+
return this.http.post(
|
|
739
|
+
`${prefix}/storages/files/${storageId}/path/${cleanPath}`,
|
|
740
|
+
formData
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* 경로로 파일 조회
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```ts
|
|
748
|
+
* const file = await storage.getByPath(storageId, '/profiles/user123/avatar.png')
|
|
749
|
+
* console.log(file.url) // 파일의 공개 URL
|
|
750
|
+
* ```
|
|
751
|
+
*/
|
|
752
|
+
async getByPath(storageId, path) {
|
|
753
|
+
const prefix = this.getPublicPrefix();
|
|
754
|
+
const cleanPath = path.startsWith("/") ? path.slice(1) : path;
|
|
755
|
+
return this.http.get(
|
|
756
|
+
`${prefix}/storages/files/${storageId}/path/${cleanPath}`
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* 경로로 파일 URL 가져오기
|
|
761
|
+
*
|
|
762
|
+
* 파일이 존재하지 않으면 null 반환
|
|
763
|
+
*
|
|
764
|
+
* @example
|
|
765
|
+
* ```ts
|
|
766
|
+
* const url = await storage.getUrlByPath(storageId, '/profiles/user123/avatar.png')
|
|
767
|
+
* if (url) {
|
|
768
|
+
* console.log('이미지 URL:', url)
|
|
769
|
+
* }
|
|
770
|
+
* ```
|
|
771
|
+
*/
|
|
772
|
+
async getUrlByPath(storageId, path) {
|
|
773
|
+
try {
|
|
774
|
+
const file = await this.getByPath(storageId, path);
|
|
775
|
+
return file.url || null;
|
|
776
|
+
} catch {
|
|
777
|
+
return null;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
710
780
|
};
|
|
711
781
|
|
|
712
782
|
// src/api/api-key.ts
|
|
@@ -2280,7 +2350,10 @@ var PaymentAPI = class {
|
|
|
2280
2350
|
*/
|
|
2281
2351
|
async cancel(paymentId, data) {
|
|
2282
2352
|
const prefix = this.getPublicPrefix();
|
|
2283
|
-
return this.http.post(`${prefix}/payments
|
|
2353
|
+
return this.http.post(`${prefix}/payments/cancel`, {
|
|
2354
|
+
payment_id: paymentId,
|
|
2355
|
+
...data
|
|
2356
|
+
});
|
|
2284
2357
|
}
|
|
2285
2358
|
/**
|
|
2286
2359
|
* 주문 ID로 결제 조회
|
|
@@ -2337,7 +2410,7 @@ var SubscriptionAPI = class {
|
|
|
2337
2410
|
*/
|
|
2338
2411
|
async issueBillingKey() {
|
|
2339
2412
|
const prefix = this.getPublicPrefix();
|
|
2340
|
-
return this.http.post(`${prefix}/subscriptions/billing-keys
|
|
2413
|
+
return this.http.post(`${prefix}/subscriptions/billing-keys`, {});
|
|
2341
2414
|
}
|
|
2342
2415
|
/**
|
|
2343
2416
|
* 빌링키 등록 확인
|
|
@@ -3848,6 +3921,78 @@ var GameAPI = class {
|
|
|
3848
3921
|
}
|
|
3849
3922
|
};
|
|
3850
3923
|
|
|
3924
|
+
// src/api/ads.ts
|
|
3925
|
+
var AdsAPI = class {
|
|
3926
|
+
constructor(http) {
|
|
3927
|
+
this.http = http;
|
|
3928
|
+
}
|
|
3929
|
+
/**
|
|
3930
|
+
* API Key 인증 시 /v1/public 접두사 반환
|
|
3931
|
+
*/
|
|
3932
|
+
getPublicPrefix() {
|
|
3933
|
+
return this.http.hasApiKey() ? "/v1/public" : "/v1";
|
|
3934
|
+
}
|
|
3935
|
+
/**
|
|
3936
|
+
* AdSense 연결 상태 확인
|
|
3937
|
+
*
|
|
3938
|
+
* @returns 연결 상태, 이메일, AdSense 계정 ID
|
|
3939
|
+
*
|
|
3940
|
+
* @example
|
|
3941
|
+
* ```typescript
|
|
3942
|
+
* const status = await cb.ads.getConnectionStatus()
|
|
3943
|
+
* if (status.is_connected) {
|
|
3944
|
+
* console.log('연결됨:', status.email)
|
|
3945
|
+
* }
|
|
3946
|
+
* ```
|
|
3947
|
+
*/
|
|
3948
|
+
async getConnectionStatus() {
|
|
3949
|
+
const prefix = this.getPublicPrefix();
|
|
3950
|
+
return this.http.get(`${prefix}/ads/connection`);
|
|
3951
|
+
}
|
|
3952
|
+
/**
|
|
3953
|
+
* AdSense 리포트 조회 (일별 데이터 + 요약)
|
|
3954
|
+
*
|
|
3955
|
+
* @param startDate - 시작일 (YYYY-MM-DD), 미지정 시 최근 30일
|
|
3956
|
+
* @param endDate - 종료일 (YYYY-MM-DD), 미지정 시 최근 30일
|
|
3957
|
+
* @returns 요약 + 일별 데이터
|
|
3958
|
+
*
|
|
3959
|
+
* @example
|
|
3960
|
+
* ```typescript
|
|
3961
|
+
* const report = await cb.ads.getReport('2025-01-01', '2025-01-31')
|
|
3962
|
+
* console.log('총 수익:', report.summary.total_earnings)
|
|
3963
|
+
* report.daily.forEach(day => {
|
|
3964
|
+
* console.log(`${day.date}: $${day.earnings}`)
|
|
3965
|
+
* })
|
|
3966
|
+
* ```
|
|
3967
|
+
*/
|
|
3968
|
+
async getReport(startDate, endDate) {
|
|
3969
|
+
const prefix = this.getPublicPrefix();
|
|
3970
|
+
const params = new URLSearchParams();
|
|
3971
|
+
if (startDate) params.set("start", startDate);
|
|
3972
|
+
if (endDate) params.set("end", endDate);
|
|
3973
|
+
const query = params.toString();
|
|
3974
|
+
return this.http.get(
|
|
3975
|
+
`${prefix}/ads/reports${query ? `?${query}` : ""}`
|
|
3976
|
+
);
|
|
3977
|
+
}
|
|
3978
|
+
/**
|
|
3979
|
+
* 최근 30일 AdSense 요약 조회
|
|
3980
|
+
*
|
|
3981
|
+
* @returns 30일 합산 수익, 노출, 클릭, CTR, CPC, RPM
|
|
3982
|
+
*
|
|
3983
|
+
* @example
|
|
3984
|
+
* ```typescript
|
|
3985
|
+
* const summary = await cb.ads.getReportSummary()
|
|
3986
|
+
* console.log(`총 수익: $${summary.total_earnings}`)
|
|
3987
|
+
* console.log(`RPM: $${summary.rpm}`)
|
|
3988
|
+
* ```
|
|
3989
|
+
*/
|
|
3990
|
+
async getReportSummary() {
|
|
3991
|
+
const prefix = this.getPublicPrefix();
|
|
3992
|
+
return this.http.get(`${prefix}/ads/reports/summary`);
|
|
3993
|
+
}
|
|
3994
|
+
};
|
|
3995
|
+
|
|
3851
3996
|
// src/api/game-transport.ts
|
|
3852
3997
|
var WebTransportTransport = class {
|
|
3853
3998
|
constructor(config, onMessage, onClose, onError) {
|
|
@@ -4479,6 +4624,7 @@ var ConnectBase = class {
|
|
|
4479
4624
|
this.push = new PushAPI(this.http);
|
|
4480
4625
|
this.video = new VideoAPI(this.http, config.videoUrl || DEFAULT_VIDEO_URL);
|
|
4481
4626
|
this.game = new GameAPI(this.http, config.gameUrl || DEFAULT_GAME_URL);
|
|
4627
|
+
this.ads = new AdsAPI(this.http);
|
|
4482
4628
|
}
|
|
4483
4629
|
/**
|
|
4484
4630
|
* 수동으로 토큰 설정 (기존 토큰으로 세션 복원 시)
|
|
@@ -4502,6 +4648,7 @@ var ConnectBase = class {
|
|
|
4502
4648
|
var index_default = ConnectBase;
|
|
4503
4649
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4504
4650
|
0 && (module.exports = {
|
|
4651
|
+
AdsAPI,
|
|
4505
4652
|
ApiError,
|
|
4506
4653
|
AuthError,
|
|
4507
4654
|
ConnectBase,
|