Skip to content

Commit

Permalink
Merge pull request #260 from evoluhq/changeset-release/main
Browse files Browse the repository at this point in the history
[ci] release
  • Loading branch information
steida authored Nov 28, 2023
2 parents 880c51f + 62917ab commit a597805
Show file tree
Hide file tree
Showing 22 changed files with 624 additions and 150 deletions.
62 changes: 0 additions & 62 deletions .changeset/blue-tables-invent.md

This file was deleted.

59 changes: 59 additions & 0 deletions apps/native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# native

## 1.0.0

### Major Changes

- 7e80483: New API

With the upcoming React 19 `use` Hook, I took a chance to review and improve the Evolu API. I moved as many logic and types as possible to the Evolu interface to make platform variants more lightweight and to allow the use of Evolu directly out of any UI library.

The most significant change is the split of SQL query declaration and usage. The rest of the API is almost identical except for minor improvements and one removal: filterMap helper is gone.

It was a good idea with a nice DX, but such ad-hoc migrations belong in the database, not the JavaScript code. Filtering already loaded data pulls excessive data that should stay in the database. The good news is we can do that and even better with Kysely.

To refresh what we are talking about for Evolu newcomers. Because database schema is evolving, and we can't do classical migrations in local-first apps (because we don't delete and other CRDT stuff), Evolu adopted GraphQL schema-less everything-is-nullable pattern.

Having nullable everywhere in code is not ideal DX, so it would be nice to filter, ensure non-nullability, and even map rows directly in the database. Surprisingly, SQL is capable of that. Expect Evolu DSL for that soon. Meanwhile, we can do that manually:

```ts
const todosWithout = evolu.createQuery((db) =>
db
.selectFrom("todo")
.select(["id", "title", "isCompleted", "categoryId"])
.where("isDeleted", "is not", Evolu.cast(true))
// Filter null value and ensure non-null type. Evolu will provide a helper.
.where("title", "is not", null)
.$narrowType<{ title: Evolu.NonEmptyString1000 }>()
.orderBy("createdAt"),
);
```

And now to the new API. Behold:

```ts
// Create queries.
const allTodos = evolu.createQuery((db) => db.selectFrom("todo").selectAll());
const todoById = (id: TodoId) =>
evolu.createQuery((db) =>
db.selectFrom("todo").selectAll().where("id", "=", id),
);

// We can load a query or many queries.
const allTodosPromise = evolu.loadQuery(allTodos).then(({ rows }) => {
console.log(rows);
});
evolu.loadQueries([allTodos, todoById(1)]);

// useQuery can load once or use a promise.
const { rows } = useQuery(allTodos);
const { rows } = useQuery(allTodos, { once: true });
const { rows } = useQuery(allTodos, { promise: allTodosPromise });
const { row } = useQuery(todoById(1));
```

I also refactored (read: simplified) the usage of Effect Layers across all libraries. And the last thing: There is no breaking change in data storage or protocol.

### Patch Changes

- Updated dependencies [7e80483]
- @evolu/react-native@2.0.0

## 0.0.97

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "native",
"version": "0.0.97",
"version": "1.0.0",
"private": true,
"main": "index.js",
"scripts": {
Expand Down
59 changes: 59 additions & 0 deletions apps/server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# server

## 1.0.0

### Major Changes

- 7e80483: New API

With the upcoming React 19 `use` Hook, I took a chance to review and improve the Evolu API. I moved as many logic and types as possible to the Evolu interface to make platform variants more lightweight and to allow the use of Evolu directly out of any UI library.

The most significant change is the split of SQL query declaration and usage. The rest of the API is almost identical except for minor improvements and one removal: filterMap helper is gone.

It was a good idea with a nice DX, but such ad-hoc migrations belong in the database, not the JavaScript code. Filtering already loaded data pulls excessive data that should stay in the database. The good news is we can do that and even better with Kysely.

To refresh what we are talking about for Evolu newcomers. Because database schema is evolving, and we can't do classical migrations in local-first apps (because we don't delete and other CRDT stuff), Evolu adopted GraphQL schema-less everything-is-nullable pattern.

Having nullable everywhere in code is not ideal DX, so it would be nice to filter, ensure non-nullability, and even map rows directly in the database. Surprisingly, SQL is capable of that. Expect Evolu DSL for that soon. Meanwhile, we can do that manually:

```ts
const todosWithout = evolu.createQuery((db) =>
db
.selectFrom("todo")
.select(["id", "title", "isCompleted", "categoryId"])
.where("isDeleted", "is not", Evolu.cast(true))
// Filter null value and ensure non-null type. Evolu will provide a helper.
.where("title", "is not", null)
.$narrowType<{ title: Evolu.NonEmptyString1000 }>()
.orderBy("createdAt"),
);
```

And now to the new API. Behold:

```ts
// Create queries.
const allTodos = evolu.createQuery((db) => db.selectFrom("todo").selectAll());
const todoById = (id: TodoId) =>
evolu.createQuery((db) =>
db.selectFrom("todo").selectAll().where("id", "=", id),
);

// We can load a query or many queries.
const allTodosPromise = evolu.loadQuery(allTodos).then(({ rows }) => {
console.log(rows);
});
evolu.loadQueries([allTodos, todoById(1)]);

// useQuery can load once or use a promise.
const { rows } = useQuery(allTodos);
const { rows } = useQuery(allTodos, { once: true });
const { rows } = useQuery(allTodos, { promise: allTodosPromise });
const { row } = useQuery(todoById(1));
```

I also refactored (read: simplified) the usage of Effect Layers across all libraries. And the last thing: There is no breaking change in data storage or protocol.

### Patch Changes

- Updated dependencies [7e80483]
- @evolu/server@2.0.0

## 0.0.105

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server",
"version": "0.0.105",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
Expand Down
60 changes: 60 additions & 0 deletions apps/web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# web

## 1.0.0

### Major Changes

- 7e80483: New API

With the upcoming React 19 `use` Hook, I took a chance to review and improve the Evolu API. I moved as many logic and types as possible to the Evolu interface to make platform variants more lightweight and to allow the use of Evolu directly out of any UI library.

The most significant change is the split of SQL query declaration and usage. The rest of the API is almost identical except for minor improvements and one removal: filterMap helper is gone.

It was a good idea with a nice DX, but such ad-hoc migrations belong in the database, not the JavaScript code. Filtering already loaded data pulls excessive data that should stay in the database. The good news is we can do that and even better with Kysely.

To refresh what we are talking about for Evolu newcomers. Because database schema is evolving, and we can't do classical migrations in local-first apps (because we don't delete and other CRDT stuff), Evolu adopted GraphQL schema-less everything-is-nullable pattern.

Having nullable everywhere in code is not ideal DX, so it would be nice to filter, ensure non-nullability, and even map rows directly in the database. Surprisingly, SQL is capable of that. Expect Evolu DSL for that soon. Meanwhile, we can do that manually:

```ts
const todosWithout = evolu.createQuery((db) =>
db
.selectFrom("todo")
.select(["id", "title", "isCompleted", "categoryId"])
.where("isDeleted", "is not", Evolu.cast(true))
// Filter null value and ensure non-null type. Evolu will provide a helper.
.where("title", "is not", null)
.$narrowType<{ title: Evolu.NonEmptyString1000 }>()
.orderBy("createdAt"),
);
```

And now to the new API. Behold:

```ts
// Create queries.
const allTodos = evolu.createQuery((db) => db.selectFrom("todo").selectAll());
const todoById = (id: TodoId) =>
evolu.createQuery((db) =>
db.selectFrom("todo").selectAll().where("id", "=", id),
);

// We can load a query or many queries.
const allTodosPromise = evolu.loadQuery(allTodos).then(({ rows }) => {
console.log(rows);
});
evolu.loadQueries([allTodos, todoById(1)]);

// useQuery can load once or use a promise.
const { rows } = useQuery(allTodos);
const { rows } = useQuery(allTodos, { once: true });
const { rows } = useQuery(allTodos, { promise: allTodosPromise });
const { row } = useQuery(todoById(1));
```

I also refactored (read: simplified) the usage of Effect Layers across all libraries. And the last thing: There is no breaking change in data storage or protocol.

### Patch Changes

- Updated dependencies [7e80483]
- @evolu/common@2.0.0
- @evolu/react@3.0.0

## 0.0.107

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web",
"version": "0.0.107",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
55 changes: 55 additions & 0 deletions packages/eslint-config-evolu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# eslint-config-evolu

## 1.0.0

### Major Changes

- 7e80483: New API

With the upcoming React 19 `use` Hook, I took a chance to review and improve the Evolu API. I moved as many logic and types as possible to the Evolu interface to make platform variants more lightweight and to allow the use of Evolu directly out of any UI library.

The most significant change is the split of SQL query declaration and usage. The rest of the API is almost identical except for minor improvements and one removal: filterMap helper is gone.

It was a good idea with a nice DX, but such ad-hoc migrations belong in the database, not the JavaScript code. Filtering already loaded data pulls excessive data that should stay in the database. The good news is we can do that and even better with Kysely.

To refresh what we are talking about for Evolu newcomers. Because database schema is evolving, and we can't do classical migrations in local-first apps (because we don't delete and other CRDT stuff), Evolu adopted GraphQL schema-less everything-is-nullable pattern.

Having nullable everywhere in code is not ideal DX, so it would be nice to filter, ensure non-nullability, and even map rows directly in the database. Surprisingly, SQL is capable of that. Expect Evolu DSL for that soon. Meanwhile, we can do that manually:

```ts
const todosWithout = evolu.createQuery((db) =>
db
.selectFrom("todo")
.select(["id", "title", "isCompleted", "categoryId"])
.where("isDeleted", "is not", Evolu.cast(true))
// Filter null value and ensure non-null type. Evolu will provide a helper.
.where("title", "is not", null)
.$narrowType<{ title: Evolu.NonEmptyString1000 }>()
.orderBy("createdAt"),
);
```

And now to the new API. Behold:

```ts
// Create queries.
const allTodos = evolu.createQuery((db) => db.selectFrom("todo").selectAll());
const todoById = (id: TodoId) =>
evolu.createQuery((db) =>
db.selectFrom("todo").selectAll().where("id", "=", id),
);

// We can load a query or many queries.
const allTodosPromise = evolu.loadQuery(allTodos).then(({ rows }) => {
console.log(rows);
});
evolu.loadQueries([allTodos, todoById(1)]);

// useQuery can load once or use a promise.
const { rows } = useQuery(allTodos);
const { rows } = useQuery(allTodos, { once: true });
const { rows } = useQuery(allTodos, { promise: allTodosPromise });
const { row } = useQuery(todoById(1));
```

I also refactored (read: simplified) the usage of Effect Layers across all libraries. And the last thing: There is no breaking change in data storage or protocol.
2 changes: 1 addition & 1 deletion packages/eslint-config-evolu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-evolu",
"version": "0.0.2",
"version": "1.0.0",
"private": true,
"main": "index.js",
"scripts": {
Expand Down
Loading

1 comment on commit a597805

@vercel
Copy link

@vercel vercel bot commented on a597805 Nov 28, 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.vercel.app
evolu.dev
www.evolu.dev
evolu-git-main-evolu.vercel.app
evolu-evolu.vercel.app

Please sign in to comment.