@huni_ee/nazu 0.0.0-stage → 0.1.1
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/LICENSE +201 -0
- package/README.md +72 -2
- package/dist/api/auth.d.ts +10 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +81 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/friends.d.ts +12 -0
- package/dist/api/friends.d.ts.map +1 -0
- package/dist/api/friends.js +126 -0
- package/dist/api/friends.js.map +1 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +9 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/self-profile.d.ts +8 -0
- package/dist/api/self-profile.d.ts.map +1 -0
- package/dist/api/self-profile.js +89 -0
- package/dist/api/self-profile.js.map +1 -0
- package/dist/api/types.d.ts +133 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +7 -0
- package/dist/api/types.js.map +1 -0
- package/dist/channel/channel.d.ts +122 -0
- package/dist/channel/channel.d.ts.map +1 -0
- package/dist/channel/channel.js +280 -0
- package/dist/channel/channel.js.map +1 -0
- package/dist/channel/index.d.ts +5 -0
- package/dist/channel/index.d.ts.map +1 -0
- package/dist/channel/index.js +9 -0
- package/dist/channel/index.js.map +1 -0
- package/dist/channel/media.d.ts +4 -0
- package/dist/channel/media.d.ts.map +1 -0
- package/dist/channel/media.js +42 -0
- package/dist/channel/media.js.map +1 -0
- package/dist/channel/normal-channel.d.ts +27 -0
- package/dist/channel/normal-channel.d.ts.map +1 -0
- package/dist/channel/normal-channel.js +39 -0
- package/dist/channel/normal-channel.js.map +1 -0
- package/dist/channel/open-channel.d.ts +25 -0
- package/dist/channel/open-channel.d.ts.map +1 -0
- package/dist/channel/open-channel.js +34 -0
- package/dist/channel/open-channel.js.map +1 -0
- package/dist/chat/attachment.d.ts +5 -0
- package/dist/chat/attachment.d.ts.map +1 -0
- package/dist/chat/attachment.js +90 -0
- package/dist/chat/attachment.js.map +1 -0
- package/dist/chat/chat-type.d.ts +31 -0
- package/dist/chat/chat-type.d.ts.map +1 -0
- package/dist/chat/chat-type.js +39 -0
- package/dist/chat/chat-type.js.map +1 -0
- package/dist/chat/chat.d.ts +15 -0
- package/dist/chat/chat.d.ts.map +1 -0
- package/dist/chat/chat.js +23 -0
- package/dist/chat/chat.js.map +1 -0
- package/dist/chat/feed.d.ts +231 -0
- package/dist/chat/feed.d.ts.map +1 -0
- package/dist/chat/feed.js +374 -0
- package/dist/chat/feed.js.map +1 -0
- package/dist/chat/index.d.ts +5 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +9 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/message.d.ts +170 -0
- package/dist/chat/message.d.ts.map +1 -0
- package/dist/chat/message.js +345 -0
- package/dist/chat/message.js.map +1 -0
- package/dist/client/arisa-client.d.ts +150 -0
- package/dist/client/arisa-client.d.ts.map +1 -0
- package/dist/client/arisa-client.js +439 -0
- package/dist/client/arisa-client.js.map +1 -0
- package/dist/client/client-helper.d.ts +58 -0
- package/dist/client/client-helper.d.ts.map +1 -0
- package/dist/client/client-helper.js +270 -0
- package/dist/client/client-helper.js.map +1 -0
- package/dist/client/event-handler.d.ts +19 -0
- package/dist/client/event-handler.d.ts.map +1 -0
- package/dist/client/event-handler.js +243 -0
- package/dist/client/event-handler.js.map +1 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/listeners.d.ts +34 -0
- package/dist/client/listeners.d.ts.map +1 -0
- package/dist/client/listeners.js +68 -0
- package/dist/client/listeners.js.map +1 -0
- package/dist/client/open-profile-watcher.d.ts +25 -0
- package/dist/client/open-profile-watcher.d.ts.map +1 -0
- package/dist/client/open-profile-watcher.js +85 -0
- package/dist/client/open-profile-watcher.js.map +1 -0
- package/dist/dashboard/server/client-adapter.d.ts +4 -0
- package/dist/dashboard/server/client-adapter.d.ts.map +1 -0
- package/dist/dashboard/server/client-adapter.js +277 -0
- package/dist/dashboard/server/client-adapter.js.map +1 -0
- package/dist/dashboard/server/credential.d.ts +5 -0
- package/dist/dashboard/server/credential.d.ts.map +1 -0
- package/dist/dashboard/server/credential.js +20 -0
- package/dist/dashboard/server/credential.js.map +1 -0
- package/dist/dashboard/server/handler.d.ts +8 -0
- package/dist/dashboard/server/handler.d.ts.map +1 -0
- package/dist/dashboard/server/handler.js +61 -0
- package/dist/dashboard/server/handler.js.map +1 -0
- package/dist/dashboard/server/http.d.ts +11 -0
- package/dist/dashboard/server/http.d.ts.map +1 -0
- package/dist/dashboard/server/http.js +60 -0
- package/dist/dashboard/server/http.js.map +1 -0
- package/dist/dashboard/server/index.d.ts +7 -0
- package/dist/dashboard/server/index.d.ts.map +1 -0
- package/dist/dashboard/server/index.js +252 -0
- package/dist/dashboard/server/index.js.map +1 -0
- package/dist/dashboard/server/posts.d.ts +5 -0
- package/dist/dashboard/server/posts.d.ts.map +1 -0
- package/dist/dashboard/server/posts.js +30 -0
- package/dist/dashboard/server/posts.js.map +1 -0
- package/dist/dashboard/server/role-store.d.ts +13 -0
- package/dist/dashboard/server/role-store.d.ts.map +1 -0
- package/dist/dashboard/server/role-store.js +60 -0
- package/dist/dashboard/server/role-store.js.map +1 -0
- package/dist/dashboard/server/routes/channels.d.ts +4 -0
- package/dist/dashboard/server/routes/channels.d.ts.map +1 -0
- package/dist/dashboard/server/routes/channels.js +262 -0
- package/dist/dashboard/server/routes/channels.js.map +1 -0
- package/dist/dashboard/server/routes/friends.d.ts +7 -0
- package/dist/dashboard/server/routes/friends.d.ts.map +1 -0
- package/dist/dashboard/server/routes/friends.js +130 -0
- package/dist/dashboard/server/routes/friends.js.map +1 -0
- package/dist/dashboard/server/routes/index.d.ts +8 -0
- package/dist/dashboard/server/routes/index.d.ts.map +1 -0
- package/dist/dashboard/server/routes/index.js +13 -0
- package/dist/dashboard/server/routes/index.js.map +1 -0
- package/dist/dashboard/server/routes/me.d.ts +4 -0
- package/dist/dashboard/server/routes/me.d.ts.map +1 -0
- package/dist/dashboard/server/routes/me.js +77 -0
- package/dist/dashboard/server/routes/me.js.map +1 -0
- package/dist/dashboard/server/routes/media-uploads.d.ts +8 -0
- package/dist/dashboard/server/routes/media-uploads.d.ts.map +1 -0
- package/dist/dashboard/server/routes/media-uploads.js +253 -0
- package/dist/dashboard/server/routes/media-uploads.js.map +1 -0
- package/dist/dashboard/server/routes/roles.d.ts +4 -0
- package/dist/dashboard/server/routes/roles.d.ts.map +1 -0
- package/dist/dashboard/server/routes/roles.js +57 -0
- package/dist/dashboard/server/routes/roles.js.map +1 -0
- package/dist/dashboard/server/routes/static.d.ts +4 -0
- package/dist/dashboard/server/routes/static.d.ts.map +1 -0
- package/dist/dashboard/server/routes/static.js +96 -0
- package/dist/dashboard/server/routes/static.js.map +1 -0
- package/dist/dashboard/server/routes/tools.d.ts +4 -0
- package/dist/dashboard/server/routes/tools.d.ts.map +1 -0
- package/dist/dashboard/server/routes/tools.js +355 -0
- package/dist/dashboard/server/routes/tools.js.map +1 -0
- package/dist/dashboard/server/self-profile.d.ts +19 -0
- package/dist/dashboard/server/self-profile.d.ts.map +1 -0
- package/dist/dashboard/server/self-profile.js +68 -0
- package/dist/dashboard/server/self-profile.js.map +1 -0
- package/dist/dashboard/server/sql.d.ts +3 -0
- package/dist/dashboard/server/sql.d.ts.map +1 -0
- package/dist/dashboard/server/sql.js +142 -0
- package/dist/dashboard/server/sql.js.map +1 -0
- package/dist/dashboard/server/types.d.ts +125 -0
- package/dist/dashboard/server/types.d.ts.map +1 -0
- package/dist/dashboard/server/types.js +7 -0
- package/dist/dashboard/server/types.js.map +1 -0
- package/dist/dashboard/server/validation.d.ts +9 -0
- package/dist/dashboard/server/validation.d.ts.map +1 -0
- package/dist/dashboard/server/validation.js +43 -0
- package/dist/dashboard/server/validation.js.map +1 -0
- package/dist/dashboard/web/assets/dashboard-Bta0crBA.js +3 -0
- package/dist/dashboard/web/assets/index-0JKvA2WI.js +2 -0
- package/dist/dashboard/web/assets/index-DIlIxwIo.css +1 -0
- package/dist/dashboard/web/assets/theme-init.js +32 -0
- package/dist/dashboard/web/fonts/PretendardVariable.woff2 +0 -0
- package/dist/dashboard/web/icons/profile-certified.svg +12 -0
- package/dist/dashboard/web/images/favicon.ico +0 -0
- package/dist/dashboard/web/index.html +16 -0
- package/dist/dashboard/web/licenses/LICENSE-FontAwesome-Free +165 -0
- package/dist/dashboard/web/licenses/LICENSE-Fuwari-MIT +21 -0
- package/dist/dashboard/web/licenses/LICENSE-KiwiTalk-APACHE +201 -0
- package/dist/dashboard/web/licenses/LICENSE-Lucide +43 -0
- package/dist/dashboard/web/licenses/LICENSE-MageIcons-APACHE +202 -0
- package/dist/dashboard/web/licenses/LICENSE-MaterialSymbols-APACHE +202 -0
- package/dist/dashboard/web/licenses/LICENSE-Pretendard-OFL +104 -0
- package/dist/dashboard/web/licenses/LICENSE-RemixIcon-APACHE +201 -0
- package/dist/dashboard/web/licenses/LICENSE-Tabler-MIT +21 -0
- package/dist/decorators/index.d.ts +47 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +95 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/grpc/arisa-grpc.d.ts +62 -0
- package/dist/grpc/arisa-grpc.d.ts.map +1 -0
- package/dist/grpc/arisa-grpc.js +242 -0
- package/dist/grpc/arisa-grpc.js.map +1 -0
- package/dist/grpc/generated/arisa.pb.d.ts +493 -0
- package/dist/grpc/generated/arisa.pb.d.ts.map +1 -0
- package/dist/grpc/generated/arisa.pb.js +3315 -0
- package/dist/grpc/generated/arisa.pb.js.map +1 -0
- package/dist/grpc/generated/google/protobuf/empty.pb.d.ts +38 -0
- package/dist/grpc/generated/google/protobuf/empty.pb.d.ts.map +1 -0
- package/dist/grpc/generated/google/protobuf/empty.pb.js +49 -0
- package/dist/grpc/generated/google/protobuf/empty.pb.js.map +1 -0
- package/dist/grpc/grpc-store.d.ts +32 -0
- package/dist/grpc/grpc-store.d.ts.map +1 -0
- package/dist/grpc/grpc-store.js +376 -0
- package/dist/grpc/grpc-store.js.map +1 -0
- package/dist/grpc/store.d.ts +77 -0
- package/dist/grpc/store.d.ts.map +1 -0
- package/dist/grpc/store.js +7 -0
- package/dist/grpc/store.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/kakao-link/index.d.ts +2 -0
- package/dist/kakao-link/index.d.ts.map +1 -0
- package/dist/kakao-link/index.js +7 -0
- package/dist/kakao-link/index.js.map +1 -0
- package/dist/kakao-link/kakao-link.d.ts +112 -0
- package/dist/kakao-link/kakao-link.d.ts.map +1 -0
- package/dist/kakao-link/kakao-link.js +334 -0
- package/dist/kakao-link/kakao-link.js.map +1 -0
- package/dist/types/channel.d.ts +83 -0
- package/dist/types/channel.d.ts.map +1 -0
- package/dist/types/channel.js +7 -0
- package/dist/types/channel.js.map +1 -0
- package/dist/types/chat.d.ts +233 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/dist/types/chat.js +7 -0
- package/dist/types/chat.js.map +1 -0
- package/dist/types/client.d.ts +26 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.js +7 -0
- package/dist/types/client.js.map +1 -0
- package/dist/types/event.d.ts +66 -0
- package/dist/types/event.d.ts.map +1 -0
- package/dist/types/event.js +7 -0
- package/dist/types/event.js.map +1 -0
- package/dist/types/user.d.ts +76 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +7 -0
- package/dist/types/user.js.map +1 -0
- package/dist/user/bot-user.d.ts +16 -0
- package/dist/user/bot-user.d.ts.map +1 -0
- package/dist/user/bot-user.js +35 -0
- package/dist/user/bot-user.js.map +1 -0
- package/dist/user/event-user.d.ts +78 -0
- package/dist/user/event-user.d.ts.map +1 -0
- package/dist/user/event-user.js +123 -0
- package/dist/user/event-user.js.map +1 -0
- package/dist/user/index.d.ts +8 -0
- package/dist/user/index.d.ts.map +1 -0
- package/dist/user/index.js +12 -0
- package/dist/user/index.js.map +1 -0
- package/dist/user/normal-user.d.ts +18 -0
- package/dist/user/normal-user.d.ts.map +1 -0
- package/dist/user/normal-user.js +42 -0
- package/dist/user/normal-user.js.map +1 -0
- package/dist/user/open-user.d.ts +20 -0
- package/dist/user/open-user.d.ts.map +1 -0
- package/dist/user/open-user.js +73 -0
- package/dist/user/open-user.js.map +1 -0
- package/dist/user/user-self.d.ts +24 -0
- package/dist/user/user-self.d.ts.map +1 -0
- package/dist/user/user-self.js +72 -0
- package/dist/user/user-self.js.map +1 -0
- package/dist/user/user.d.ts +47 -0
- package/dist/user/user.d.ts.map +1 -0
- package/dist/user/user.js +108 -0
- package/dist/user/user.js.map +1 -0
- package/dist/utils/database/index.d.ts +6 -0
- package/dist/utils/database/index.d.ts.map +1 -0
- package/dist/utils/database/index.js +90 -0
- package/dist/utils/database/index.js.map +1 -0
- package/dist/utils/id/index.d.ts +3 -0
- package/dist/utils/id/index.d.ts.map +1 -0
- package/dist/utils/id/index.js +11 -0
- package/dist/utils/id/index.js.map +1 -0
- package/dist/utils/json/index.d.ts +6 -0
- package/dist/utils/json/index.d.ts.map +1 -0
- package/dist/utils/json/index.js +25 -0
- package/dist/utils/json/index.js.map +1 -0
- package/package.json +83 -4
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Created on Fri Nov 13 2026
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) huni-ee. Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
import { JsonUtil } from '../utils/json/index.js';
|
|
8
|
+
/** 등록된 프로필 목록을 조회한다. */
|
|
9
|
+
function requestProfileList(credential) {
|
|
10
|
+
return axios.get('https://talk-pilsner.kakao.com/talk/profile/list', {
|
|
11
|
+
headers: getHeaders(credential),
|
|
12
|
+
responseType: 'text',
|
|
13
|
+
maxRedirects: 0
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/** 선택한 내 프로필의 상세 정보를 조회한다. */
|
|
17
|
+
function requestSelfProfile(credential, profileId) {
|
|
18
|
+
return axios.get('https://talk-pilsner.kakao.com/talk/profile25/me', {
|
|
19
|
+
headers: getHeaders(credential),
|
|
20
|
+
params: { profileId, lastSeenAt: '0' },
|
|
21
|
+
responseType: 'text',
|
|
22
|
+
maxRedirects: 0
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** 내 게시물 상세를 조회한다. 큰 게시물 ID는 문자열로 전달한다. */
|
|
26
|
+
function requestSelfPosts(credential, postIds) {
|
|
27
|
+
return axios.get('https://talk-pilsner.kakao.com/talk/profile25/post/view/me', {
|
|
28
|
+
headers: getHeaders(credential),
|
|
29
|
+
params: { postIds: postIds.join(',') },
|
|
30
|
+
responseType: 'text',
|
|
31
|
+
maxRedirects: 0
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** 선택한 내 프로필의 게시물 목록 다음 페이지를 조회한다. */
|
|
35
|
+
function requestSelfPostPage(credential, profileId, cursor) {
|
|
36
|
+
return axios.get('https://talk-pilsner.kakao.com/talk/profile25/post/list/me', {
|
|
37
|
+
headers: getHeaders(credential),
|
|
38
|
+
params: { profileId, cursor },
|
|
39
|
+
responseType: 'text',
|
|
40
|
+
maxRedirects: 0
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** 메인 프로필을 찾아 표시 정보와 상세 프로필을 함께 조회한다. */
|
|
44
|
+
export async function initSelfProfile(credential) {
|
|
45
|
+
const { revision, main } = await getMainProfile(credential);
|
|
46
|
+
const profile = getJson(await requestSelfProfile(credential, main.profileId));
|
|
47
|
+
return {
|
|
48
|
+
revision,
|
|
49
|
+
main: {
|
|
50
|
+
nickname: main.nickname,
|
|
51
|
+
statusMessage: main.statusMessage,
|
|
52
|
+
originalProfileImageUrl: main.originalProfileImageUrl
|
|
53
|
+
},
|
|
54
|
+
profile: { ...profile, userId: String(profile.userId) }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** 내 게시물 상세를 조회하고 응답 JSON을 읽는다. 큰 게시물 ID는 문자열로 전달한다. */
|
|
58
|
+
export async function initSelfPosts(credential, postIds) {
|
|
59
|
+
const posts = getJson(await requestSelfPosts(credential, postIds));
|
|
60
|
+
return { ...posts, profileId: String(posts.profileId) };
|
|
61
|
+
}
|
|
62
|
+
/** 최신 프로필 목록에서 메인 프로필을 찾아 게시물 다음 페이지를 조회한다. */
|
|
63
|
+
export async function initSelfPostPage(credential, cursor) {
|
|
64
|
+
const { main } = await getMainProfile(credential);
|
|
65
|
+
return getJson(await requestSelfPostPage(credential, main.profileId, cursor));
|
|
66
|
+
}
|
|
67
|
+
function getHeaders(credential) {
|
|
68
|
+
return {
|
|
69
|
+
A: 'android/26.8.2/ko',
|
|
70
|
+
Authorization: `${credential.accessToken}-${credential.deviceUuid}`,
|
|
71
|
+
'User-Agent': 'KT/26.8.2 An/14 ko'
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function getJson(response) {
|
|
75
|
+
const data = JsonUtil.parseLossless(response.data);
|
|
76
|
+
if (data.status !== 0) {
|
|
77
|
+
throw new Error(`Kakao API error: ${data.status} body=${response.data}`);
|
|
78
|
+
}
|
|
79
|
+
return data;
|
|
80
|
+
}
|
|
81
|
+
async function getMainProfile(credential) {
|
|
82
|
+
const list = getJson(await requestProfileList(credential));
|
|
83
|
+
const main = list.profiles.find((profile) => profile.main === true);
|
|
84
|
+
return {
|
|
85
|
+
revision: list.revision,
|
|
86
|
+
main: { ...main, profileId: String(main.profileId) }
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=self-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-profile.js","sourceRoot":"","sources":["../../src/api/self-profile.ts"],"names":[],"mappings":"AAAA;;;;GAI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ACnC,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAA0B,QAA2B;IACnE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,MAAM,SAAS,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,UAAsB;IAEtB,MAAM,IAAI,GAAG,OAAO,CAAsB,MAAM,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;IAChF,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAE,CAAC;IACrE,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;KACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { AxiosResponse } from 'axios';
|
|
2
|
+
import type { SelfProfile } from '../types/user.js';
|
|
3
|
+
/** 카카오 API 공통 응답 */
|
|
4
|
+
export interface KakaoResponse {
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly [key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
/** 인증 정보 */
|
|
9
|
+
export interface Credential {
|
|
10
|
+
/** 액세스 토큰 */
|
|
11
|
+
readonly accessToken: string;
|
|
12
|
+
/** 리프레시 토큰 */
|
|
13
|
+
readonly refreshToken: string;
|
|
14
|
+
/** 기기 UUID */
|
|
15
|
+
readonly deviceUuid: string;
|
|
16
|
+
}
|
|
17
|
+
/** 인증 정보와 메인 프로필 */
|
|
18
|
+
export interface KakaoAuthData {
|
|
19
|
+
/** 액세스 토큰 */
|
|
20
|
+
readonly accessToken: string;
|
|
21
|
+
/** 리프레시 토큰 */
|
|
22
|
+
readonly refreshToken: string;
|
|
23
|
+
/** 기기 UUID */
|
|
24
|
+
readonly deviceUuid: string;
|
|
25
|
+
/** 프로필 목록 리비전 */
|
|
26
|
+
readonly revision: number;
|
|
27
|
+
/** 메인 프로필 정보 */
|
|
28
|
+
readonly raw: {
|
|
29
|
+
readonly user: SelfProfile;
|
|
30
|
+
};
|
|
31
|
+
/** 내 프로필 API 응답 상태 코드 */
|
|
32
|
+
readonly status: number;
|
|
33
|
+
}
|
|
34
|
+
/** JSON으로 변환하기 전의 Axios 응답 */
|
|
35
|
+
export type FriendRequestResult = AxiosResponse<string>;
|
|
36
|
+
/** 친구 동기화 목록 */
|
|
37
|
+
export interface FriendsSyncResponse extends KakaoResponse {
|
|
38
|
+
readonly friends: unknown[];
|
|
39
|
+
}
|
|
40
|
+
/** 유저 ID별 친구 추가 시각 (Unix 초) */
|
|
41
|
+
export interface FriendsCreatedAtResponse extends KakaoResponse {
|
|
42
|
+
readonly createdAt: Readonly<Record<string, number>>;
|
|
43
|
+
}
|
|
44
|
+
/** 날짜별 생일 친구 정보 */
|
|
45
|
+
export interface BirthdayFriendsResponse extends KakaoResponse {
|
|
46
|
+
readonly birthday_friends: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/** 프로필을 업데이트한 친구 목록 */
|
|
49
|
+
export interface UpdatedProfileFriendsResponse extends KakaoResponse {
|
|
50
|
+
readonly users: unknown[];
|
|
51
|
+
}
|
|
52
|
+
/** 친구 상세 프로필 */
|
|
53
|
+
export interface FriendProfileResponse extends KakaoResponse {
|
|
54
|
+
readonly userId: string;
|
|
55
|
+
}
|
|
56
|
+
/** 내가 저장한 친구 메모 */
|
|
57
|
+
export interface FriendMemoResponse extends KakaoResponse {
|
|
58
|
+
readonly memo: string;
|
|
59
|
+
}
|
|
60
|
+
/** 친구 게시물 상세 */
|
|
61
|
+
export interface FriendPostsResponse extends KakaoResponse {
|
|
62
|
+
readonly userId: string;
|
|
63
|
+
readonly posts: unknown[];
|
|
64
|
+
}
|
|
65
|
+
/** 친구 게시물 목록과 다음 페이지 커서 */
|
|
66
|
+
export interface FriendPostPageResponse extends KakaoResponse {
|
|
67
|
+
readonly contents: unknown[];
|
|
68
|
+
readonly cursor?: string | null;
|
|
69
|
+
}
|
|
70
|
+
export interface FriendsListData {
|
|
71
|
+
readonly sync: FriendsSyncResponse;
|
|
72
|
+
readonly createdAt: FriendsCreatedAtResponse;
|
|
73
|
+
readonly birthday: BirthdayFriendsResponse;
|
|
74
|
+
readonly updated: UpdatedProfileFriendsResponse;
|
|
75
|
+
}
|
|
76
|
+
/** JSON으로 변환하기 전의 내 프로필 API Axios 응답 */
|
|
77
|
+
export type SelfRequestResult = AxiosResponse<string>;
|
|
78
|
+
/** 등록된 내 프로필 정보 */
|
|
79
|
+
export interface MainProfile {
|
|
80
|
+
/** 프로필 ID */
|
|
81
|
+
readonly profileId: string;
|
|
82
|
+
/** 프로필 닉네임 */
|
|
83
|
+
readonly nickname: string;
|
|
84
|
+
/** 프로필 상태 메세지 */
|
|
85
|
+
readonly statusMessage: string;
|
|
86
|
+
/** 원본 크기 프로필 이미지 주소 */
|
|
87
|
+
readonly originalProfileImageUrl: string;
|
|
88
|
+
/** 메인 프로필 여부 */
|
|
89
|
+
readonly main: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** 내 프로필 목록 응답 */
|
|
92
|
+
export interface ProfileListResponse extends KakaoResponse {
|
|
93
|
+
/** 프로필 목록 리비전 */
|
|
94
|
+
readonly revision: number;
|
|
95
|
+
/** 등록된 프로필 목록 */
|
|
96
|
+
readonly profiles: readonly MainProfile[];
|
|
97
|
+
}
|
|
98
|
+
/** 내 프로필 상세 응답 */
|
|
99
|
+
export interface SelfProfileResponse extends KakaoResponse {
|
|
100
|
+
/** 로그인한 카카오톡 유저 ID */
|
|
101
|
+
readonly userId: string;
|
|
102
|
+
}
|
|
103
|
+
/** 메인 프로필 정보와 내 프로필 상세 */
|
|
104
|
+
export interface SelfProfileDetail {
|
|
105
|
+
/** 프로필 목록 리비전 */
|
|
106
|
+
readonly revision: number;
|
|
107
|
+
/** 메인 프로필의 표시 정보 */
|
|
108
|
+
readonly main: {
|
|
109
|
+
/** 프로필 닉네임 */
|
|
110
|
+
readonly nickname: string;
|
|
111
|
+
/** 프로필 상태 메세지 */
|
|
112
|
+
readonly statusMessage: string;
|
|
113
|
+
/** 원본 크기 프로필 이미지 주소 */
|
|
114
|
+
readonly originalProfileImageUrl: string;
|
|
115
|
+
};
|
|
116
|
+
/** 내 프로필 상세 원본 응답 */
|
|
117
|
+
readonly profile: SelfProfileResponse;
|
|
118
|
+
}
|
|
119
|
+
/** 내 게시물 상세 응답 */
|
|
120
|
+
export interface SelfPostsResponse extends KakaoResponse {
|
|
121
|
+
/** 게시물을 작성한 프로필 ID */
|
|
122
|
+
readonly profileId: string;
|
|
123
|
+
/** 게시물 상세 목록 */
|
|
124
|
+
readonly posts: readonly unknown[];
|
|
125
|
+
}
|
|
126
|
+
/** 내 게시물 페이지 응답 */
|
|
127
|
+
export interface SelfPostPageResponse extends KakaoResponse {
|
|
128
|
+
/** 현재 페이지의 게시물 목록 */
|
|
129
|
+
readonly contents: readonly unknown[];
|
|
130
|
+
/** 다음 페이지 조회 커서 */
|
|
131
|
+
readonly cursor?: string | null;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,oBAAoB;AACpB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,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
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { ArisaGrpc } from '../grpc/arisa-grpc.js';
|
|
2
|
+
import type { MessageChat } from '../chat/message.js';
|
|
3
|
+
import type { ClientHelper } from '../client/client-helper.js';
|
|
4
|
+
import type { Store } from '../grpc/store.js';
|
|
5
|
+
import type { ChatCount, ChatCountOptions, ChannelRaw, MediaInput, OpenChannelInfo, SendMediaOptions } from '../types/channel.js';
|
|
6
|
+
import type { User } from '../user/user.js';
|
|
7
|
+
import { BotUser } from '../user/bot-user.js';
|
|
8
|
+
import type { NormalChannel } from './normal-channel.js';
|
|
9
|
+
import type { OpenChannel } from './open-channel.js';
|
|
10
|
+
/**
|
|
11
|
+
* 채팅방. 일반 채팅방은 {@link NormalChannel}, 오픈채팅방은 {@link OpenChannel}로 받습니다.
|
|
12
|
+
*
|
|
13
|
+
* 이벤트 리스너의 `channel` 인자나 `client.getChannel()`로 받습니다.
|
|
14
|
+
* `Promise`를 돌려주는 속성은 `await`로 읽습니다.
|
|
15
|
+
*/
|
|
16
|
+
export declare class Channel {
|
|
17
|
+
/** 채팅방 ID */
|
|
18
|
+
readonly id: string;
|
|
19
|
+
/** 채팅방 종류 ({@link NormalChannelType} 또는 {@link OpenChannelType}) */
|
|
20
|
+
readonly type: string;
|
|
21
|
+
/** 채팅방 이름 */
|
|
22
|
+
readonly name: string | null;
|
|
23
|
+
/** 채팅방 이름 설정에서 내가 지정한 이름 */
|
|
24
|
+
readonly privateName: string | null;
|
|
25
|
+
/** 오픈채팅방 정보. 일반 채팅방이면 `null` */
|
|
26
|
+
readonly openChannel: OpenChannelInfo | null;
|
|
27
|
+
/** 채팅방 원본 데이터 */
|
|
28
|
+
readonly raw: ChannelRaw;
|
|
29
|
+
/** @internal */
|
|
30
|
+
protected readonly grpc: ArisaGrpc;
|
|
31
|
+
/** @internal */
|
|
32
|
+
protected readonly store: Store;
|
|
33
|
+
private readonly helper;
|
|
34
|
+
/** @internal 이벤트나 클라이언트가 만든 객체를 쓰세요. */
|
|
35
|
+
constructor(id: string, type: string, grpc: ArisaGrpc, name?: string | null, privateName?: string | null, openChannel?: OpenChannelInfo | null, helper?: ClientHelper, store?: Store);
|
|
36
|
+
/**
|
|
37
|
+
* 채팅방에 메세지를 보냅니다.
|
|
38
|
+
*
|
|
39
|
+
* @param message 보낼 메세지
|
|
40
|
+
* @param threadId 스레드에 보낼 때 스레드 ID
|
|
41
|
+
*/
|
|
42
|
+
send(message: string, threadId?: string | null): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* 채팅방에 파일을 보냅니다. 파일 경로, URL, 바이트, {@link MediaFile}을 넣을 수 있습니다.
|
|
45
|
+
*
|
|
46
|
+
* `options.mode`를 생략하면 하나는 `single`, 배열은 `multiple`로 보냅니다.
|
|
47
|
+
*
|
|
48
|
+
* @param files 보낼 파일이나 파일 목록
|
|
49
|
+
* @param options 전송 방식
|
|
50
|
+
* @throws `files`가 빈 배열일 때
|
|
51
|
+
*/
|
|
52
|
+
sendMedia(files: MediaInput | MediaInput[], options?: SendMediaOptions): Promise<void>;
|
|
53
|
+
/** 채팅방을 읽음 처리합니다. */
|
|
54
|
+
read(): Promise<void>;
|
|
55
|
+
/** 채팅방에 입장합니다. */
|
|
56
|
+
enter(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* 로그 ID로 메세지를 조회합니다.
|
|
59
|
+
*
|
|
60
|
+
* @param logId 메세지 로그 ID
|
|
61
|
+
* @throws 클라이언트와 연결되지 않은 채팅방 객체에서 호출할 때
|
|
62
|
+
*/
|
|
63
|
+
getChat(logId: string): Promise<MessageChat>;
|
|
64
|
+
/**
|
|
65
|
+
* 여러 로그 ID로 메세지를 한꺼번에 조회합니다.
|
|
66
|
+
*
|
|
67
|
+
* @param logIds 메세지 로그 ID 목록
|
|
68
|
+
* @throws 클라이언트와 연결되지 않은 채팅방 객체에서 호출할 때
|
|
69
|
+
*/
|
|
70
|
+
getChats(logIds: string[]): Promise<MessageChat[]>;
|
|
71
|
+
/**
|
|
72
|
+
* 최근 메세지를 조회합니다. 메세지가 없으면 빈 배열을 돌려줍니다.
|
|
73
|
+
*
|
|
74
|
+
* @param count 조회할 메세지 수. 소수점 아래는 버립니다.
|
|
75
|
+
* @throws `count`가 유한한 수가 아니거나 소수점 아래를 버린 값이 1보다 작을 때
|
|
76
|
+
*/
|
|
77
|
+
getRecentChats(count?: number): Promise<MessageChat[]>;
|
|
78
|
+
/**
|
|
79
|
+
* 기간 안에 유저마다 보낸 채팅 수를 셉니다. 조회되지 않은 유저는 결과에서 빠집니다.
|
|
80
|
+
*
|
|
81
|
+
* @param options 집계 기간과 피드 포함 여부. 생략하면 처음부터 지금까지 피드 없이 셉니다.
|
|
82
|
+
* @throws 날짜가 올바르지 않거나 `startDate`가 `endDate`보다 늦을 때
|
|
83
|
+
*/
|
|
84
|
+
getChatCountsByUser(options?: ChatCountOptions): Promise<ChatCount<User>[]>;
|
|
85
|
+
/** 지금 채팅방에 있는 멤버 ID 목록 */
|
|
86
|
+
get memberIds(): Promise<string[]>;
|
|
87
|
+
/** 지금 채팅방에 있는 멤버 목록 */
|
|
88
|
+
get members(): Promise<User[]>;
|
|
89
|
+
/** 방장. 방장이 없는 채팅방이거나 찾지 못하면 `null` */
|
|
90
|
+
get host(): Promise<User | null>;
|
|
91
|
+
/** 부방장 목록. 부방장이 없는 채팅방이면 빈 배열 */
|
|
92
|
+
get moderators(): Promise<User[]>;
|
|
93
|
+
/** 채팅방에 추가된 챗봇 목록 */
|
|
94
|
+
get botUsers(): Promise<BotUser[]>;
|
|
95
|
+
/** 일반 채팅방 여부 */
|
|
96
|
+
isNormalChannel(): this is NormalChannel;
|
|
97
|
+
/** 나와의 채팅(`MemoChat`) 여부 */
|
|
98
|
+
isMemoChannel(): boolean;
|
|
99
|
+
/** 일반 1:1 채팅(`DirectChat`) 여부 */
|
|
100
|
+
isDirectChannel(): boolean;
|
|
101
|
+
/** 일반 그룹 채팅(`MultiChat`) 여부 */
|
|
102
|
+
isMultiChannel(): boolean;
|
|
103
|
+
/** 팀채팅(`TeamMultiChat`) 여부 */
|
|
104
|
+
isTeamMultiChannel(): boolean;
|
|
105
|
+
/** 카카오톡 채널(`PlusChat`) 여부 */
|
|
106
|
+
isPlusChannel(): boolean;
|
|
107
|
+
/** 오픈채팅방 여부 */
|
|
108
|
+
isOpenChannel(): this is OpenChannel;
|
|
109
|
+
/** 1:1 오픈채팅(`OD`) 여부 */
|
|
110
|
+
isOpenDirectChannel(): boolean;
|
|
111
|
+
/** 그룹 오픈채팅(`OM`) 여부 */
|
|
112
|
+
isOpenMultiChannel(): boolean;
|
|
113
|
+
/** 커뮤니티 오픈 그룹 채팅(`COM`) 여부 */
|
|
114
|
+
isCommunityOpenMultiChannel(): boolean;
|
|
115
|
+
private loadMemberIds;
|
|
116
|
+
private loadUsers;
|
|
117
|
+
private loadMembers;
|
|
118
|
+
private loadHost;
|
|
119
|
+
private loadModerators;
|
|
120
|
+
private loadBotUsers;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/channel/channel.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAA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AI7B,8BAA8B;IAC9B,2BAA2B,IAAI,OAAO;YAIxB,aAAa;IAK3B,OAAO,CAAC,SAAS;YAKH,WAAW;YAIX,QAAQ;YAYR,cAAc;YAWd,YAAY;CA4B3B"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Created on Fri Nov 13 2026
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) huni-ee. Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
import { GrpcStore } from '../grpc/grpc-store.js';
|
|
7
|
+
import { BotUser } from '../user/bot-user.js';
|
|
8
|
+
import { prepareMedia } from './media.js';
|
|
9
|
+
/**
|
|
10
|
+
* 채팅방. 일반 채팅방은 {@link NormalChannel}, 오픈채팅방은 {@link OpenChannel}로 받습니다.
|
|
11
|
+
*
|
|
12
|
+
* 이벤트 리스너의 `channel` 인자나 `client.getChannel()`로 받습니다.
|
|
13
|
+
* `Promise`를 돌려주는 속성은 `await`로 읽습니다.
|
|
14
|
+
*/
|
|
15
|
+
export class Channel {
|
|
16
|
+
/** 채팅방 ID */
|
|
17
|
+
id;
|
|
18
|
+
/** 채팅방 종류 ({@link NormalChannelType} 또는 {@link OpenChannelType}) */
|
|
19
|
+
type;
|
|
20
|
+
/** 채팅방 이름 */
|
|
21
|
+
name;
|
|
22
|
+
/** 채팅방 이름 설정에서 내가 지정한 이름 */
|
|
23
|
+
privateName;
|
|
24
|
+
/** 오픈채팅방 정보. 일반 채팅방이면 `null` */
|
|
25
|
+
openChannel;
|
|
26
|
+
/** 채팅방 원본 데이터 */
|
|
27
|
+
raw;
|
|
28
|
+
/** @internal */
|
|
29
|
+
grpc;
|
|
30
|
+
/** @internal */
|
|
31
|
+
store;
|
|
32
|
+
helper;
|
|
33
|
+
/** @internal 이벤트나 클라이언트가 만든 객체를 쓰세요. */
|
|
34
|
+
constructor(id, type, grpc, name = null, privateName = null, openChannel = null, helper, store) {
|
|
35
|
+
this.id = id;
|
|
36
|
+
this.type = type;
|
|
37
|
+
this.name = name;
|
|
38
|
+
this.privateName = privateName;
|
|
39
|
+
this.openChannel = openChannel;
|
|
40
|
+
this.grpc = grpc;
|
|
41
|
+
this.store = store ?? new GrpcStore(grpc);
|
|
42
|
+
this.helper = helper;
|
|
43
|
+
this.raw = {
|
|
44
|
+
id,
|
|
45
|
+
type,
|
|
46
|
+
name,
|
|
47
|
+
privateName,
|
|
48
|
+
openChannel
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 채팅방에 메세지를 보냅니다.
|
|
53
|
+
*
|
|
54
|
+
* @param message 보낼 메세지
|
|
55
|
+
* @param threadId 스레드에 보낼 때 스레드 ID
|
|
56
|
+
*/
|
|
57
|
+
async send(message, threadId) {
|
|
58
|
+
await this.grpc.reply(this.id, message, threadId);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 채팅방에 파일을 보냅니다. 파일 경로, URL, 바이트, {@link MediaFile}을 넣을 수 있습니다.
|
|
62
|
+
*
|
|
63
|
+
* `options.mode`를 생략하면 하나는 `single`, 배열은 `multiple`로 보냅니다.
|
|
64
|
+
*
|
|
65
|
+
* @param files 보낼 파일이나 파일 목록
|
|
66
|
+
* @param options 전송 방식
|
|
67
|
+
* @throws `files`가 빈 배열일 때
|
|
68
|
+
*/
|
|
69
|
+
async sendMedia(files, options = {}) {
|
|
70
|
+
const multiple = Array.isArray(files);
|
|
71
|
+
const items = multiple ? files : [files];
|
|
72
|
+
if (items.length === 0)
|
|
73
|
+
throw new Error('전송할 파일이 없습니다.');
|
|
74
|
+
// 보낼 차례가 된 파일만 읽는다.
|
|
75
|
+
await this.grpc.sendMedia(this.id, items.map((item) => () => prepareMedia(item)), options.mode ?? (multiple ? 'multiple' : 'single'));
|
|
76
|
+
}
|
|
77
|
+
/** 채팅방을 읽음 처리합니다. */
|
|
78
|
+
async read() {
|
|
79
|
+
await this.grpc.markRead(this.id);
|
|
80
|
+
}
|
|
81
|
+
/** 채팅방에 입장합니다. */
|
|
82
|
+
async enter() {
|
|
83
|
+
await this.grpc.enterChannel(this.id);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 로그 ID로 메세지를 조회합니다.
|
|
87
|
+
*
|
|
88
|
+
* @param logId 메세지 로그 ID
|
|
89
|
+
* @throws 클라이언트와 연결되지 않은 채팅방 객체에서 호출할 때
|
|
90
|
+
*/
|
|
91
|
+
getChat(logId) {
|
|
92
|
+
if (this.helper === undefined)
|
|
93
|
+
throw new Error('이 채널에서는 조회할 수 없습니다.');
|
|
94
|
+
return this.helper.getMessage(this, logId);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 여러 로그 ID로 메세지를 한꺼번에 조회합니다.
|
|
98
|
+
*
|
|
99
|
+
* @param logIds 메세지 로그 ID 목록
|
|
100
|
+
* @throws 클라이언트와 연결되지 않은 채팅방 객체에서 호출할 때
|
|
101
|
+
*/
|
|
102
|
+
getChats(logIds) {
|
|
103
|
+
if (this.helper === undefined)
|
|
104
|
+
throw new Error('이 채널에서는 조회할 수 없습니다.');
|
|
105
|
+
return this.helper.getMessages(this, logIds);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 최근 메세지를 조회합니다. 메세지가 없으면 빈 배열을 돌려줍니다.
|
|
109
|
+
*
|
|
110
|
+
* @param count 조회할 메세지 수. 소수점 아래는 버립니다.
|
|
111
|
+
* @throws `count`가 유한한 수가 아니거나 소수점 아래를 버린 값이 1보다 작을 때
|
|
112
|
+
*/
|
|
113
|
+
async getRecentChats(count = 1) {
|
|
114
|
+
if (!Number.isFinite(count))
|
|
115
|
+
throw new Error('count가 올바르지 않습니다.');
|
|
116
|
+
const limit = Math.floor(count);
|
|
117
|
+
if (limit < 1)
|
|
118
|
+
throw new Error('count는 1 이상이어야 합니다.');
|
|
119
|
+
const logIds = await this.store.getRecentLogIds(this.id, limit);
|
|
120
|
+
if (logIds.length === 0)
|
|
121
|
+
return [];
|
|
122
|
+
return this.getChats(logIds);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 기간 안에 유저마다 보낸 채팅 수를 셉니다. 조회되지 않은 유저는 결과에서 빠집니다.
|
|
126
|
+
*
|
|
127
|
+
* @param options 집계 기간과 피드 포함 여부. 생략하면 처음부터 지금까지 피드 없이 셉니다.
|
|
128
|
+
* @throws 날짜가 올바르지 않거나 `startDate`가 `endDate`보다 늦을 때
|
|
129
|
+
*/
|
|
130
|
+
async getChatCountsByUser(options = {}) {
|
|
131
|
+
const startDate = options.startDate?.getTime() ?? 0;
|
|
132
|
+
const endDate = options.endDate?.getTime() ?? Date.now();
|
|
133
|
+
if (!Number.isFinite(startDate)) {
|
|
134
|
+
throw new Error('startDate가 올바르지 않습니다.');
|
|
135
|
+
}
|
|
136
|
+
if (!Number.isFinite(endDate)) {
|
|
137
|
+
throw new Error('endDate가 올바르지 않습니다.');
|
|
138
|
+
}
|
|
139
|
+
if (startDate > endDate) {
|
|
140
|
+
throw new Error('startDate는 endDate보다 늦을 수 없습니다.');
|
|
141
|
+
}
|
|
142
|
+
const counts = await this.store.getMessageCounts(this.id, Math.floor(startDate / 1000), Math.ceil(endDate / 1000), options.includeFeed === true);
|
|
143
|
+
const users = await this.loadUsers(counts.map((item) => item.id));
|
|
144
|
+
const usersById = new Map(users.map((user) => [user.id, user]));
|
|
145
|
+
const result = [];
|
|
146
|
+
for (const item of counts) {
|
|
147
|
+
const user = usersById.get(item.id);
|
|
148
|
+
if (user !== undefined)
|
|
149
|
+
result.push({ user, count: item.count });
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
/** 지금 채팅방에 있는 멤버 ID 목록 */
|
|
154
|
+
get memberIds() {
|
|
155
|
+
return this.loadMemberIds();
|
|
156
|
+
}
|
|
157
|
+
/** 지금 채팅방에 있는 멤버 목록 */
|
|
158
|
+
get members() {
|
|
159
|
+
return this.loadMembers();
|
|
160
|
+
}
|
|
161
|
+
/** 방장. 방장이 없는 채팅방이거나 찾지 못하면 `null` */
|
|
162
|
+
get host() {
|
|
163
|
+
return this.loadHost();
|
|
164
|
+
}
|
|
165
|
+
/** 부방장 목록. 부방장이 없는 채팅방이면 빈 배열 */
|
|
166
|
+
get moderators() {
|
|
167
|
+
return this.loadModerators();
|
|
168
|
+
}
|
|
169
|
+
/** 채팅방에 추가된 챗봇 목록 */
|
|
170
|
+
get botUsers() {
|
|
171
|
+
return this.loadBotUsers();
|
|
172
|
+
}
|
|
173
|
+
/** 일반 채팅방 여부 */
|
|
174
|
+
isNormalChannel() {
|
|
175
|
+
return (this.isMemoChannel() ||
|
|
176
|
+
this.isDirectChannel() ||
|
|
177
|
+
this.isMultiChannel() ||
|
|
178
|
+
this.isTeamMultiChannel() ||
|
|
179
|
+
this.isPlusChannel());
|
|
180
|
+
}
|
|
181
|
+
/** 나와의 채팅(`MemoChat`) 여부 */
|
|
182
|
+
isMemoChannel() {
|
|
183
|
+
return this.type === 'MemoChat';
|
|
184
|
+
}
|
|
185
|
+
/** 일반 1:1 채팅(`DirectChat`) 여부 */
|
|
186
|
+
isDirectChannel() {
|
|
187
|
+
return this.type === 'DirectChat';
|
|
188
|
+
}
|
|
189
|
+
/** 일반 그룹 채팅(`MultiChat`) 여부 */
|
|
190
|
+
isMultiChannel() {
|
|
191
|
+
return this.type === 'MultiChat';
|
|
192
|
+
}
|
|
193
|
+
/** 팀채팅(`TeamMultiChat`) 여부 */
|
|
194
|
+
isTeamMultiChannel() {
|
|
195
|
+
return this.type === 'TeamMultiChat';
|
|
196
|
+
}
|
|
197
|
+
/** 카카오톡 채널(`PlusChat`) 여부 */
|
|
198
|
+
isPlusChannel() {
|
|
199
|
+
return this.type === 'PlusChat';
|
|
200
|
+
}
|
|
201
|
+
/** 오픈채팅방 여부 */
|
|
202
|
+
isOpenChannel() {
|
|
203
|
+
return this.isOpenDirectChannel() || this.isOpenMultiChannel() || this.isCommunityOpenMultiChannel();
|
|
204
|
+
}
|
|
205
|
+
/** 1:1 오픈채팅(`OD`) 여부 */
|
|
206
|
+
isOpenDirectChannel() {
|
|
207
|
+
return this.type === 'OD';
|
|
208
|
+
}
|
|
209
|
+
/** 그룹 오픈채팅(`OM`) 여부 */
|
|
210
|
+
isOpenMultiChannel() {
|
|
211
|
+
return this.type === 'OM';
|
|
212
|
+
}
|
|
213
|
+
/** 커뮤니티 오픈 그룹 채팅(`COM`) 여부 */
|
|
214
|
+
isCommunityOpenMultiChannel() {
|
|
215
|
+
return this.type === 'COM';
|
|
216
|
+
}
|
|
217
|
+
async loadMemberIds() {
|
|
218
|
+
const members = await this.grpc.getChannelMembers(this.id);
|
|
219
|
+
return members.activeMemberIds;
|
|
220
|
+
}
|
|
221
|
+
loadUsers(userIds) {
|
|
222
|
+
if (this.helper === undefined)
|
|
223
|
+
throw new Error('이 채널에서는 조회할 수 없습니다.');
|
|
224
|
+
return this.helper.getUsers(this, userIds);
|
|
225
|
+
}
|
|
226
|
+
async loadMembers() {
|
|
227
|
+
return this.loadUsers(await this.loadMemberIds());
|
|
228
|
+
}
|
|
229
|
+
async loadHost() {
|
|
230
|
+
if (this.isTeamMultiChannel()) {
|
|
231
|
+
const hostId = await this.store.getTeamHostId(this.id);
|
|
232
|
+
if (hostId === null)
|
|
233
|
+
return null;
|
|
234
|
+
return (await this.loadUsers([hostId]))[0] ?? null;
|
|
235
|
+
}
|
|
236
|
+
if (!this.isOpenChannel())
|
|
237
|
+
return null;
|
|
238
|
+
const users = await this.loadMembers();
|
|
239
|
+
return users.find((user) => user.isHost()) ?? null;
|
|
240
|
+
}
|
|
241
|
+
async loadModerators() {
|
|
242
|
+
if (this.isTeamMultiChannel()) {
|
|
243
|
+
const moderatorIds = await this.store.getTeamModeratorIds(this.id);
|
|
244
|
+
return this.loadUsers(moderatorIds);
|
|
245
|
+
}
|
|
246
|
+
if (!this.isOpenChannel())
|
|
247
|
+
return [];
|
|
248
|
+
const users = await this.loadMembers();
|
|
249
|
+
return users.filter((user) => user.isModerator());
|
|
250
|
+
}
|
|
251
|
+
async loadBotUsers() {
|
|
252
|
+
const store = this.store;
|
|
253
|
+
const grpc = this.grpc;
|
|
254
|
+
if (!this.isNormalChannel() && !this.isOpenChannel())
|
|
255
|
+
return [];
|
|
256
|
+
const botIds = await store.getBotIds(this.id);
|
|
257
|
+
if (botIds.length === 0)
|
|
258
|
+
return [];
|
|
259
|
+
if (this.isNormalChannel()) {
|
|
260
|
+
const bots = await store.getBotRows(botIds);
|
|
261
|
+
const users = [];
|
|
262
|
+
for (const botId of botIds) {
|
|
263
|
+
const bot = bots.find((item) => item.id === botId);
|
|
264
|
+
if (bot !== undefined)
|
|
265
|
+
users.push(new BotUser(botId, bot.name, bot.profileImageUrl));
|
|
266
|
+
}
|
|
267
|
+
return users;
|
|
268
|
+
}
|
|
269
|
+
const members = await grpc.getUsers(this.id, botIds);
|
|
270
|
+
const users = [];
|
|
271
|
+
for (const botId of botIds) {
|
|
272
|
+
const member = members.find((item) => item.id === botId);
|
|
273
|
+
if (member !== undefined) {
|
|
274
|
+
users.push(new BotUser(member.id, member.nickname, member.profileImageUrl ?? null));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return users;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=channel.js.map
|