···
1
-
import type { Did } from "@/lib/types/atproto";
1
+
import type { ComAtprotoRepoStrongRef, Did } from "@/lib/types/atproto";
import type { SystemsGmstnDevelopmentShard } from "@/lib/types/lexicon/systems.gmstn.development.shard";
import { getEndpointFromDid } from "@/lib/utils/atproto";
import { isDomain } from "@/lib/utils/domains";
import type { Result } from "@/lib/utils/result";
import type { Agent } from "@atproto/api";
7
+
import * as TID from "@atcute/tid";
8
+
import type { SystemsGmstnDevelopmentLattice } from "@/lib/types/lexicon/systems.gmstn.development.lattice";
9
+
import type { SystemsGmstnDevelopmentChannelInvite } from "@/lib/types/lexicon/systems.gmstn.development.channel.invite";
export const getLatticeEndpointFromDid = async (did: Did) => {
return await getEndpointFromDid(did, "GemstoneLattice");
···
107
+
export const inviteNewUser = async ({
113
+
channel: ComAtprotoRepoStrongRef;
115
+
}): Promise<Result<undefined, string>> => {
116
+
const now = new Date();
117
+
const rkey = TID.create(now.getTime(), Math.random());
119
+
const record: Omit<SystemsGmstnDevelopmentChannelInvite, "$type"> = {
120
+
// @ts-expect-error we want to explicitly use the ISO string variant
121
+
createdAt: now.toISOString(),
126
+
const { success } = await agent.call(
127
+
"com.atproto.repo.createRecord",
131
+
collection: "systems.gmstn.development.channel.invite",
140
+
error: "Attempted to create lattice record failed. Check the domain inputs.",
143
+
return { ok: true };