|
| 1 | +--- |
| 2 | +"@objectstack/spec": major |
| 3 | +--- |
| 4 | + |
| 5 | +Resolve the `Session` dual source — `./api` keeps the bare names, the `./identity` declaration is removed (#4641) |
| 6 | + |
| 7 | +`Session` and `SessionSchema` were each declared **twice**, once on |
| 8 | +`@objectstack/spec/api` and once on `@objectstack/spec/identity`. Which shape a |
| 9 | +consumer got depended only on which entry point they imported from — the #4411 |
| 10 | +trap — and the two did not even agree on field names, so the mistake surfaced as |
| 11 | +a runtime `undefined`, not a type error. |
| 12 | + |
| 13 | +**FROM → TO** |
| 14 | + |
| 15 | +| Import | Before | After | |
| 16 | +|:--|:--|:--| |
| 17 | +| `@objectstack/spec/api` | `Session` / `SessionSchema` | unchanged — this is now the only declaration | |
| 18 | +| `@objectstack/spec/identity` | `Session` / `SessionSchema` (a second, different shape) | **removed** | |
| 19 | + |
| 20 | +The surviving `./api` shape is the wire contract: |
| 21 | + |
| 22 | +```ts |
| 23 | +{ id: string; expiresAt: string; token?: string; ipAddress?: string; userAgent?: string; userId: string } |
| 24 | +``` |
| 25 | + |
| 26 | +It is embedded in `SessionResponseSchema`, the body served for |
| 27 | +`AuthEndpointPaths.getSession` (`/get-session`, `/me`, `/refresh`). |
| 28 | + |
| 29 | +The removed `./identity` shape was |
| 30 | +`{ id, sessionToken, userId, activeOrganizationId?, expires, createdAt, updatedAt, ipAddress?, userAgent?, fingerprint? }`. |
| 31 | + |
| 32 | +**Nothing consumes it.** An import-statement-level scan across framework, `cloud` |
| 33 | +and `objectui` found no importer outside its own unit test, and it was wired into |
| 34 | +no parent schema. It had also drifted from the record it claimed to describe: the |
| 35 | +**enforced** session row is the `sys_session` object in |
| 36 | +`@objectstack/platform-objects`, which spells the columns `token` and |
| 37 | +`expires_at` (matching `./api`, not `./identity`) and has no `fingerprint` at all. |
| 38 | + |
| 39 | +**If you were importing `Session` from `@objectstack/spec/identity`**, change the |
| 40 | +specifier to `@objectstack/spec/api` and rename the fields you read: |
| 41 | +`sessionToken` → `token`, `expires` → `expiresAt`. `createdAt` / `updatedAt` / |
| 42 | +`activeOrganizationId` / `fingerprint` are not on the wire shape — read the |
| 43 | +persisted record through the `sys_session` object, which is what the migration |
| 44 | +and the auth plugin actually enforce. |
| 45 | + |
| 46 | +Reference docs follow the declaration: `Session` is now documented on the |
| 47 | +`references/api/auth` page (the module that declares it) instead of the |
| 48 | +name-collision page `references/api/identity`, which is removed. |
0 commit comments