@confect/test 9.0.1 → 9.1.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.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,27 @@
1
1
  # @confect/test
2
2
 
3
+ ## 9.1.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8bbde87]
8
+ - Updated dependencies [4d8a568]
9
+ - @confect/server@9.1.0
10
+ - @confect/core@9.1.0
11
+
12
+ ## 9.0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [dd33006]
17
+ - @confect/server@9.0.2
18
+ - @confect/core@9.0.2
19
+
3
20
  ## 9.0.1
4
21
 
5
22
  ### Patch Changes
6
23
 
7
24
  - 445ea9b: Loosen and align dependency ranges across all packages:
8
-
9
25
  - 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
26
  - `@confect/server`'s `@effect/platform-node` peer dependency is now optional — it is only needed when using the `@confect/server/node` entrypoint.
11
27
  - `@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`.
@@ -26,7 +42,6 @@
26
42
  ### Filesystem-driven groups
27
43
 
28
44
  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.
29
-
30
45
  - Each `*.spec.ts` `export default`s its `GroupSpec` (named co-exports like error classes are still allowed).
31
46
  - 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.
32
47
  - 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.
@@ -46,12 +61,11 @@
46
61
  Schema.Struct({
47
62
  userId: Schema.optional(Id("users")),
48
63
  text: Schema.String,
49
- })
64
+ }),
50
65
  );
51
66
  ```
52
67
 
53
68
  Codegen emits, alongside it:
54
-
55
69
  - `_generated/schema.ts`—the runtime `DatabaseSchema`. Never imports `convex/server`, so a runtime cold start no longer evaluates `defineSchema(...)`.
56
70
  - `_generated/convexSchema.ts`—the Convex deploy `SchemaDefinition`, re-exported from `convex/schema.ts`.
57
71
  - `_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.
@@ -71,7 +85,7 @@
71
85
  name: "list",
72
86
  args: Schema.Struct({}),
73
87
  returns: Schema.Array(Notes.Doc),
74
- })
88
+ }),
75
89
  );
76
90
  ```
77
91
 
@@ -90,7 +104,7 @@
90
104
  name: "list",
91
105
  args: () => Schema.Struct({}),
92
106
  returns: () => Schema.Array(notes.Doc),
93
- })
107
+ }),
94
108
  );
95
109
  ```
96
110
 
@@ -101,14 +115,13 @@
101
115
  const list = FunctionImpl.make(databaseSchema, notes, "list", handler);
102
116
  export default GroupImpl.make(databaseSchema, notes).pipe(
103
117
  Layer.provide(list),
104
- GroupImpl.finalize
118
+ GroupImpl.finalize,
105
119
  );
106
120
  ```
107
121
 
108
122
  ### Node functions are first-class
109
123
 
110
124
  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.
111
-
112
125
  - A Node group at `confect/email.spec.ts` is now reached at `refs.public.email.send` instead of `refs.public.node.email.send`.
113
126
  - `@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.
114
127
 
@@ -125,7 +138,6 @@
125
138
  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.
126
139
 
127
140
  ### Migration
128
-
129
141
  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`.
130
142
  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"`.
131
143
  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).
@@ -213,7 +225,6 @@
213
225
  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.
214
226
 
215
227
  Codegen now scans `confect/tables/*.ts` (every file must default-export a `Table`) and emits two siblings:
216
-
217
228
  - `confect/_generated/schema.ts` — the runtime `DatabaseSchema`, consumed by `_generated/api.ts`. Imports `@confect/server` but never `convex/server`.
218
229
  - `confect/_generated/convexSchema.ts` — the Convex deploy `SchemaDefinition`, re-exported one-line from `convex/schema.ts`. Imports `convex/server` but never `@confect/server`.
219
230
 
@@ -226,7 +237,6 @@
226
237
  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.
227
238
 
228
239
  Codegen now emits two new sets of files alongside `_generated/schema.ts` and `_generated/convexSchema.ts`:
229
-
230
240
  - `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")`.
231
241
  - `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`.
232
242
 
@@ -243,7 +253,6 @@
243
253
  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).
244
254
 
245
255
  ### Migration
246
-
247
256
  1. Delete your `confect/schema.ts`. Codegen will refuse to run while a stray copy is present.
248
257
  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.
249
258
  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`:
@@ -395,7 +404,7 @@
395
404
 
396
405
  export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
397
406
  "NoteNotFound",
398
- { noteId: GenericId.GenericId("notes") }
407
+ { noteId: GenericId.GenericId("notes") },
399
408
  ) {}
400
409
 
401
410
  export const notes = GroupSpec.make("notes").addFunction(
@@ -404,7 +413,7 @@
404
413
  args: Schema.Struct({ noteId: GenericId.GenericId("notes") }),
405
414
  returns: Notes.Doc,
406
415
  error: NoteNotFound,
407
- })
416
+ }),
408
417
  );
409
418
  ```
410
419
 
@@ -424,7 +433,7 @@
424
433
  .table("notes")
425
434
  .get(noteId)
426
435
  .pipe(Effect.mapError(() => new NoteNotFound({ noteId })));
427
- })
436
+ }),
428
437
  );
429
438
  ```
430
439
 
@@ -496,7 +505,6 @@
496
505
  Unspecified failures continue to reject the promise.
497
506
 
498
507
  ### Migration
499
-
500
508
  - 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).
501
509
  - 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.
502
510