@geoly-ai/social-hub-sdk 0.1.19 → 0.1.21

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.js CHANGED
@@ -1,3 +1,7 @@
1
+ // 派单品牌映射 / 接单团队(B4)的类型。
2
+ export * from "./intake-admin.js";
3
+ // 派单运营面(B5-ext E3)的类型。
4
+ export * from "./intake-ops.js";
1
5
  // 板块限制(阶段 A4)的类型与受限拦截识别 helper(getSubredditRestrictionBlock)。
2
6
  export * from "./subreddit-restrictions.js";
3
7
  /** 自动翻页的页大小 —— contracts `listSubredditBlocklistsQuerySchema.limit` 的硬上限。 */
@@ -3188,9 +3192,10 @@ export class SocialHubClient {
3188
3192
  /**
3189
3193
  * POST :id/weekly-stats/refresh — 手动刷新该板块的页面周指标(202 入队)。
3190
3194
  *
3191
- * 每板块每业务日最多真实抓一次:当日已抓/已入队 → 409,`error.details.code` 为
3192
- * `refresh_already_charged_today`,`details.nextAllowedAt` 是下一业务日起点;
3193
- * 其余稳定码见 contracts `WEEKLY_STATS_REFRESH_REJECT_CODES`。
3195
+ * 每板块每业务日最多手动真实抓 2 次(与每日补跑的 1 次互不占用,合计 3 次):
3196
+ * 该板块已有抓取在排队/运行 → 409 `refresh_already_charged_today`;当日 2 次手动用完 →
3197
+ * 409 `manual_refresh_limit_reached`(`details.dailyLimit`=2);两者的 `details.nextAllowedAt`
3198
+ * 都是下一业务日起点;其余稳定码见 contracts `WEEKLY_STATS_REFRESH_REJECT_CODES`。
3194
3199
  * 仅 active 资产;写权限同其它写端点(真实登录 admin,拒 API Key)。
3195
3200
  */
3196
3201
  async refreshOwnedSubredditWeeklyStats(ownedSubredditId) {
@@ -3614,6 +3619,101 @@ export class SocialHubClient {
3614
3619
  async patchRedditAccountVerificationEvidence(teamId, evidenceId, body) {
3615
3620
  return this.fetchJson(`${this.teamBase(teamId)}/reddit-verification/evidence/${evidenceId}`, { method: "PATCH", body: JSON.stringify(body) });
3616
3621
  }
3622
+ // ── 派单品牌映射与接单团队(B4)──────────────────────────────────────────
3623
+ // 系统级(不拼 /teams),仅不受限登录的 admin。映射补齐后订单会自动标记为「品牌已解析」,
3624
+ // 接单(accepted)在后续版本上线。
3625
+ /** GET /v1/system/intake-admin/brand-mappings — 列表(status / mapped=mapped|pending / 分页)。 */
3626
+ async listIntakeBrandMappings(params = {}) {
3627
+ const q = buildQuery({
3628
+ status: params.status,
3629
+ mapped: params.mapped,
3630
+ limit: params.limit,
3631
+ offset: params.offset,
3632
+ });
3633
+ return this.fetchJson(`/v1/system/intake-admin/brand-mappings${q}`);
3634
+ }
3635
+ /** GET /v1/system/intake-admin/brand-mappings/:id */
3636
+ async getIntakeBrandMapping(id) {
3637
+ return this.fetchJson(`/v1/system/intake-admin/brand-mappings/${encodeURIComponent(id)}`);
3638
+ }
3639
+ /** PATCH /v1/system/intake-admin/brand-mappings/:id — `rowVersion` 必填(409 = 版本过期,重新 get)。 */
3640
+ async updateIntakeBrandMapping(id, body) {
3641
+ return this.fetchJson(`/v1/system/intake-admin/brand-mappings/${encodeURIComponent(id)}`, { method: "PATCH", body: JSON.stringify(body) });
3642
+ }
3643
+ /** GET /v1/system/intake-admin/order-team */
3644
+ async getIntakeOrderTeam() {
3645
+ return this.fetchJson(`/v1/system/intake-admin/order-team`);
3646
+ }
3647
+ /** PUT /v1/system/intake-admin/order-team — 设置接单团队(团队须存在;最后写入者覆盖,留审计)。 */
3648
+ async setIntakeOrderTeam(teamId) {
3649
+ return this.fetchJson(`/v1/system/intake-admin/order-team`, {
3650
+ method: "PUT",
3651
+ body: JSON.stringify({ teamId }),
3652
+ });
3653
+ }
3654
+ // ── 派单运营面(B5-ext E3)──────────────────────────────────────────────
3655
+ // 系统级(不拼 /teams)。准入:admin,或全局 manager 且是接单团队的真实 active 成员;
3656
+ // API key / 服务凭据 / 受限 CLI token 全 403。订单标识 hubRef;写入口 rowVersion 乐观锁(409 = 过期,重新 get)。
3657
+ // schedule / re-review / start 受执行开关 INTAKE_OPS_EXECUTION_ENABLED 闸(默认关 → 503)。
3658
+ /** GET /v1/system/intake-ops/orders — 列表(status / kind / deliveryChannel / brandId / 分页)。 */
3659
+ async listIntakeOpsOrders(params = {}) {
3660
+ const q = buildQuery({
3661
+ status: params.status,
3662
+ kind: params.kind,
3663
+ deliveryChannel: params.deliveryChannel,
3664
+ brandId: params.brandId,
3665
+ limit: params.limit,
3666
+ offset: params.offset,
3667
+ });
3668
+ return this.fetchJson(`/v1/system/intake-ops/orders${q}`);
3669
+ }
3670
+ /** GET /v1/system/intake-ops/orders/:hubRef — 详情(含 rowVersion / checks / allowedActions)。 */
3671
+ async getIntakeOpsOrder(hubRef) {
3672
+ return this.fetchJson(`/v1/system/intake-ops/orders/${encodeURIComponent(hubRef)}`);
3673
+ }
3674
+ /** POST …/orders/:hubRef/thread-context — 人工粘贴线程语境(递增订单 rowVersion)。 */
3675
+ async provideIntakeThreadContext(hubRef, body) {
3676
+ return this.intakeOpsWrite(hubRef, "thread-context", "POST", body);
3677
+ }
3678
+ /** POST …/orders/:hubRef/accept */
3679
+ async acceptIntakeOrder(hubRef, body) {
3680
+ return this.intakeOpsWrite(hubRef, "accept", "POST", body);
3681
+ }
3682
+ /** POST …/orders/:hubRef/reject */
3683
+ async rejectIntakeOrder(hubRef, body) {
3684
+ return this.intakeOpsWrite(hubRef, "reject", "POST", body);
3685
+ }
3686
+ /** PUT …/orders/:hubRef/draft — 改稿(新内容版本,旧审核失效,须重审)。 */
3687
+ async editIntakeOrderDraft(hubRef, body) {
3688
+ return this.intakeOpsWrite(hubRef, "draft", "PUT", body);
3689
+ }
3690
+ /** POST …/orders/:hubRef/schedule — 排期并建审核目标(受执行开关闸)。 */
3691
+ async scheduleIntakeOrder(hubRef, body) {
3692
+ return this.intakeOpsWrite(hubRef, "schedule", "POST", body);
3693
+ }
3694
+ /** POST …/orders/:hubRef/re-review — 重新审核(受执行开关闸)。 */
3695
+ async reReviewIntakeOrder(hubRef, body) {
3696
+ return this.intakeOpsWrite(hubRef, "re-review", "POST", body);
3697
+ }
3698
+ /** POST …/orders/:hubRef/start — 标记开始执行(可选步骤;受执行开关闸)。 */
3699
+ async startIntakeOrder(hubRef, body) {
3700
+ return this.intakeOpsWrite(hubRef, "start", "POST", body);
3701
+ }
3702
+ /** POST …/orders/:hubRef/confirm-published — 回填已发布(需当前审核 passed + 内容身份一致)。 */
3703
+ async confirmIntakeOrderPublished(hubRef, body) {
3704
+ return this.intakeOpsWrite(hubRef, "confirm-published", "POST", body);
3705
+ }
3706
+ /** POST …/orders/:hubRef/fail — 置失败(须声明帖子不在 Reddit 上)。 */
3707
+ async failIntakeOrder(hubRef, body) {
3708
+ return this.intakeOpsWrite(hubRef, "fail", "POST", body);
3709
+ }
3710
+ /** POST …/orders/:hubRef/anomalies — 异常事实登记(不改订单状态、不产生 published 事件);rowVersion 可选。 */
3711
+ async registerIntakeOrderAnomaly(hubRef, body) {
3712
+ return this.intakeOpsWrite(hubRef, "anomalies", "POST", body);
3713
+ }
3714
+ intakeOpsWrite(hubRef, action, method, body) {
3715
+ return this.fetchJson(`/v1/system/intake-ops/orders/${encodeURIComponent(hubRef)}/${action}`, { method, body: JSON.stringify(body) });
3716
+ }
3617
3717
  // ── 板块限制(板块限制阶段 A4)──────────────────────────────────────────
3618
3718
  // 系统级管理面仅**不受限登录的 admin**(API key / 绑定 job·account / 带动作白名单的
3619
3719
  // CLI token 读写全 403);runner 自查用 team 级 checkSubredditRestriction。