feat: harden loose-offline sync for user JWT, schema, and console ops
Enable Binding-scoped agent push/pull, empty-table schema ensure, SyncPage inspect/drop-table, default module import, and agent-bound publish docs from the 宇恒联调意见. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -360,15 +360,39 @@ paths:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses: { "200": { description: OK } }
|
||||
/api/v1/admin/sync/channels/{id}/inspect:
|
||||
get:
|
||||
operationId: inspectSyncChannel
|
||||
summary: 列出通道线上/本机库表(验同步)
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses: { "200": { description: OK } }
|
||||
/api/v1/admin/sync/channels/{id}/preview:
|
||||
post:
|
||||
operationId: previewSyncTable
|
||||
summary: 预览单表行
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses: { "200": { description: OK } }
|
||||
/api/v1/admin/sync/channels/{id}/drop-table:
|
||||
post:
|
||||
operationId: dropSyncTable
|
||||
summary: 删除线上/本机业务表(仅当前 side,不同步 DDL)
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses: { "200": { description: OK } }
|
||||
/api/v1/admin/sync/bindings:
|
||||
get:
|
||||
operationId: listSyncBindings
|
||||
summary: 列出本机库↔线上库绑定
|
||||
summary: 列出本机库↔线上库绑定(管理员全量;用户仅本人)
|
||||
parameters: [{ $ref: "#/components/parameters/Authorization" }]
|
||||
responses: { "200": { description: OK } }
|
||||
post:
|
||||
operationId: ensureSyncBinding
|
||||
summary: 登记/更新绑定
|
||||
summary: 登记/更新绑定(登录用户可自助;强制本人 user_id)
|
||||
parameters: [{ $ref: "#/components/parameters/Authorization" }]
|
||||
responses: { "200": { description: OK } }
|
||||
/api/v1/admin/sync/conflicts:
|
||||
@@ -380,7 +404,7 @@ paths:
|
||||
/api/v1/agent/sync/channels/{id}/whitelist:
|
||||
get:
|
||||
operationId: agentSyncWhitelist
|
||||
summary: 本机 agent 拉取表白名单
|
||||
summary: 拉取表白名单(「数据同步」或登录用户+本人 Binding)
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
@@ -388,11 +412,42 @@ paths:
|
||||
/api/v1/agent/sync/channels/{id}/push:
|
||||
post:
|
||||
operationId: agentSyncPush
|
||||
summary: 本机 agent 推变更到线上 A
|
||||
summary: 推变更到线上 A(用户自助须带本人 online_db_id)
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses: { "200": { description: OK } }
|
||||
responses:
|
||||
"200":
|
||||
description: OK(含 applied / skipped 幂等)
|
||||
content:
|
||||
application/json:
|
||||
examples:
|
||||
applied:
|
||||
value:
|
||||
success: true
|
||||
result:
|
||||
ok: true
|
||||
applied: true
|
||||
skipped: false
|
||||
applied_version: 1710000000000000000
|
||||
message: applied
|
||||
skipped:
|
||||
value:
|
||||
success: true
|
||||
result:
|
||||
ok: true
|
||||
applied: false
|
||||
skipped: true
|
||||
applied_version: 1710000000000000000
|
||||
message: already applied (same version)
|
||||
"503":
|
||||
description: remote 暂不可达,可重试
|
||||
content:
|
||||
application/json:
|
||||
example:
|
||||
code: 503
|
||||
message: "open remote: ..."
|
||||
retryable: true
|
||||
/api/v1/agent/sync/channels/{id}/push/batch:
|
||||
post:
|
||||
operationId: agentSyncPushBatch
|
||||
@@ -400,7 +455,67 @@ paths:
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses: { "200": { description: OK } }
|
||||
responses:
|
||||
"200": { description: OK }
|
||||
"503": { description: remote 暂不可达,retryable }
|
||||
/api/v1/agent/sync/channels/{id}/pull:
|
||||
post:
|
||||
operationId: agentSyncPull
|
||||
summary: 从线上 A 下行(bootstrap / rows / pks);用户自助须 online_db_id
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
example:
|
||||
success: true
|
||||
result:
|
||||
ok: true
|
||||
mode: bootstrap
|
||||
table: orders
|
||||
pk_column: id
|
||||
items:
|
||||
- table: orders
|
||||
op: upsert
|
||||
row_pk: aaaa-bbbb
|
||||
row: { id: aaaa-bbbb, title: x }
|
||||
version: 1710000000000000000
|
||||
next_after_pk: aaaa-bbbb
|
||||
has_more: true
|
||||
"503": { description: remote 暂不可达,retryable }
|
||||
/api/v1/agent/sync/channels/{id}/bootstrap:
|
||||
post:
|
||||
operationId: agentSyncBootstrap
|
||||
summary: 全量灌库(等同 pull + mode=bootstrap)
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses:
|
||||
"200": { description: OK }
|
||||
"503": { description: remote 暂不可达,retryable }
|
||||
/api/v1/agent/sync/channels/{id}/schema:
|
||||
post:
|
||||
operationId: agentSyncSchemaDescribe
|
||||
summary: 拉取线上 A 表结构(含空表);本机按 columns CREATE IF NOT EXISTS
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses:
|
||||
"200": { description: OK }
|
||||
"503": { description: remote 暂不可达,retryable }
|
||||
/api/v1/agent/sync/channels/{id}/schema/ensure:
|
||||
post:
|
||||
operationId: agentSyncSchemaEnsure
|
||||
summary: 本机空表结构推到线上 A(CREATE IF NOT EXISTS,无需 outbox 行)
|
||||
parameters:
|
||||
- { $ref: "#/components/parameters/Authorization" }
|
||||
- { $ref: "#/components/parameters/Id" }
|
||||
responses:
|
||||
"200": { description: OK }
|
||||
"503": { description: remote 暂不可达,retryable }
|
||||
/api/v1/platform/dbsync/lww-overrides:
|
||||
get:
|
||||
operationId: platformLwwOverrides
|
||||
|
||||
Reference in New Issue
Block a user