@geoly-ai/social-hub-sdk 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +183 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +13 -0
- package/dist/index.test.js.map +1 -1
- package/dist/public-reddit.test.d.ts +2 -0
- package/dist/public-reddit.test.d.ts.map +1 -0
- package/dist/public-reddit.test.js +132 -0
- package/dist/public-reddit.test.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -198,6 +198,8 @@ export type ListRedditPostSnapshotsParams = {
|
|
|
198
198
|
draftStatus?: string;
|
|
199
199
|
postType?: string;
|
|
200
200
|
repostType?: string;
|
|
201
|
+
/** 账号类型:`internal` / `external`,可逗号分隔;proxy / 海外兼职 / 未知 / 空值在选了任一项时不命中。 */
|
|
202
|
+
accountType?: string;
|
|
201
203
|
containsBrandKeyword?: "true" | "false" | "unset";
|
|
202
204
|
primaryProduct?: string;
|
|
203
205
|
/**
|
|
@@ -223,6 +225,8 @@ export type RedditPostSnapshotStatsParams = {
|
|
|
223
225
|
draftStatus?: string;
|
|
224
226
|
postType?: string;
|
|
225
227
|
repostType?: string;
|
|
228
|
+
/** 账号类型:`internal` / `external`,可逗号分隔;proxy / 海外兼职 / 未知 / 空值在选了任一项时不命中。 */
|
|
229
|
+
accountType?: string;
|
|
226
230
|
containsBrandKeyword?: "true" | "false" | "unset";
|
|
227
231
|
primaryProduct?: string;
|
|
228
232
|
/** 序列号闭区间(与列表同口径)。 */
|
|
@@ -1208,6 +1212,170 @@ export type UpdateSubredditMonitorConfigBody = {
|
|
|
1208
1212
|
*/
|
|
1209
1213
|
fetchLimit: number;
|
|
1210
1214
|
};
|
|
1215
|
+
/** 公开库端点前缀(供应商无关)。 */
|
|
1216
|
+
export declare const PUBLIC_REDDIT_BASE_PATH = "/v1/system/public-reddit";
|
|
1217
|
+
export declare const PUBLIC_REDDIT_PATHS: {
|
|
1218
|
+
readonly communities: "/v1/system/public-reddit/communities";
|
|
1219
|
+
readonly posts: "/v1/system/public-reddit/posts";
|
|
1220
|
+
readonly postCounts: "/v1/system/public-reddit/post-counts";
|
|
1221
|
+
readonly status: "/v1/system/public-reddit/status";
|
|
1222
|
+
};
|
|
1223
|
+
/**
|
|
1224
|
+
* 公开库错误码(服务端 `error.code`)。🔴 `DISABLED` / `POLICY_DENIED` / `AUTH_FAILED` 等
|
|
1225
|
+
* 都是「读不到」而**不是**「没有数据」,调用方绝不能把它们当成空结果。
|
|
1226
|
+
*/
|
|
1227
|
+
export declare const PUBLIC_REDDIT_ERROR_CODES: {
|
|
1228
|
+
readonly DISABLED: "PUBLIC_REDDIT_DISABLED";
|
|
1229
|
+
readonly BUDGET_EXHAUSTED: "PUBLIC_REDDIT_BUDGET_EXHAUSTED";
|
|
1230
|
+
readonly DEGRADED: "PUBLIC_REDDIT_DEGRADED";
|
|
1231
|
+
readonly COUNT_TIMEOUT: "PUBLIC_REDDIT_COUNT_TIMEOUT";
|
|
1232
|
+
readonly RATE_LIMITED: "PUBLIC_REDDIT_RATE_LIMITED";
|
|
1233
|
+
readonly AUTH_FAILED: "PUBLIC_REDDIT_AUTH_FAILED";
|
|
1234
|
+
readonly POLICY_DENIED: "PUBLIC_REDDIT_POLICY_DENIED";
|
|
1235
|
+
readonly COMMUNITY_NOT_AVAILABLE: "PUBLIC_REDDIT_COMMUNITY_NOT_AVAILABLE";
|
|
1236
|
+
readonly SCOPE_TOO_LARGE: "PUBLIC_REDDIT_SCOPE_TOO_LARGE";
|
|
1237
|
+
readonly QUERY_REQUIRED: "PUBLIC_REDDIT_QUERY_REQUIRED";
|
|
1238
|
+
readonly INVALID_REQUEST: "PUBLIC_REDDIT_INVALID_REQUEST";
|
|
1239
|
+
readonly INVALID_WINDOW: "PUBLIC_REDDIT_INVALID_WINDOW";
|
|
1240
|
+
readonly INVALID_COMMUNITY: "PUBLIC_REDDIT_INVALID_COMMUNITY";
|
|
1241
|
+
readonly CURSOR_MISMATCH: "PUBLIC_REDDIT_CURSOR_MISMATCH";
|
|
1242
|
+
readonly CURSOR_RESET: "PUBLIC_REDDIT_CURSOR_RESET";
|
|
1243
|
+
readonly UNAVAILABLE: "PUBLIC_REDDIT_UNAVAILABLE";
|
|
1244
|
+
readonly BAD_UPSTREAM_RESPONSE: "PUBLIC_REDDIT_BAD_UPSTREAM_RESPONSE";
|
|
1245
|
+
};
|
|
1246
|
+
export type PublicRedditNamedWindow = "day" | "week" | "month" | "last_90d" | "last_360d" | "last_full_week";
|
|
1247
|
+
/** 窗口:命名窗口与显式 [from,to) 二选一(服务端校验互斥)。 */
|
|
1248
|
+
export type PublicRedditWindowParams = {
|
|
1249
|
+
window?: PublicRedditNamedWindow;
|
|
1250
|
+
from?: string;
|
|
1251
|
+
to?: string;
|
|
1252
|
+
};
|
|
1253
|
+
export type ListPublicRedditCommunitiesParams = {
|
|
1254
|
+
/** 数组按逗号拼接(与服务端 csv 形状一致)。 */
|
|
1255
|
+
industryKey?: string | string[];
|
|
1256
|
+
tierKey?: string | string[];
|
|
1257
|
+
poolKind?: string | string[];
|
|
1258
|
+
hasProfile?: boolean;
|
|
1259
|
+
limit?: number;
|
|
1260
|
+
/** Hub 令牌:原样回传上一页的 nextCursor。 */
|
|
1261
|
+
cursor?: string;
|
|
1262
|
+
};
|
|
1263
|
+
export type SearchPublicRedditPostsParams = PublicRedditWindowParams & {
|
|
1264
|
+
/** 必填、≤20 个;数组按逗号拼接。 */
|
|
1265
|
+
subreddit: string | string[];
|
|
1266
|
+
/** ⚠️ 会发往外部数据服务。 */
|
|
1267
|
+
query?: string;
|
|
1268
|
+
sort?: "created_at_desc";
|
|
1269
|
+
limit?: number;
|
|
1270
|
+
cursor?: string;
|
|
1271
|
+
includeBody?: boolean;
|
|
1272
|
+
};
|
|
1273
|
+
export type CountPublicRedditPostsBody = PublicRedditWindowParams & {
|
|
1274
|
+
subreddits: string[];
|
|
1275
|
+
/** 必填;⚠️ 会发往外部数据服务。 */
|
|
1276
|
+
query: string;
|
|
1277
|
+
artifactType?: "post" | "comment";
|
|
1278
|
+
};
|
|
1279
|
+
export type PublicRedditSourceMeta = {
|
|
1280
|
+
provider: "cyberredd";
|
|
1281
|
+
mode: "off" | "shadow" | "on";
|
|
1282
|
+
dataCutoff: string | null;
|
|
1283
|
+
resolvedWindow: {
|
|
1284
|
+
from: string;
|
|
1285
|
+
to: string;
|
|
1286
|
+
name: string | null;
|
|
1287
|
+
} | null;
|
|
1288
|
+
fetchedAt: string;
|
|
1289
|
+
cached: boolean;
|
|
1290
|
+
excludedCommunities: Array<{
|
|
1291
|
+
communityId: string;
|
|
1292
|
+
reason: string;
|
|
1293
|
+
}>;
|
|
1294
|
+
warnings: Array<{
|
|
1295
|
+
code: string;
|
|
1296
|
+
message?: string;
|
|
1297
|
+
}>;
|
|
1298
|
+
};
|
|
1299
|
+
export type PublicRedditCommunity = {
|
|
1300
|
+
communityId: string;
|
|
1301
|
+
name: string | null;
|
|
1302
|
+
url: string | null;
|
|
1303
|
+
industryKeys: string[] | null;
|
|
1304
|
+
tierKey: string | null;
|
|
1305
|
+
poolKind: string | null;
|
|
1306
|
+
hasProfile: boolean | null;
|
|
1307
|
+
dataCutoff: string | null;
|
|
1308
|
+
};
|
|
1309
|
+
export type PublicRedditPost = {
|
|
1310
|
+
upstreamId: string;
|
|
1311
|
+
redditPostId: string | null;
|
|
1312
|
+
communityId: string;
|
|
1313
|
+
title: string | null;
|
|
1314
|
+
bodyExcerpt: string | null;
|
|
1315
|
+
body?: string | null;
|
|
1316
|
+
authorName: string | null;
|
|
1317
|
+
createdAt: string | null;
|
|
1318
|
+
url: string | null;
|
|
1319
|
+
contentState: string | null;
|
|
1320
|
+
observationStatus: string | null;
|
|
1321
|
+
intent: string | null;
|
|
1322
|
+
sentiment: string | null;
|
|
1323
|
+
labelVocabulary: "cyberredd_v1";
|
|
1324
|
+
};
|
|
1325
|
+
export type ListPublicRedditCommunitiesResponse = {
|
|
1326
|
+
items: PublicRedditCommunity[];
|
|
1327
|
+
nextCursor: string | null;
|
|
1328
|
+
source: PublicRedditSourceMeta;
|
|
1329
|
+
};
|
|
1330
|
+
export type SearchPublicRedditPostsResponse = {
|
|
1331
|
+
items: PublicRedditPost[];
|
|
1332
|
+
nextCursor: string | null;
|
|
1333
|
+
source: PublicRedditSourceMeta;
|
|
1334
|
+
};
|
|
1335
|
+
export type CountPublicRedditPostsResponse = {
|
|
1336
|
+
artifactType: "post" | "comment";
|
|
1337
|
+
window: {
|
|
1338
|
+
from: string;
|
|
1339
|
+
to: string;
|
|
1340
|
+
name: string | null;
|
|
1341
|
+
};
|
|
1342
|
+
exact: boolean;
|
|
1343
|
+
/** exact=false 时为 null,绝不是部分和。 */
|
|
1344
|
+
total: number | null;
|
|
1345
|
+
communities: Array<{
|
|
1346
|
+
communityId: string;
|
|
1347
|
+
status: string;
|
|
1348
|
+
count: number | null;
|
|
1349
|
+
dataCutoff: string | null;
|
|
1350
|
+
windowCovered: boolean | null;
|
|
1351
|
+
}>;
|
|
1352
|
+
source: PublicRedditSourceMeta;
|
|
1353
|
+
};
|
|
1354
|
+
export type PublicRedditStatus = {
|
|
1355
|
+
mode: "off" | "shadow" | "on";
|
|
1356
|
+
capabilities: Array<"catalog" | "post_search" | "post_count">;
|
|
1357
|
+
configured: boolean;
|
|
1358
|
+
keyFingerprint: string | null;
|
|
1359
|
+
keyExpiresAt: string | null;
|
|
1360
|
+
credential: Record<string, unknown>;
|
|
1361
|
+
breaker: {
|
|
1362
|
+
state: string;
|
|
1363
|
+
openedAt: string | null;
|
|
1364
|
+
};
|
|
1365
|
+
budget: {
|
|
1366
|
+
windowSeconds: number;
|
|
1367
|
+
limit: number;
|
|
1368
|
+
used: number;
|
|
1369
|
+
};
|
|
1370
|
+
catalogIndex: {
|
|
1371
|
+
size: number | null;
|
|
1372
|
+
refreshedAt: string | null;
|
|
1373
|
+
};
|
|
1374
|
+
lastError: {
|
|
1375
|
+
code: string;
|
|
1376
|
+
at: string;
|
|
1377
|
+
} | null;
|
|
1378
|
+
};
|
|
1211
1379
|
export type ListHotPostsParams = {
|
|
1212
1380
|
limit?: number;
|
|
1213
1381
|
offset?: number;
|
|
@@ -2732,6 +2900,9 @@ export declare class SocialHubClient {
|
|
|
2732
2900
|
items: unknown[];
|
|
2733
2901
|
total: number;
|
|
2734
2902
|
}>;
|
|
2903
|
+
/**
|
|
2904
|
+
* 评论样本列表。⚠️ 只含 Hub 内现有评论样本(非归档,约 5.7 万条);历史/归档评论已迁至 CyberRedd。
|
|
2905
|
+
*/
|
|
2735
2906
|
listRedditCommentSamples(params?: {
|
|
2736
2907
|
postId?: string;
|
|
2737
2908
|
subreddit?: string;
|
|
@@ -2761,6 +2932,7 @@ export declare class SocialHubClient {
|
|
|
2761
2932
|
* (totalRelation=unavailable)。
|
|
2762
2933
|
* ⚠️ 无过滤时是全表精确 count,属昂贵读——基线用途,**禁止轮询**。
|
|
2763
2934
|
* 口径是库内 reddit_comment_samples 行数,不是 Reddit 线程真实评论总数。
|
|
2935
|
+
* ⚠️ 只含 Hub 内现有评论样本(非归档,约 5.7 万条);历史/归档评论已迁至 CyberRedd。
|
|
2764
2936
|
*/
|
|
2765
2937
|
countRedditCommentSamples(params?: {
|
|
2766
2938
|
postId?: string;
|
|
@@ -3191,6 +3363,17 @@ export declare class SocialHubClient {
|
|
|
3191
3363
|
}>;
|
|
3192
3364
|
}>;
|
|
3193
3365
|
exportHotPostsCsv(params?: ListHotPostsParams): Promise<string>;
|
|
3366
|
+
/** GET /v1/system/public-reddit/communities — 公开库社区目录(只读;系统级,无 team 前缀)。 */
|
|
3367
|
+
listPublicRedditCommunities(params?: ListPublicRedditCommunitiesParams): Promise<ListPublicRedditCommunitiesResponse>;
|
|
3368
|
+
/** GET /v1/system/public-reddit/posts — 公开库帖子检索(必须带板块;query 会发往外部数据服务)。 */
|
|
3369
|
+
searchPublicRedditPosts(params: SearchPublicRedditPostsParams): Promise<SearchPublicRedditPostsResponse>;
|
|
3370
|
+
/**
|
|
3371
|
+
* POST /v1/system/public-reddit/post-counts — 公开库计数。
|
|
3372
|
+
* ⚠️ 昂贵读,禁止轮询;必须带 query;query 会发往外部数据服务。
|
|
3373
|
+
*/
|
|
3374
|
+
countPublicRedditPosts(body: CountPublicRedditPostsBody): Promise<CountPublicRedditPostsResponse>;
|
|
3375
|
+
/** GET /v1/system/public-reddit/status — 开关/熔断/预算(仅 unrestricted admin)。 */
|
|
3376
|
+
getPublicRedditStatus(): Promise<PublicRedditStatus>;
|
|
3194
3377
|
listKolIntents(params?: ListKolIntentsParams): Promise<{
|
|
3195
3378
|
items: unknown[];
|
|
3196
3379
|
total: number;
|