diff --git a/app/srv/ws/sync/actions/code_create.ts b/app/srv/ws/sync/actions/code_create.ts new file mode 100644 index 00000000..6e163a12 --- /dev/null +++ b/app/srv/ws/sync/actions/code_create.ts @@ -0,0 +1,11 @@ + +import { SAction } from "../actions"; +import { SyncConnection } from "../type"; +export const code_create: SAction["code"]["create"] = async function ( + this: SyncConnection, +) { + let result = null as unknown as Awaited< + ReturnType + >; + return result; +} \ No newline at end of file diff --git a/app/srv/ws/sync/actions/comp_list.ts b/app/srv/ws/sync/actions/comp_list.ts new file mode 100644 index 00000000..c877e1b5 --- /dev/null +++ b/app/srv/ws/sync/actions/comp_list.ts @@ -0,0 +1,11 @@ + +import { SAction } from "../actions"; +import { SyncConnection } from "../type"; +export const comp_list: SAction["comp"]["list"] = async function ( + this: SyncConnection, +) { + let result = null as unknown as Awaited< + ReturnType + >; + return result; +} \ No newline at end of file diff --git a/app/srv/ws/sync/actions/index.ts b/app/srv/ws/sync/actions/index.ts index eabd69fc..07db818c 100644 --- a/app/srv/ws/sync/actions/index.ts +++ b/app/srv/ws/sync/actions/index.ts @@ -1,13 +1,17 @@ -export * from "./activity"; -export * from "./client_info"; -export * from "./site_update"; -export * from "./site_load"; +export * from "./code_create"; +export * from "./site_list"; export * from "./site_group"; -export * from "./page_load"; -export * from "./comp_load"; +export * from "./site_load"; +export * from "./site_update"; export * from "./comp_new"; +export * from "./comp_list"; export * from "./comp_group"; +export * from "./comp_load"; +export * from "./page_list"; +export * from "./page_load"; export * from "./yjs_um"; export * from "./yjs_sv_local"; export * from "./yjs_diff_local"; export * from "./yjs_sv_remote"; +export * from "./activity"; +export * from "./client_info"; \ No newline at end of file diff --git a/app/srv/ws/sync/actions/page_list.ts b/app/srv/ws/sync/actions/page_list.ts new file mode 100644 index 00000000..b0f81efd --- /dev/null +++ b/app/srv/ws/sync/actions/page_list.ts @@ -0,0 +1,11 @@ + +import { SAction } from "../actions"; +import { SyncConnection } from "../type"; +export const page_list: SAction["page"]["list"] = async function ( + this: SyncConnection, +) { + let result = null as unknown as Awaited< + ReturnType + >; + return result; +} \ No newline at end of file diff --git a/app/srv/ws/sync/actions/site_list.ts b/app/srv/ws/sync/actions/site_list.ts new file mode 100644 index 00000000..5adffec2 --- /dev/null +++ b/app/srv/ws/sync/actions/site_list.ts @@ -0,0 +1,11 @@ + +import { SAction } from "../actions"; +import { SyncConnection } from "../type"; +export const site_list: SAction["site"]["list"] = async function ( + this: SyncConnection, +) { + let result = null as unknown as Awaited< + ReturnType + >; + return result; +} \ No newline at end of file diff --git a/app/srv/ws/sync/sync-handler.ts b/app/srv/ws/sync/sync-handler.ts index e40f89de..cb636b67 100644 --- a/app/srv/ws/sync/sync-handler.ts +++ b/app/srv/ws/sync/sync-handler.ts @@ -59,7 +59,7 @@ export const syncHandler: WebSocketHandler = { const msg = packr.unpack(Buffer.from(raw)); if (msg.type === SyncType.UserID) { const { user_id, page_id, site_id } = msg; - + conn.user_id = user_id; conn.user = await db.user.findFirst({ where: { id: user_id } }); @@ -94,7 +94,9 @@ export const syncHandler: WebSocketHandler = { if (actionName) { const baseAction = (actions as any)[actionName]; if (!baseAction) { - console.log(`app/ws/edit/sync/${actionName}.ts not found`); + console.log( + `app/srv/ws/sync/actions/${actionName}.ts not found` + ); } if (baseAction) { const action = baseAction.bind(conn); diff --git a/pkgs/core/utils/sync-def.ts b/pkgs/core/utils/sync-def.ts index b62acaaa..b36182a9 100644 --- a/pkgs/core/utils/sync-def.ts +++ b/pkgs/core/utils/sync-def.ts @@ -22,7 +22,7 @@ export const syncActionDefinition = async () => { }; walk(SyncActions, def, []); - const index_js = []; + const index_js = []; for (const [k, v] of Object.entries(paths)) { const arr = v.split("."); const name = arr.join("_"); @@ -45,6 +45,11 @@ export const ${name}: SAction${saction} = async function ( index_js.push(`export * from "./${name}";`); } + await writeAsync( + dir.path(`app/srv/ws/sync/actions/index.ts`), + index_js.join("\n") + ); + const content = `\ export const SyncActionDefinition = ${JSON.stringify(def, null, 2)}; export const SyncActionPaths = ${JSON.stringify(paths, null, 2)};