Skip to content

Commit eb79fc9

Browse files
committed
harmonize on input types
1 parent 6b20e6b commit eb79fc9

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

apps/roam/src/utils/syncDgNodesToSupabase.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ import {
1919
import { fetchEmbeddingsForNodes } from "./upsertNodesAsContentWithEmbeddings";
2020
import { convertRoamNodeToLocalContent } from "./upsertNodesAsContentWithEmbeddings";
2121
import type { DGSupabaseClient } from "@repo/database/lib/client";
22-
import type { Json, CompositeTypes, Enums } from "@repo/database/dbTypes";
22+
import type { Json, Enums } from "@repo/database/dbTypes";
2323
import { render as renderToast } from "roamjs-components/components/Toast";
2424
import internalError from "~/utils/internalError";
25-
type LocalContentDataInput = Partial<CompositeTypes<"content_local_input">>;
26-
type AccountLocalInput = CompositeTypes<"account_local_input">;
2725
import { FatalError } from "@repo/database/lib/contextFunctions";
26+
import type {
27+
LocalConceptDataInput,
28+
LocalContentDataInput,
29+
LocalAccountDataInput,
30+
} from "@repo/database/inputTypes";
2831

2932
const SYNC_FUNCTION = "embedding";
3033
// Minimal interval between syncs of all clients for this task.
@@ -42,8 +45,6 @@ type SyncTaskInfo = {
4245
shouldProceed: boolean;
4346
};
4447

45-
type LocalConceptDataInput = Partial<CompositeTypes<"concept_local_input">>;
46-
4748
const chunk = <T>(array: T[], size: number): T[][] => {
4849
const chunks: T[][] = [];
4950
for (let i = 0; i < array.length; i += size) {
@@ -388,7 +389,7 @@ export const upsertNodesToSupabaseAsContentWithEmbeddings = async (
388389
await uploadBatches(chunk(nodesWithEmbeddings, BATCH_SIZE));
389390
};
390391

391-
const getAllUsers = async (): Promise<AccountLocalInput[]> => {
392+
const getAllUsers = async (): Promise<LocalAccountDataInput[]> => {
392393
const query = `[:find ?author_local_id ?author_name
393394
:keys author_local_id name
394395
:where
@@ -412,7 +413,7 @@ const getAllUsers = async (): Promise<AccountLocalInput[]> => {
412413
};
413414

414415
const upsertUsers = async (
415-
users: AccountLocalInput[],
416+
users: LocalAccountDataInput[],
416417
supabaseClient: DGSupabaseClient,
417418
context: SupabaseContext,
418419
) => {

apps/roam/src/utils/upsertNodesAsContentWithEmbeddings.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { type RoamDiscourseNodeData } from "./getAllDiscourseNodesSince";
22
import { type SupabaseContext } from "./supabaseContext";
33
import { nextApiRoot } from "@repo/utils/execContext";
44
import type { DGSupabaseClient } from "@repo/database/lib/client";
5-
import type { Json, CompositeTypes } from "@repo/database/dbTypes";
6-
7-
type LocalContentDataInput = Partial<CompositeTypes<"content_local_input">>;
5+
import type { Json } from "@repo/database/dbTypes";
6+
import type { LocalContentDataInput } from "@repo/database/inputTypes";
87

98
const EMBEDDING_BATCH_SIZE = 200;
109
const EMBEDDING_MODEL = "openai_text_embedding_3_small_1536";

0 commit comments

Comments
 (0)