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 } from "./entity/actstore"; /* WARNING: CHANGING FUNCTION NAME / OBJECT STRUCTURE WILL *BREAK* OFFLINE STORAGE -- ONLY ADDITION IS ALLOWED */ export type SAction = typeof SyncActions; export const SyncActions = { site: { list: async () => ({}) as Record, group: async () => ({}) as ReturnType, load: async (id: string) => ({}) as ESite | void, js: async ( id: string, js_compressed: Uint8Array, built_compressed: Uint8Array ) => {}, }, comp: { new: async (arg: { group_id: string; page_id?: string; comp_id?: string; item_id: string; item: IItem; }) => {}, list: () => ({}) as Record>, group: async (id_site: string) => ({}) as Record, load: async (id: string) => ({}) as EComp | void, }, page: { list: (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: ( target: { comp_id?: string; page_id?: string; item_id: string }, kind: "js" | "css" | "html" | "text", activity: Activity ) => {}, client: { info: async (client_ids: string[]) => ({}) as Record, }, };