foldkit-sync 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +11 -11
  2. package/package.json +8 -7
package/README.md CHANGED
@@ -114,7 +114,7 @@ package.
114
114
  Start with an ordinary Foldkit application:
115
115
 
116
116
  ```ts
117
- import { Schema } from 'effect'
117
+ import { Option, Schema } from 'effect'
118
118
  import { defineMessageUnion } from 'foldkit/message'
119
119
  import type * as Update from 'foldkit/update'
120
120
  import { MessageSet, Projection, Surface } from 'foldkit-surface'
@@ -124,8 +124,8 @@ const Model = Schema.Struct({
124
124
  todos: Schema.Array(
125
125
  Schema.Struct({ id: Schema.String, title: Schema.String }),
126
126
  ),
127
- selectedTodoId: Schema.NullOr(Schema.String),
128
- lastError: Schema.NullOr(Schema.String),
127
+ selectedTodoId: Schema.Option(Schema.String),
128
+ lastError: Schema.Option(Schema.String),
129
129
  })
130
130
  type Model = typeof Model.Type
131
131
 
@@ -138,8 +138,8 @@ type Message = typeof Message.Type
138
138
 
139
139
  const initial: Model = {
140
140
  todos: [],
141
- selectedTodoId: null,
142
- lastError: null,
141
+ selectedTodoId: Option.none(),
142
+ lastError: Option.none(),
143
143
  }
144
144
 
145
145
  type Return = Update.Return<Model, Message>
@@ -159,7 +159,7 @@ const update = (model: Model, message: Message): Return =>
159
159
  },
160
160
  }),
161
161
  SelectedTodo: ({ id }) => ({
162
- model: { ...model, selectedTodoId: id },
162
+ model: { ...model, selectedTodoId: Option.some(id) },
163
163
  }),
164
164
  })
165
165
 
@@ -171,7 +171,7 @@ const TodoSync = Sync.forApplication(App).make({
171
171
  // This slice of Model is replicated.
172
172
  // The writable Projection lets Sync install checkpoints/reconciled state back
173
173
  // into the application Model without owning a second copy of the schema.
174
- shared: Projection.pick(App.fields.todos),
174
+ shared: Projection.pick(App.model.todos),
175
175
 
176
176
  // Only these existing Messages become durable operations.
177
177
  durable: MessageSet.make(App, [
@@ -558,7 +558,7 @@ const mounted = Sync.mount(App, TodoSync, {
558
558
  }),
559
559
  onPersistenceFailure: (model, error) => ({
560
560
  ...model,
561
- lastError: error.message,
561
+ lastError: Option.some(error.message),
562
562
  }),
563
563
  })
564
564
 
@@ -625,7 +625,7 @@ fragments and compose them into one document:
625
625
  const AppSync = Sync.forApplication(App)
626
626
 
627
627
  const Todos = AppSync.fragment({
628
- shared: Projection.pick(App.fields.todos),
628
+ shared: Projection.pick(App.model.todos),
629
629
  durable: MessageSet.make(App, [
630
630
  Message.CreatedTodo,
631
631
  Message.RenamedTodo,
@@ -633,7 +633,7 @@ const Todos = AppSync.fragment({
633
633
  })
634
634
 
635
635
  const Members = AppSync.fragment({
636
- shared: Projection.pick(App.fields.members),
636
+ shared: Projection.pick(App.model.members),
637
637
  durable: MessageSet.make(App, [Message.Invited]),
638
638
  })
639
639
 
@@ -956,7 +956,7 @@ Sync does **not** own:
956
956
  ## How state changes here
957
957
 
958
958
  Durable Messages replay the normal application `update` — which is where
959
- `evo` lives — so deterministic replay and optimistic application are the
959
+ `modifyFields` lives — so deterministic replay and optimistic application are the
960
960
  same code path, not two reducers. Checkpoints and adopted server state
961
961
  arrive the other way: structurally installed through the declared writable
962
962
  projection. Sync already verifies that durable Messages touch only the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit-sync",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "A local-first replica of a shared Foldkit projection: offline outbox, optimistic updates, and reconciliation.",
5
5
  "keywords": [
6
6
  "foldkit",
@@ -38,19 +38,20 @@
38
38
  "LICENSE"
39
39
  ],
40
40
  "dependencies": {
41
- "foldkit-surface": "0.4.0"
41
+ "foldkit-surface": "0.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "effect": "^4.0.0-rc.112",
45
- "foldkit": "^0.158.2"
44
+ "effect": "^4.0.0-rc.116",
45
+ "foldkit": "^0.163.0"
46
46
  },
47
47
  "devDependencies": {
48
- "effect": "4.0.0-rc.112",
49
- "foldkit": "0.158.2",
48
+ "@effect/platform-browser": "4.0.0-rc.116",
49
+ "effect": "4.0.0-rc.116",
50
+ "foldkit": "0.163.0",
50
51
  "jsdom": "26.1.0",
51
52
  "tsdown": "^0.23.0",
52
53
  "typescript": "5.9.3",
53
- "foldkit-agent": "0.3.2"
54
+ "foldkit-agent": "0.4.0"
54
55
  },
55
56
  "scripts": {
56
57
  "build": "tsdown",