fix
This commit is contained in:
parent
caba4368ca
commit
d47cf0af12
|
|
@ -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<SAction["code"]["create"]>
|
||||
>;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -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<SAction["comp"]["list"]>
|
||||
>;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -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";
|
||||
|
|
@ -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<SAction["page"]["list"]>
|
||||
>;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -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<SAction["site"]["list"]>
|
||||
>;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ export const syncHandler: WebSocketHandler<WSData> = {
|
|||
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<WSData> = {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -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)};
|
||||
|
|
|
|||
Loading…
Reference in New Issue