@geoly-ai/social-hub-sdk 0.1.6 → 0.1.8
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 +143 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +174 -0
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +128 -0
- package/dist/index.test.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1085,6 +1085,29 @@ export type SubredditCandidatesExhaustion = {
|
|
|
1085
1085
|
/** 各闸 raw 命中数,**允许重叠**,仅供排障 —— 不要用它选 reason。 */
|
|
1086
1086
|
filtered: Record<string, number>;
|
|
1087
1087
|
};
|
|
1088
|
+
export type SubredditPostAnnotationType = "style_fit" | "brand_friendliness";
|
|
1089
|
+
export type SubredditPostAnnotationSource = "llm" | "human";
|
|
1090
|
+
/** `subreddit-style-profiles` 的行视图;写操作要回传 `rowVersion` 作 If-Match。 */
|
|
1091
|
+
export type SubredditStyleProfileView = {
|
|
1092
|
+
id: string;
|
|
1093
|
+
status: "proposed" | "approved" | "retired";
|
|
1094
|
+
summary: string | null;
|
|
1095
|
+
proposedByUserId: string | null;
|
|
1096
|
+
/** If-Match 的值。状态每次合法迁移必变。 */
|
|
1097
|
+
rowVersion: string;
|
|
1098
|
+
[key: string]: unknown;
|
|
1099
|
+
};
|
|
1100
|
+
export type SubredditStyleProfileTransitionInput = {
|
|
1101
|
+
id: string;
|
|
1102
|
+
/** 来自 `getSubredditStyleProfile(id).profile.rowVersion`;**必传**,见方法说明。 */
|
|
1103
|
+
rowVersion: string;
|
|
1104
|
+
};
|
|
1105
|
+
/**
|
|
1106
|
+
* If-Match token 归一,**fail-closed**:只接受单个 strong token(可带成对引号)。
|
|
1107
|
+
* 拒 `W/` 弱 ETag、`*` 通配、多值(含逗号)、引号不成对 —— 非法形状本地即拒,
|
|
1108
|
+
* 不留给服务端猜。与 CLI 的 `normalizeRowVersionToken` 同一口径。
|
|
1109
|
+
*/
|
|
1110
|
+
export declare function normalizeStyleProfileRowVersion(raw: string | undefined): string | undefined;
|
|
1088
1111
|
export declare class RegistryProposalSdkError extends Error {
|
|
1089
1112
|
readonly status: number;
|
|
1090
1113
|
readonly code?: string;
|
|
@@ -2839,6 +2862,77 @@ export declare class SocialHubClient {
|
|
|
2839
2862
|
fallback?: unknown;
|
|
2840
2863
|
exhaustion?: SubredditCandidatesExhaustion;
|
|
2841
2864
|
}>;
|
|
2865
|
+
listSubredditPostAnnotations(teamId: string, params?: {
|
|
2866
|
+
subreddit?: string;
|
|
2867
|
+
permalink?: string;
|
|
2868
|
+
annotationType?: SubredditPostAnnotationType;
|
|
2869
|
+
brandId?: string;
|
|
2870
|
+
source?: SubredditPostAnnotationSource;
|
|
2871
|
+
limit?: number;
|
|
2872
|
+
offset?: number;
|
|
2873
|
+
}): Promise<{
|
|
2874
|
+
items: unknown[];
|
|
2875
|
+
total?: number;
|
|
2876
|
+
}>;
|
|
2877
|
+
upsertSubredditPostAnnotation(teamId: string, body: Record<string, unknown>): Promise<unknown>;
|
|
2878
|
+
listSubredditStyleProfiles(params?: {
|
|
2879
|
+
subreddit?: string;
|
|
2880
|
+
scope?: string;
|
|
2881
|
+
brandId?: string;
|
|
2882
|
+
/** 逗号分隔多值,如 `proposed,approved`。 */
|
|
2883
|
+
status?: string;
|
|
2884
|
+
limit?: number;
|
|
2885
|
+
offset?: number;
|
|
2886
|
+
}): Promise<{
|
|
2887
|
+
items: unknown[];
|
|
2888
|
+
total?: number;
|
|
2889
|
+
}>;
|
|
2890
|
+
/** 响应里的 `profile.rowVersion` 就是写操作要回传的 If-Match 值。 */
|
|
2891
|
+
getSubredditStyleProfile(id: string): Promise<{
|
|
2892
|
+
profile: SubredditStyleProfileView;
|
|
2893
|
+
}>;
|
|
2894
|
+
getActiveSubredditStyleProfile(params: {
|
|
2895
|
+
subreddit: string;
|
|
2896
|
+
scope?: string;
|
|
2897
|
+
brandId?: string;
|
|
2898
|
+
}): Promise<unknown>;
|
|
2899
|
+
proposeSubredditStyleProfile(body: Record<string, unknown>): Promise<{
|
|
2900
|
+
profile: SubredditStyleProfileView;
|
|
2901
|
+
}>;
|
|
2902
|
+
/** 四眼审批 `proposed → approved`。提案人本人不可批(服务端 409 SELF_APPROVE)。 */
|
|
2903
|
+
approveSubredditStyleProfile(input: SubredditStyleProfileTransitionInput): Promise<{
|
|
2904
|
+
profile: SubredditStyleProfileView;
|
|
2905
|
+
}>;
|
|
2906
|
+
/** 审批人驳回 `proposed → retired`(`retire_reason=rejected:<reason>`)。 */
|
|
2907
|
+
rejectSubredditStyleProfile(input: SubredditStyleProfileTransitionInput & {
|
|
2908
|
+
reason: string;
|
|
2909
|
+
}): Promise<{
|
|
2910
|
+
profile: SubredditStyleProfileView;
|
|
2911
|
+
}>;
|
|
2912
|
+
/** 提案人本人撤回。worker/LLM 提案(proposedByUserId=NULL)不可 cancel,请用 reject。 */
|
|
2913
|
+
cancelSubredditStyleProfile(input: SubredditStyleProfileTransitionInput & {
|
|
2914
|
+
reason: string;
|
|
2915
|
+
}): Promise<{
|
|
2916
|
+
profile: SubredditStyleProfileView;
|
|
2917
|
+
}>;
|
|
2918
|
+
/** 停用已生效画像 `approved → retired`。 */
|
|
2919
|
+
retireSubredditStyleProfile(input: SubredditStyleProfileTransitionInput & {
|
|
2920
|
+
reason: string;
|
|
2921
|
+
}): Promise<{
|
|
2922
|
+
profile: SubredditStyleProfileView;
|
|
2923
|
+
}>;
|
|
2924
|
+
/**
|
|
2925
|
+
* 四个 transition 的共同形状。
|
|
2926
|
+
*
|
|
2927
|
+
* 🔴 **`rowVersion` 是必传的,SDK 刻意不提供「缺省自动 GET 当前值」那种便利。**
|
|
2928
|
+
* CLI 有这个便利(交互式使用,人就在现场),但库里自动 GET 会让一个**本意保护
|
|
2929
|
+
* 特定版本**的写悄悄作用到最新版本 —— 乐观锁就此被架空,而且失败时毫无痕迹。
|
|
2930
|
+
* 调用方要先 `getSubredditStyleProfile` 拿 `profile.rowVersion` 再传进来。
|
|
2931
|
+
*
|
|
2932
|
+
* 🔴 **409 PROFILE_STALE 一律原样抛出,绝不自动重取重试。** 自动重试等于替用户
|
|
2933
|
+
* 认可了他没看过的那一版内容。
|
|
2934
|
+
*/
|
|
2935
|
+
private styleProfileTransition;
|
|
2842
2936
|
listSettings(): Promise<{
|
|
2843
2937
|
items: Array<{
|
|
2844
2938
|
key: string;
|
|
@@ -3709,6 +3803,55 @@ export declare class SocialHubClient {
|
|
|
3709
3803
|
updatedVersions: number;
|
|
3710
3804
|
autoDerivationEnabled: boolean;
|
|
3711
3805
|
}>;
|
|
3806
|
+
/** GET .../accounts/:accountId/reddit-verification — current + 最近 N 条 observation。 */
|
|
3807
|
+
getRedditAccountVerification(teamId: string, accountId: string, params?: {
|
|
3808
|
+
limit?: number;
|
|
3809
|
+
}): Promise<unknown>;
|
|
3810
|
+
/** GET .../reddit-verification/accounts — 列表 + coverage 计数。 */
|
|
3811
|
+
listRedditAccountVerificationAccounts(teamId: string, params?: {
|
|
3812
|
+
needsAttention?: boolean;
|
|
3813
|
+
limit?: number;
|
|
3814
|
+
offset?: number;
|
|
3815
|
+
}): Promise<unknown>;
|
|
3816
|
+
/**
|
|
3817
|
+
* POST .../accounts/:accountId/reddit-verification/observations — 幂等键
|
|
3818
|
+
* `requestId`;响应固定三态(201 recorded=true / 200 duplicate_delivery /
|
|
3819
|
+
* 409 两种专用冲突码,见 `SocialHubHttpError.code`)。
|
|
3820
|
+
*/
|
|
3821
|
+
recordRedditAccountVerificationObservation(teamId: string, accountId: string, body: {
|
|
3822
|
+
observedState: "verification_required" | "app_labeled" | "verified";
|
|
3823
|
+
observedAt: string;
|
|
3824
|
+
requestId: string;
|
|
3825
|
+
sourceEventType: string;
|
|
3826
|
+
deadlineRaw?: string | null;
|
|
3827
|
+
deadlineAt?: string | null;
|
|
3828
|
+
evidence: Array<{
|
|
3829
|
+
kind: "dom_snapshot" | "screenshot" | "agent_narrative";
|
|
3830
|
+
ref?: string | null;
|
|
3831
|
+
host?: string | null;
|
|
3832
|
+
capturedAt?: string | null;
|
|
3833
|
+
expiresAt?: string | null;
|
|
3834
|
+
}>;
|
|
3835
|
+
}): Promise<{
|
|
3836
|
+
observationId: string;
|
|
3837
|
+
recorded: boolean;
|
|
3838
|
+
advanced: boolean;
|
|
3839
|
+
state: "unknown" | "verification_required" | "app_labeled" | "verified";
|
|
3840
|
+
reason: "advanced" | "duplicate_delivery" | "out_of_order" | "same_instant_same_state";
|
|
3841
|
+
}>;
|
|
3842
|
+
/**
|
|
3843
|
+
* PATCH .../reddit-verification/evidence/:evidenceId — 只改 availability;
|
|
3844
|
+
* `checkedAt` 必填,较旧的检查覆盖较新的结果会被拒(409)。
|
|
3845
|
+
*/
|
|
3846
|
+
patchRedditAccountVerificationEvidence(teamId: string, evidenceId: string, body: {
|
|
3847
|
+
availability: "available" | "expired" | "missing" | "revoked";
|
|
3848
|
+
checkedAt: string;
|
|
3849
|
+
}): Promise<{
|
|
3850
|
+
ok: boolean;
|
|
3851
|
+
evidenceId: string;
|
|
3852
|
+
availability: string;
|
|
3853
|
+
availabilityCheckedAt: string;
|
|
3854
|
+
}>;
|
|
3712
3855
|
}
|
|
3713
3856
|
export type NotificationSubscriptionStatus = "active" | "paused"
|
|
3714
3857
|
/** 游标落后于保留 floor,已无法保证不漏;需人工确认后 reset。 */
|