@confect/test 9.0.0 → 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 +29 -15
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @confect/test
|
|
2
2
|
|
|
3
|
+
## 9.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [dd33006]
|
|
8
|
+
- @confect/server@9.0.2
|
|
9
|
+
- @confect/core@9.0.2
|
|
10
|
+
|
|
11
|
+
## 9.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 445ea9b: Loosen and align dependency ranges across all packages:
|
|
16
|
+
- 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.
|
|
17
|
+
- `@confect/server`'s `@effect/platform-node` peer dependency is now optional — it is only needed when using the `@confect/server/node` entrypoint.
|
|
18
|
+
- `@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`.
|
|
19
|
+
- `@confect/test` now accepts any `convex-test` release in `>=0.0.50 <0.1.0` instead of exactly 0.0.50.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [445ea9b]
|
|
22
|
+
- @confect/core@9.0.1
|
|
23
|
+
- @confect/server@9.0.1
|
|
24
|
+
|
|
3
25
|
## 9.0.0
|
|
4
26
|
|
|
5
27
|
### Major Changes
|
|
@@ -11,7 +33,6 @@
|
|
|
11
33
|
### Filesystem-driven groups
|
|
12
34
|
|
|
13
35
|
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.
|
|
14
|
-
|
|
15
36
|
- Each `*.spec.ts` `export default`s its `GroupSpec` (named co-exports like error classes are still allowed).
|
|
16
37
|
- 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.
|
|
17
38
|
- 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.
|
|
@@ -31,12 +52,11 @@
|
|
|
31
52
|
Schema.Struct({
|
|
32
53
|
userId: Schema.optional(Id("users")),
|
|
33
54
|
text: Schema.String,
|
|
34
|
-
})
|
|
55
|
+
}),
|
|
35
56
|
);
|
|
36
57
|
```
|
|
37
58
|
|
|
38
59
|
Codegen emits, alongside it:
|
|
39
|
-
|
|
40
60
|
- `_generated/schema.ts`—the runtime `DatabaseSchema`. Never imports `convex/server`, so a runtime cold start no longer evaluates `defineSchema(...)`.
|
|
41
61
|
- `_generated/convexSchema.ts`—the Convex deploy `SchemaDefinition`, re-exported from `convex/schema.ts`.
|
|
42
62
|
- `_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.
|
|
@@ -56,7 +76,7 @@
|
|
|
56
76
|
name: "list",
|
|
57
77
|
args: Schema.Struct({}),
|
|
58
78
|
returns: Schema.Array(Notes.Doc),
|
|
59
|
-
})
|
|
79
|
+
}),
|
|
60
80
|
);
|
|
61
81
|
```
|
|
62
82
|
|
|
@@ -75,7 +95,7 @@
|
|
|
75
95
|
name: "list",
|
|
76
96
|
args: () => Schema.Struct({}),
|
|
77
97
|
returns: () => Schema.Array(notes.Doc),
|
|
78
|
-
})
|
|
98
|
+
}),
|
|
79
99
|
);
|
|
80
100
|
```
|
|
81
101
|
|
|
@@ -86,14 +106,13 @@
|
|
|
86
106
|
const list = FunctionImpl.make(databaseSchema, notes, "list", handler);
|
|
87
107
|
export default GroupImpl.make(databaseSchema, notes).pipe(
|
|
88
108
|
Layer.provide(list),
|
|
89
|
-
GroupImpl.finalize
|
|
109
|
+
GroupImpl.finalize,
|
|
90
110
|
);
|
|
91
111
|
```
|
|
92
112
|
|
|
93
113
|
### Node functions are first-class
|
|
94
114
|
|
|
95
115
|
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.
|
|
96
|
-
|
|
97
116
|
- A Node group at `confect/email.spec.ts` is now reached at `refs.public.email.send` instead of `refs.public.node.email.send`.
|
|
98
117
|
- `@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.
|
|
99
118
|
|
|
@@ -110,7 +129,6 @@
|
|
|
110
129
|
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.
|
|
111
130
|
|
|
112
131
|
### Migration
|
|
113
|
-
|
|
114
132
|
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`.
|
|
115
133
|
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"`.
|
|
116
134
|
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).
|
|
@@ -198,7 +216,6 @@
|
|
|
198
216
|
Previously, `confect/schema.ts` was user-authored and `DatabaseSchema` carried a `convexSchemaDefinition` field that was eagerly rebuilt on every `.addTable(...)`. That field was an `O(n²)` allocation for `n` tables, and it forced both the deploy CLI (which only needs `defineSchema(...)`) and the runtime (which only needs the table codec lookup) through the same module — so any runtime function bundle dragged in `convex/server`'s `defineSchema`. Issue 1.
|
|
199
217
|
|
|
200
218
|
Codegen now scans `confect/tables/*.ts` (every file must default-export a `Table`) and emits two siblings:
|
|
201
|
-
|
|
202
219
|
- `confect/_generated/schema.ts` — the runtime `DatabaseSchema`, consumed by `_generated/api.ts`. Imports `@confect/server` but never `convex/server`.
|
|
203
220
|
- `confect/_generated/convexSchema.ts` — the Convex deploy `SchemaDefinition`, re-exported one-line from `convex/schema.ts`. Imports `convex/server` but never `@confect/server`.
|
|
204
221
|
|
|
@@ -211,7 +228,6 @@
|
|
|
211
228
|
This eliminates a class of subtle infelicities: the file basename and the table name can never drift out of sync, cross-table `_id` references are type-constrained against the actual set of declared tables (catching typos at compile time), and ESM cycle hazards for mutual cross-table `Id` references are gone because authoring files no longer transitively import each other.
|
|
212
229
|
|
|
213
230
|
Codegen now emits two new sets of files alongside `_generated/schema.ts` and `_generated/convexSchema.ts`:
|
|
214
|
-
|
|
215
231
|
- `confect/_generated/id.ts` — a single `Id` constructor whose argument is type-constrained to the union of your table names. Use `Id("notes")` everywhere you previously wrote `GenericId.GenericId("notes")`.
|
|
216
232
|
- `confect/_generated/tables/<name>.ts` — one thin wrapper per table that binds the unnamed value from `confect/tables/<name>.ts` to its filename. This is what other modules (specs, impls, HTTP handlers) default-import to reach a table's `Doc`, `Fields`, and `tableName`.
|
|
217
233
|
|
|
@@ -228,7 +244,6 @@
|
|
|
228
244
|
The bound `Table` now exposes `Fields` / `Doc` / `tableDefinition` as lazy getters that compute their value on first access, then replace themselves with a plain non-writable data property so second-and-subsequent accesses are observably indistinguishable from a plain property (and skip all function-call overhead). The result: a function bundle only pays the schema-construction cost for tables it actually touches via `db.table(name)` (which reaches `Fields` through `Document.decode`). The `UnnamedTable` callable no longer exposes `Fields` or `tableDefinition` — read these off the bound `Table` (the generated `_generated/tables/<name>.ts` wrapper already binds the name).
|
|
229
245
|
|
|
230
246
|
### Migration
|
|
231
|
-
|
|
232
247
|
1. Delete your `confect/schema.ts`. Codegen will refuse to run while a stray copy is present.
|
|
233
248
|
2. Rename each `confect/tables/<Name>.ts` to a valid JS identifier in your chosen casing convention (e.g. `confect/tables/notes.ts`). The basename becomes the table name; you no longer pass it as an argument.
|
|
234
249
|
3. Convert each table file to a **default-export-only** unnamed module: drop the name argument from `Table.make`, wrap the field-schema struct in a `() => ...` callback, and switch any `GenericId.GenericId("users")` references to `Id("users")` imported from `../_generated/id`:
|
|
@@ -380,7 +395,7 @@
|
|
|
380
395
|
|
|
381
396
|
export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
|
|
382
397
|
"NoteNotFound",
|
|
383
|
-
{ noteId: GenericId.GenericId("notes") }
|
|
398
|
+
{ noteId: GenericId.GenericId("notes") },
|
|
384
399
|
) {}
|
|
385
400
|
|
|
386
401
|
export const notes = GroupSpec.make("notes").addFunction(
|
|
@@ -389,7 +404,7 @@
|
|
|
389
404
|
args: Schema.Struct({ noteId: GenericId.GenericId("notes") }),
|
|
390
405
|
returns: Notes.Doc,
|
|
391
406
|
error: NoteNotFound,
|
|
392
|
-
})
|
|
407
|
+
}),
|
|
393
408
|
);
|
|
394
409
|
```
|
|
395
410
|
|
|
@@ -409,7 +424,7 @@
|
|
|
409
424
|
.table("notes")
|
|
410
425
|
.get(noteId)
|
|
411
426
|
.pipe(Effect.mapError(() => new NoteNotFound({ noteId })));
|
|
412
|
-
})
|
|
427
|
+
}),
|
|
413
428
|
);
|
|
414
429
|
```
|
|
415
430
|
|
|
@@ -481,7 +496,6 @@
|
|
|
481
496
|
Unspecified failures continue to reject the promise.
|
|
482
497
|
|
|
483
498
|
### Migration
|
|
484
|
-
|
|
485
499
|
- 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).
|
|
486
500
|
- 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.
|
|
487
501
|
|