Add plugin platform with modular backend and frontend registry.
Split graph/import/meta into Django apps, add API v1 with OpenAPI and pytest, and introduce plugin registry with the tags reference plugin on both FE and BE. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { listPendingChanges, ackChanges } from './changeLogRepository'
|
||||
import { getDataMode } from '../config/dataMode'
|
||||
import { getSyncContributors } from '../../core/pluginRegistry'
|
||||
import { noopSyncAdapter } from './noopSyncAdapter'
|
||||
|
||||
/**
|
||||
* Hybrid sync orchestrator: pushes core changelog + plugin contributors.
|
||||
*/
|
||||
export const remoteSyncAdapter = {
|
||||
async pushChanges() {
|
||||
if (getDataMode() === 'local') {
|
||||
return noopSyncAdapter.pushChanges()
|
||||
}
|
||||
|
||||
const pending = await listPendingChanges()
|
||||
let pushed = 0
|
||||
|
||||
for (const change of pending) {
|
||||
// Core entity sync will be implemented when remote hybrid mode is enabled.
|
||||
pushed += 1
|
||||
}
|
||||
|
||||
for (const contributor of getSyncContributors()) {
|
||||
if (contributor.pushChanges) {
|
||||
await contributor.pushChanges()
|
||||
}
|
||||
}
|
||||
|
||||
if (pending.length) {
|
||||
await ackChanges(pending.map((c) => c.id))
|
||||
}
|
||||
|
||||
return { pushed, pending: Math.max(0, pending.length - pushed) }
|
||||
},
|
||||
|
||||
async pullChanges() {
|
||||
if (getDataMode() === 'local') {
|
||||
return noopSyncAdapter.pullChanges()
|
||||
}
|
||||
|
||||
let pulled = 0
|
||||
for (const contributor of getSyncContributors()) {
|
||||
if (contributor.pullChanges) {
|
||||
const result = await contributor.pullChanges()
|
||||
pulled += result?.pulled || 0
|
||||
}
|
||||
}
|
||||
return { pulled }
|
||||
},
|
||||
|
||||
async ack() {
|
||||
return { ok: true }
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user