import { component, page } from "dbgen"; import { EComp, EPage, ESite, } from "../../../web/src/render/ed/logic/ed-global"; import { IItem } from "../../../web/src/utils/types/item"; import { site_group } from "./actions/site_group"; import { Activity, ActivityKind } from "./type"; /* WARNING: CHANGING FUNCTION NAME / OBJECT STRUCTURE WILL *BREAK* OFFLINE STORAGE -- ONLY ADDITION IS ALLOWED */ export type SAction = typeof SyncActions; export const SyncActions = { code: { create: async (id_site: string, name: string) => ({}), }, site: { list: async () => ({}) as Record, group: async () => ({}) as ReturnType, load: async (id: string) => ({}) as ESite | void, update: async ( id: string, site: Partial< Omit & { js: Buffer; js_compiled: Buffer; } > ) => {}, }, comp: { new: async (arg: { group_id: string; page_id?: string; comp_id?: string; item_id: string; item: IItem; }) => {}, list: async () => ({}) as Record>, group: async (id_site: string) => ({}) as Record, load: async (id: string) => ({}) as EComp | void, }, page: { list: async (id_site: string) => ({}) as Record>, load: async (id: string) => ({}) as EPage | void, }, yjs: { um: async ( mode: "page" | "comp" | "site", action: "undo" | "redo", id: string ) => {}, sv_local: async ( mode: "page" | "comp" | "site", id: string, bin: Uint8Array ) => ({}) as { diff: Uint8Array; sv: Uint8Array } | void, diff_local: async ( mode: "page" | "comp" | "site", id: string, bin: Uint8Array ) => {}, sv_remote: async ( mode: "page" | "comp" | "site", id: string, sv: Uint8Array, diff: Uint8Array ) => ({}) as { diff: Uint8Array } | void, }, activity: async ( target: { comp_id?: string; page_id?: string; item_id: string }, kind: ActivityKind, activity: Activity ) => {}, client: { info: async (client_ids: string[]) => ({}) as Record, }, };