@rebasepro/codegen 0.21.0 → 0.21.1

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.
Files changed (2) hide show
  1. package/README.md +11 -9
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -9,8 +9,8 @@ pnpm add @rebasepro/codegen
9
9
  ```
10
10
 
11
11
  ESM-only: `"type": "module"` with no CommonJS build, so it is loaded with
12
- `import`. `require()` of it resolves only on Node 22.12+, which supports
13
- `require(esm)`.
12
+ `import`. It needs Node `>=22.22.0` (its `engines` floor), where `require()`
13
+ of it resolves too: Node has supported `require(esm)` since 22.12.
14
14
 
15
15
  ### Dependencies
16
16
 
@@ -45,13 +45,14 @@ This is typically invoked via the CLI (`pnpm rebase generate-sdk`) rather than c
45
45
  *accessor* (`my-notes` → `myNotes`, the property name on `client.data`),
46
46
  alongside a `collectionsDictionary` const mapping each accessor back to the
47
47
  slug the wire uses. Each entry contains:
48
- - `Row` — what a read serves. Column names are the **real** ones, unchanged:
49
- a `created_at` column is `row.created_at`. Nullable columns are `T | null`,
48
+ - `Row` — what a read serves, keyed by each field's **wire** name: a property
49
+ keyed `createdAt` is `row.createdAt` whatever its `columnName` says, and a
50
+ `belongsTo` named `author` gives `row.authorId`. Nullable columns are `T | null`,
50
51
  the primary key is always present, relations appear only when `include`
51
52
  names them, and `excludeFromApi` columns are absent.
52
53
  - `Insert` — what `create()` accepts. Server-assigned ids are optional; a
53
54
  `belongsTo` target may be named either way (`{ author: 5 }` or
54
- `{ author_id: 5 }`); `excludeFromApi` columns are absent here too.
55
+ `{ authorId: 5 }`); `excludeFromApi` columns are absent here too.
55
56
  - `Update` — what `update()` accepts. Everything optional, primary key
56
57
  omitted, `excludeFromApi` columns absent.
57
58
 
@@ -65,10 +66,11 @@ hash as something to read, filter or send.
65
66
 
66
67
  ### Names
67
68
 
68
- Only the collection accessor is transformed. Column names are emitted verbatim,
69
- quoted when they are not valid identifiers (`"user id"?: string | null`), because
70
- `where` and `orderBy` are keyed off `Row` — a renamed column makes the correct
71
- filter fail to compile and the wrong one fail at runtime.
69
+ A property key you wrote is emitted verbatim, quoted when it is not a valid
70
+ identifier (`"user id"?: string | null`), because `where` and `orderBy` are keyed
71
+ off `Row` — a renamed key makes the correct filter fail to compile and the wrong
72
+ one fail at runtime. Only the two derived names are transformed, both to
73
+ camelCase: the collection accessor, and a foreign key that comes from a relation.
72
74
 
73
75
  Generation **fails** rather than emitting a broken file when two slugs would
74
76
  produce the same accessor: the interface would not compile, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebasepro/codegen",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "Generate a typed JS SDK from Rebase collection definitions",
5
5
  "keywords": [
6
6
  "sdk",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "peerDependencies": {
36
- "@rebasepro/types": "0.21.0"
36
+ "@rebasepro/types": "0.21.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@jest/globals": "^30.4.1",
@@ -43,7 +43,7 @@
43
43
  "ts-jest": "^29.4.12",
44
44
  "typescript": "^6.0.3",
45
45
  "vite": "^8.1.5",
46
- "@rebasepro/types": "0.21.0"
46
+ "@rebasepro/types": "0.21.1"
47
47
  },
48
48
  "exports": {
49
49
  ".": {
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "gitHead": "d935eefa5aa8d1009a2398cfac2c1e4ee9aeb6b6",
56
56
  "dependencies": {
57
- "@rebasepro/common": "0.21.0"
57
+ "@rebasepro/common": "0.21.1"
58
58
  },
59
59
  "scripts": {
60
60
  "test": "jest --config jest.config.cjs",