Skip to content

Commit

Permalink
Remove Tag suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
steida committed Dec 1, 2023
1 parent 9fc0804 commit 24469cc
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions packages/evolu-server/src/createExpressApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,20 @@ const createDb = (fileName: string): Db =>
};
});

const DbTag = Context.Tag<Db>();
const Db = Context.Tag<Db>();

const getMerkleTree = (
userId: string,
): Effect.Effect<Db, SqliteError, MerkleTree> =>
pipe(
Effect.flatMap(DbTag, ({ selectMerkleTree }) =>
Effect.try({
try: () =>
selectMerkleTree.get(userId) as
| { readonly merkleTree: MerkleTreeString }
| undefined,
catch: (error) => new SqliteError(error),
}),
),
Effect.flatMap(Db, ({ selectMerkleTree }) =>
Effect.try({
try: () =>
selectMerkleTree.get(userId) as
| { readonly merkleTree: MerkleTreeString }
| undefined,
catch: (error) => new SqliteError(error),
}),
).pipe(
Effect.map((row) =>
row ? unsafeMerkleTreeFromString(row.merkleTree) : initialMerkleTree,
),
Expand All @@ -114,7 +113,7 @@ const addMessages = ({
messages: ReadonlyArray.NonEmptyReadonlyArray<EncryptedMessage>;
userId: string;
}): Effect.Effect<Db, SqliteError, MerkleTree> =>
Effect.flatMap(DbTag, (db) =>
Effect.flatMap(Db, (db) =>
Effect.try({
try: () => {
db.begin.run();
Expand Down Expand Up @@ -157,7 +156,7 @@ const getMessages = ({
userId: string;
nodeId: string;
}): Effect.Effect<Db, SqliteError, ReadonlyArray<EncryptedMessage>> =>
Effect.flatMap(DbTag, (db) =>
Effect.flatMap(Db, (db) =>
Effect.try({
try: () =>
db.selectMessages.all(
Expand Down Expand Up @@ -226,7 +225,7 @@ export const createExpressApp = (): express.Express => {

app.post("/", (req, res) => {
Effect.runCallback(
Effect.provideService(sync(req), DbTag, db),
Effect.provideService(sync(req), Db, db),
Exit.match({
onFailure: (error) => {
// eslint-disable-next-line no-console
Expand Down

1 comment on commit 24469cc

@vercel
Copy link

@vercel vercel bot commented on 24469cc Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

evolu – ./

evolu-git-main-evolu.vercel.app
evolu.dev
evolu-evolu.vercel.app
evolu.vercel.app
www.evolu.dev

Please sign in to comment.