@confect/test 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 CHANGED
@@ -1,11 +1,18 @@
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
+
3
11
  ## 9.0.1
4
12
 
5
13
  ### Patch Changes
6
14
 
7
15
  - 445ea9b: Loosen and align dependency ranges across all packages:
8
-
9
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.
10
17
  - `@confect/server`'s `@effect/platform-node` peer dependency is now optional — it is only needed when using the `@confect/server/node` entrypoint.
11
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`.
@@ -26,7 +33,6 @@
26
33
  ### Filesystem-driven groups
27
34
 
28
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.
29
-
30
36
  - Each `*.spec.ts` `export default`s its `GroupSpec` (named co-exports like error classes are still allowed).
31
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.
32
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.
@@ -46,12 +52,11 @@
46
52
  Schema.Struct({
47
53
  userId: Schema.optional(Id("users")),
48
54
  text: Schema.String,
49
- })
55
+ }),
50
56
  );
51
57
  ```
52
58
 
53
59
  Codegen emits, alongside it:
54
-
55
60
  - `_generated/schema.ts`—the runtime `DatabaseSchema`. Never imports `convex/server`, so a runtime cold start no longer evaluates `defineSchema(...)`.
56
61
  - `_generated/convexSchema.ts`—the Convex deploy `SchemaDefinition`, re-exported from `convex/schema.ts`.
57
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.
@@ -71,7 +76,7 @@
71
76
  name: "list",
72
77
  args: Schema.Struct({}),
73
78
  returns: Schema.Array(Notes.Doc),
74
- })
79
+ }),
75
80
  );
76
81
  ```
77
82
 
@@ -90,7 +95,7 @@
90
95
  name: "list",
91
96
  args: () => Schema.Struct({}),
92
97
  returns: () => Schema.Array(notes.Doc),
93
- })
98
+ }),
94
99
  );
95
100
  ```
96
101
 
@@ -101,14 +106,13 @@
101
106
  const list = FunctionImpl.make(databaseSchema, notes, "list", handler);
102
107
  export default GroupImpl.make(databaseSchema, notes).pipe(
103
108
  Layer.provide(list),
104
- GroupImpl.finalize
109
+ GroupImpl.finalize,
105
110
  );
106
111
  ```
107
112
 
108
113
  ### Node functions are first-class
109
114
 
110
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.
111
-
112
116
  - A Node group at `confect/email.spec.ts` is now reached at `refs.public.email.send` instead of `refs.public.node.email.send`.
113
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.
114
118
 
@@ -125,7 +129,6 @@
125
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.
126
130
 
127
131
  ### Migration
128
-
129
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`.
130
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"`.
131
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).
@@ -213,7 +216,6 @@
213
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.
214
217
 
215
218
  Codegen now scans `confect/tables/*.ts` (every file must default-export a `Table`) and emits two siblings:
216
-
217
219
  - `confect/_generated/schema.ts` — the runtime `DatabaseSchema`, consumed by `_generated/api.ts`. Imports `@confect/server` but never `convex/server`.
218
220
  - `confect/_generated/convexSchema.ts` — the Convex deploy `SchemaDefinition`, re-exported one-line from `convex/schema.ts`. Imports `convex/server` but never `@confect/server`.
219
221
 
@@ -226,7 +228,6 @@
226
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.
227
229
 
228
230
  Codegen now emits two new sets of files alongside `_generated/schema.ts` and `_generated/convexSchema.ts`:
229
-
230
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")`.
231
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`.
232
233
 
@@ -243,7 +244,6 @@
243
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).
244
245
 
245
246
  ### Migration
246
-
247
247
  1. Delete your `confect/schema.ts`. Codegen will refuse to run while a stray copy is present.
248
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.
249
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`:
@@ -395,7 +395,7 @@
395
395
 
396
396
  export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
397
397
  "NoteNotFound",
398
- { noteId: GenericId.GenericId("notes") }
398
+ { noteId: GenericId.GenericId("notes") },
399
399
  ) {}
400
400
 
401
401
  export const notes = GroupSpec.make("notes").addFunction(
@@ -404,7 +404,7 @@
404
404
  args: Schema.Struct({ noteId: GenericId.GenericId("notes") }),
405
405
  returns: Notes.Doc,
406
406
  error: NoteNotFound,
407
- })
407
+ }),
408
408
  );
409
409
  ```
410
410
 
@@ -424,7 +424,7 @@
424
424
  .table("notes")
425
425
  .get(noteId)
426
426
  .pipe(Effect.mapError(() => new NoteNotFound({ noteId })));
427
- })
427
+ }),
428
428
  );
429
429
  ```
430
430
 
@@ -496,7 +496,6 @@
496
496
  Unspecified failures continue to reject the promise.
497
497
 
498
498
  ### Migration
499
-
500
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).
501
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.
502
501