import { getFormMetaStore } from "./store.js";
import { v4 } from "uuid";
import { getMaybePartner, getMaybeUser } from "../../authentication/index.js";
export async function setFormMeta(data) {
    const store = getFormMetaStore();
    const formMetaId = data.formMetaId || v4();
    const createdAt = data.createdAt || new Date().toISOString();
    const userId = getMaybeUser()?.userId;
    const partnerId = getMaybePartner()?.partnerId;
    const meta = {
        updatedAt: createdAt,
        createdAt,
        ...data,
        partnerId,
        userId,
        formMetaId,
    };
    await store.set(formMetaId, meta);
    return meta;
}
//# sourceMappingURL=set-form-meta.js.map