@confect/react 9.0.1 → 9.0.2
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.
- package/CHANGELOG.md +13 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# @confect/react
|
|
2
2
|
|
|
3
|
+
## 9.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @confect/core@9.0.2
|
|
8
|
+
|
|
3
9
|
## 9.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
13
|
- 445ea9b: Loosen and align dependency ranges across all packages:
|
|
8
|
-
|
|
9
14
|
- The `convex` peer dependency is now `^1.32.0` in every package (previously pinned exactly to `1.39.1`, or `^1.30.0` in `@confect/react`). The range is validated against convex 1.32.0 through 1.40.0.
|
|
10
15
|
- `@confect/server`'s `@effect/platform-node` peer dependency is now optional — it is only needed when using the `@confect/server/node` entrypoint.
|
|
11
16
|
- `@confect/cli` now uses caret ranges for its `@effect/platform` and `@effect/platform-node` dependencies so they can deduplicate with the versions resolved for `@confect/server`, and no longer declares an unused direct dependency on `@effect/platform-node-shared`.
|
|
@@ -25,7 +30,6 @@
|
|
|
25
30
|
### Filesystem-driven groups
|
|
26
31
|
|
|
27
32
|
Your API is now authored as colocated `*.spec.ts`/`*.impl.ts` pairs, one pair per group, and **the file's path within `confect/` is the group's name** (its stem for top-level groups, the dot-joined directory path for nested groups). `GroupSpec.make()` and `GroupSpec.makeNode()` no longer take a name argument.
|
|
28
|
-
|
|
29
33
|
- Each `*.spec.ts` `export default`s its `GroupSpec` (named co-exports like error classes are still allowed).
|
|
30
34
|
- Each `*.impl.ts` default-imports its sibling spec, passes it to `FunctionImpl.make` / `GroupImpl.make`, and ends the layer pipeline with `GroupImpl.finalize`—a compile-time completeness check that only typechecks once every function the spec declares has a `FunctionImpl` provided.
|
|
31
35
|
- The root `confect/spec.ts`, `confect/impl.ts`, `confect/nodeSpec.ts`, and `confect/nodeImpl.ts` files are gone, along with `Impl.make` and `Impl.finalize`. `confect codegen` deletes any of these (and the stale aggregate `_generated/registeredFunctions.ts` / `_generated/nodeRegisteredFunctions.ts`) on upgrade.
|
|
@@ -45,12 +49,11 @@
|
|
|
45
49
|
Schema.Struct({
|
|
46
50
|
userId: Schema.optional(Id("users")),
|
|
47
51
|
text: Schema.String,
|
|
48
|
-
})
|
|
52
|
+
}),
|
|
49
53
|
);
|
|
50
54
|
```
|
|
51
55
|
|
|
52
56
|
Codegen emits, alongside it:
|
|
53
|
-
|
|
54
57
|
- `_generated/schema.ts`—the runtime `DatabaseSchema`. Never imports `convex/server`, so a runtime cold start no longer evaluates `defineSchema(...)`.
|
|
55
58
|
- `_generated/convexSchema.ts`—the Convex deploy `SchemaDefinition`, re-exported from `convex/schema.ts`.
|
|
56
59
|
- `_generated/id.ts`—a type-safe `Id` constructor whose argument is constrained to your table names. Use `Id("notes")` everywhere you previously wrote `GenericId.GenericId("notes")`; cross-table `_id` typos are now caught at compile time.
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
name: "list",
|
|
71
74
|
args: Schema.Struct({}),
|
|
72
75
|
returns: Schema.Array(Notes.Doc),
|
|
73
|
-
})
|
|
76
|
+
}),
|
|
74
77
|
);
|
|
75
78
|
```
|
|
76
79
|
|
|
@@ -89,7 +92,7 @@
|
|
|
89
92
|
name: "list",
|
|
90
93
|
args: () => Schema.Struct({}),
|
|
91
94
|
returns: () => Schema.Array(notes.Doc),
|
|
92
|
-
})
|
|
95
|
+
}),
|
|
93
96
|
);
|
|
94
97
|
```
|
|
95
98
|
|
|
@@ -100,14 +103,13 @@
|
|
|
100
103
|
const list = FunctionImpl.make(databaseSchema, notes, "list", handler);
|
|
101
104
|
export default GroupImpl.make(databaseSchema, notes).pipe(
|
|
102
105
|
Layer.provide(list),
|
|
103
|
-
GroupImpl.finalize
|
|
106
|
+
GroupImpl.finalize,
|
|
104
107
|
);
|
|
105
108
|
```
|
|
106
109
|
|
|
107
110
|
### Node functions are first-class
|
|
108
111
|
|
|
109
112
|
A group's runtime is now declared solely by its spec—`GroupSpec.makeNode()` for a Node action group, `GroupSpec.make()` otherwise—mirroring vanilla Convex's per-file `"use node"` directive. The separate `node` namespace is gone: Node specs/impls are ordinary colocated pairs that can live anywhere in `confect/`, and codegen emits the `"use node"` directive based on the spec.
|
|
110
|
-
|
|
111
113
|
- A Node group at `confect/email.spec.ts` is now reached at `refs.public.email.send` instead of `refs.public.node.email.send`.
|
|
112
114
|
- `@confect/core` removes `Spec.makeNode`, `Spec.merge`, and `Spec.isConvexSpec` / `Spec.isNodeSpec`; `Spec.make()` is a single mixed-runtime container and `Refs.make(spec)` takes one argument. `GroupSpec.makeNode()`, `FunctionSpec.publicNodeAction()` / `internalNodeAction()` are unchanged.
|
|
113
115
|
|
|
@@ -124,7 +126,6 @@
|
|
|
124
126
|
The codegen bundler now uses [`bundle-require`](https://github.com/egoist/bundle-require), so impls may import third-party packages and use `tsconfig.json` `paths` aliases (`~/*`, `@/*`, …) for their own source. A parent `confect/{path}.spec.ts` may now declare functions alongside a sibling `confect/{path}/` subdirectory of further specs, and codegen reports a clear error on a name collision between the two.
|
|
125
127
|
|
|
126
128
|
### Migration
|
|
127
|
-
|
|
128
129
|
1. **Tables.** Delete `confect/schema.ts`. Rename each table file to a valid JS identifier (e.g. `confect/tables/notes.ts`); the basename becomes the table name. Drop the name argument from `Table.make`, wrap the field struct in `() =>`, and replace `GenericId.GenericId("x")` with `Id("x")` from `_generated/id`. If you read `table.name` off a bound table, rename it to `table.tableName`.
|
|
129
130
|
2. **Specs.** Split each group into a colocated `*.spec.ts` that `export default`s `GroupSpec.make()` (no name). Wrap every `args`/`returns`/`error` in `() =>`. Import a table's `Doc`/`Fields` from its wrapper, `import notes from "./_generated/tables/notes"`.
|
|
130
131
|
3. **Impls.** In each `*.impl.ts`, default-import the sibling spec, import `databaseSchema` from `_generated/schema`, pass it to `FunctionImpl.make` / `GroupImpl.make` in place of `api`, end the pipeline with `GroupImpl.finalize`, and `export default` it. Delete the root `confect/spec.ts`, `impl.ts`, `nodeSpec.ts`, and `nodeImpl.ts` (codegen will also remove them).
|
|
@@ -288,7 +289,7 @@
|
|
|
288
289
|
|
|
289
290
|
export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
|
|
290
291
|
"NoteNotFound",
|
|
291
|
-
{ noteId: GenericId.GenericId("notes") }
|
|
292
|
+
{ noteId: GenericId.GenericId("notes") },
|
|
292
293
|
) {}
|
|
293
294
|
|
|
294
295
|
export const notes = GroupSpec.make("notes").addFunction(
|
|
@@ -297,7 +298,7 @@
|
|
|
297
298
|
args: Schema.Struct({ noteId: GenericId.GenericId("notes") }),
|
|
298
299
|
returns: Notes.Doc,
|
|
299
300
|
error: NoteNotFound,
|
|
300
|
-
})
|
|
301
|
+
}),
|
|
301
302
|
);
|
|
302
303
|
```
|
|
303
304
|
|
|
@@ -317,7 +318,7 @@
|
|
|
317
318
|
.table("notes")
|
|
318
319
|
.get(noteId)
|
|
319
320
|
.pipe(Effect.mapError(() => new NoteNotFound({ noteId })));
|
|
320
|
-
})
|
|
321
|
+
}),
|
|
321
322
|
);
|
|
322
323
|
```
|
|
323
324
|
|
|
@@ -389,7 +390,6 @@
|
|
|
389
390
|
Unspecified failures continue to reject the promise.
|
|
390
391
|
|
|
391
392
|
### Migration
|
|
392
|
-
|
|
393
393
|
- For each `useQuery` call site, replace `result === undefined` checks and direct property access with `QueryResult.match` (or the lower-level `QueryResult.isLoading`/`isSuccess`/`isFailure` predicates).
|
|
394
394
|
- For each `useMutation`/`useAction` call site whose ref now declares an `error` schema, unwrap the resolved `Either` (e.g. with `Either.match`); call sites against refs without an `error` schema need no change.
|
|
395
395
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@confect/react",
|
|
3
3
|
"description": "Client-side bindings for React apps",
|
|
4
|
-
"version": "9.0.
|
|
4
|
+
"version": "9.0.2",
|
|
5
5
|
"author": "RJ Dellecese",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/rjdellecese/confect/issues"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"convex": "^1.32.0",
|
|
58
58
|
"effect": "^3.21.2",
|
|
59
59
|
"react": "^18.0.0 || ^19.0.0",
|
|
60
|
-
"@confect/core": "^9.0.
|
|
60
|
+
"@confect/core": "^9.0.2"
|
|
61
61
|
},
|
|
62
62
|
"repository": {
|
|
63
63
|
"type": "git",
|