@confect/js 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 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# @confect/js
|
|
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).
|
|
@@ -280,7 +281,7 @@
|
|
|
280
281
|
|
|
281
282
|
export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
|
|
282
283
|
"NoteNotFound",
|
|
283
|
-
{ noteId: GenericId.GenericId("notes") }
|
|
284
|
+
{ noteId: GenericId.GenericId("notes") },
|
|
284
285
|
) {}
|
|
285
286
|
|
|
286
287
|
export const notes = GroupSpec.make("notes").addFunction(
|
|
@@ -289,7 +290,7 @@
|
|
|
289
290
|
args: Schema.Struct({ noteId: GenericId.GenericId("notes") }),
|
|
290
291
|
returns: Notes.Doc,
|
|
291
292
|
error: NoteNotFound,
|
|
292
|
-
})
|
|
293
|
+
}),
|
|
293
294
|
);
|
|
294
295
|
```
|
|
295
296
|
|
|
@@ -309,7 +310,7 @@
|
|
|
309
310
|
.table("notes")
|
|
310
311
|
.get(noteId)
|
|
311
312
|
.pipe(Effect.mapError(() => new NoteNotFound({ noteId })));
|
|
312
|
-
})
|
|
313
|
+
}),
|
|
313
314
|
);
|
|
314
315
|
```
|
|
315
316
|
|
|
@@ -381,7 +382,6 @@
|
|
|
381
382
|
Unspecified failures continue to reject the promise.
|
|
382
383
|
|
|
383
384
|
### Migration
|
|
384
|
-
|
|
385
385
|
- 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).
|
|
386
386
|
- 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.
|
|
387
387
|
|
|
@@ -410,7 +410,6 @@
|
|
|
410
410
|
- 2c4b0c9: Fix `HttpClient` to only accept public `Ref`s
|
|
411
411
|
|
|
412
412
|
`HttpClient` query, mutation, and action methods now correctly reject internal `Ref`s at the type level, matching the runtime behavior of Convex browser clients which can only call public functions.
|
|
413
|
-
|
|
414
413
|
- @confect/core@5.0.0
|
|
415
414
|
|
|
416
415
|
## 4.0.0
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@confect/js",
|
|
3
3
|
"description": "JavaScript client bindings for any JS runtime",
|
|
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"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"convex": "^1.32.0",
|
|
45
45
|
"effect": "^3.21.2",
|
|
46
|
-
"@confect/core": "^9.0.
|
|
46
|
+
"@confect/core": "^9.0.2"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|