Skip to content

Commit a1ba63d

Browse files
committed
cleanup
1 parent 75676af commit a1ba63d

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

src/cache.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,16 @@ export const createCachingMethods = <DType extends { id: string }>({
6262
options?.logger?.debug(
6363
`CosmosDataSource/DataLoader: loading for IDs: ${ids}`
6464
);
65-
// const operations = ids.map<Operation>((id) => ({
66-
// operationType: "Read",
67-
// id,
68-
// }));
69-
// const response = await container.items.bulk(operations);
70-
const idList = ids.map((id) => `'${id}'`).join(",");
7165
const querySpec = {
72-
// query: `select * from c where c.id in (${idList})`,
7366
query: "select * from c where ARRAY_CONTAINS(@ids, c.id)",
7467
parameters: [{ name: "@ids", value: ids }],
7568
};
76-
const response = await container.items.query(querySpec).fetchAll();
69+
const response = await container.items.query<DType>(querySpec).fetchAll();
7770

7871
options?.logger?.debug(
7972
`CosmosDataSource/DataLoader: response count: ${response.resources.length}`
8073
);
81-
options?.logger?.debug(
82-
`data: ${JSON.stringify(response.resources[0], null, " ")}`
83-
);
84-
const responseDocs = response.resources.map((r) =>
85-
r ? ((r as unknown) as DType) : undefined
86-
);
87-
return orderDocs<DType>(ids)(responseDocs);
74+
return orderDocs<DType>(ids)(response.resources);
8875
});
8976

9077
const cachePrefix = `cosmos-${container.url}-`;

0 commit comments

Comments
 (0)