@stapel/workspaces-react 0.1.0 → 0.4.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.
- package/CHANGELOG.md +90 -0
- package/README.md +45 -3
- package/dist/api/generated/schema.d.ts +759 -0
- package/dist/api/generated/schema.d.ts.map +1 -0
- package/dist/api/generated/schema.js +2 -0
- package/dist/api/generated/schema.js.map +1 -0
- package/dist/api/types.d.ts +22 -6
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/workspacesApi.d.ts +3 -3
- package/dist/api/workspacesApi.d.ts.map +1 -1
- package/dist/api/workspacesApi.js +14 -1
- package/dist/api/workspacesApi.js.map +1 -1
- package/dist/flows/registry.d.ts +22 -0
- package/dist/flows/registry.d.ts.map +1 -0
- package/dist/flows/registry.js +20 -0
- package/dist/flows/registry.js.map +1 -0
- package/dist/headless/Members.d.ts +6 -1
- package/dist/headless/Members.d.ts.map +1 -1
- package/dist/headless/Members.js +1 -1
- package/dist/headless/Members.js.map +1 -1
- package/dist/headless/WorkspacesProvider.d.ts +5 -4
- package/dist/headless/WorkspacesProvider.d.ts.map +1 -1
- package/dist/headless/WorkspacesProvider.js +5 -7
- package/dist/headless/WorkspacesProvider.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/context.d.ts +6 -9
- package/dist/model/context.d.ts.map +1 -1
- package/dist/model/context.js +11 -16
- package/dist/model/context.js.map +1 -1
- package/dist/model/queries.d.ts +6 -4
- package/dist/model/queries.d.ts.map +1 -1
- package/dist/model/queries.js +8 -5
- package/dist/model/queries.js.map +1 -1
- package/dist/model/queryKeys.d.ts +2 -0
- package/dist/model/queryKeys.d.ts.map +1 -1
- package/dist/model/queryKeys.js +3 -0
- package/dist/model/queryKeys.js.map +1 -1
- package/dist/model/runtime.d.ts +12 -21
- package/dist/model/runtime.d.ts.map +1 -1
- package/dist/model/runtime.js +2 -14
- package/dist/model/runtime.js.map +1 -1
- package/llms.txt +14 -14
- package/manifest.json +34 -32
- package/package.json +5 -4
- package/src/analytics/generated/events.json +1 -1
- package/src/api/generated/schema.ts +761 -0
- package/src/api/types.ts +23 -6
- package/src/api/workspacesApi.ts +17 -5
- package/src/flows/registry.ts +32 -0
- package/src/headless/Members.tsx +7 -2
- package/src/headless/WorkspacesProvider.tsx +6 -11
- package/src/index.ts +4 -3
- package/src/model/context.tsx +16 -17
- package/src/model/queries.ts +16 -7
- package/src/model/queryKeys.ts +9 -0
- package/src/model/runtime.ts +14 -35
- package/dist/flows/generated/flows.gen.d.ts +0 -19
- package/dist/flows/generated/flows.gen.d.ts.map +0 -1
- package/dist/flows/generated/flows.gen.js +0 -23
- package/dist/flows/generated/flows.gen.js.map +0 -1
- package/src/flows/generated/flows.gen.ts +0 -38
- package/src/flows/generated/flows.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
# @stapel/workspaces-react
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ae57230: v1 canon sweep §60 (api-versioning.md §2, §6): regenerated schema.ts /
|
|
8
|
+
flows / manifest / llms.txt against the backends' `/…/api/v1/` contracts;
|
|
9
|
+
gen scripts and manifest tag prefixes repointed to `/api/v1/`; documented
|
|
10
|
+
`baseUrl` examples and the auth QR same-origin guard now use
|
|
11
|
+
`/<mod>/api/v1/`. Public TS types unchanged — only the fetch base / path
|
|
12
|
+
literals carry the new version segment. Mount your runtimes at
|
|
13
|
+
`/<mod>/api/v1/`.
|
|
14
|
+
|
|
15
|
+
## 0.4.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- b1b327e: Track stapel-workspaces 0.4.x (scheme B; contract pin bumped to the `0.4.1`
|
|
20
|
+
HEAD — G12 anchor pagination for member listing). **Breaking**: `GET
|
|
21
|
+
/{id}/members` is no longer a flat array wrapper — it is now an
|
|
22
|
+
anchor-paginated page (core `AnchorPagination`, the same shape as
|
|
23
|
+
notifications-react's feed), matching the backend's move off unbounded member
|
|
24
|
+
listing:
|
|
25
|
+
|
|
26
|
+
- **`MemberListData`** (the `MemberList` export) now aliases
|
|
27
|
+
`PaginatedMemberResponseList` — `{ items, next_anchor, prev_anchor, has_next,
|
|
28
|
+
has_prev, count }` — instead of `{ members }`. Read `.items` where you used
|
|
29
|
+
to read `.members`.
|
|
30
|
+
- **`useMembers(workspaceId, params?)`** takes an optional second
|
|
31
|
+
`MembersParams` (`{ anchor, direction, limit, search }`, all optional; no
|
|
32
|
+
params fetches the newest page, default limit 100/max 500) and its query key
|
|
33
|
+
now carries those params (`workspacesQueryKeys.membersPage`); the bare
|
|
34
|
+
`workspacesQueryKeys.members(workspaceId)` prefix still invalidates every
|
|
35
|
+
page (mutations unchanged).
|
|
36
|
+
- **`WorkspacesApi.listMembers(workspaceId, params?)`** sends
|
|
37
|
+
`?anchor=&direction=&limit=&search=`.
|
|
38
|
+
- `<Members>` (headless) is unaffected at the call-site level — it still hands
|
|
39
|
+
`children` a flat `members` array (now sourced from the page's `.items`,
|
|
40
|
+
first page only; a follow-up can add pager controls to its bag for consumers
|
|
41
|
+
with >100 members).
|
|
42
|
+
|
|
43
|
+
`backend.contract` is now `>=0.4 <0.5`.
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 2fa025a: §17 arch-contract-pipeline Wave 2 + Wave 3 — the five original pairs are now
|
|
48
|
+
self-contained per-module contracts, aligned to their backend minor.
|
|
49
|
+
|
|
50
|
+
**Wave 2 (contract isolation).** Each pair generates its typed surface from its
|
|
51
|
+
backend module's OWN committed `docs/{schema,flows}.json` (byte-identical to the
|
|
52
|
+
former monolith slice) instead of the unified monolith aggregate:
|
|
53
|
+
|
|
54
|
+
- `gen:api` emits a package-LOCAL `src/api/generated/schema.ts` per pair (via the
|
|
55
|
+
`API_SCHEMA`/`API_OUT` knobs — the calendar/recordings §17-native shape);
|
|
56
|
+
`api/types.ts` aliases `components` from `./generated/schema.js`, no longer from
|
|
57
|
+
`@stapel/core`. `@stapel/core` stays a RUNTIME peer (client / react-query),
|
|
58
|
+
not the type source.
|
|
59
|
+
- `gen:flows` reads `../stapel-<mod>/docs/flows.json`; `gen:manifest` reads the
|
|
60
|
+
per-module `docs/schema.json`. Public types are unchanged — the repoint is a
|
|
61
|
+
zero-diff source-swap (byte-identity proven), so no consumer breaks.
|
|
62
|
+
|
|
63
|
+
**Wave 3 (version scheme B).** Each pair's minor now tracks its backend minor:
|
|
64
|
+
`auth-react → 0.5.0` (stapel-auth 0.5.x), `notifications-react → 0.3.0`,
|
|
65
|
+
`profiles-react → 0.3.0`, `billing-react → 0.4.0`, `workspaces-react → 0.3.0`.
|
|
66
|
+
`manifest.backend.contract` records the one-minor compatibility window
|
|
67
|
+
(`>=0.5 <0.6` etc.), auto-derived from the backend `pyproject.toml`.
|
|
68
|
+
|
|
69
|
+
- 4e6f442: Internal plumbing swap (slim wave §21/S2) — the pair's stamped
|
|
70
|
+
`model/runtime.ts` / `model/context.tsx` / `headless/<Mod>Provider.tsx`
|
|
71
|
+
boilerplate (byte-identical across the six standard pairs) now binds
|
|
72
|
+
`@stapel/core`'s `createModuleRuntime` / `createModuleContext` factories
|
|
73
|
+
instead of carrying its own copy. Public API preserved exactly: same exported
|
|
74
|
+
names and signatures (`create<Mod>Runtime`, `<Mod>Runtime`,
|
|
75
|
+
`Create<Mod>RuntimeOptions`, `<Mod>RuntimeContext`, `use<Mod>Runtime`,
|
|
76
|
+
`use<Mod>Api`, `use<Mod>Analytics`, `<Mod>Provider>`), same guard-hook error
|
|
77
|
+
messages. No behavior change.
|
|
78
|
+
- c3482e7: README wave (slim wave §21/S4): every pair now documents its setup — a new
|
|
79
|
+
Install + "Wire the app once" section built on core's `<StapelProvider>`
|
|
80
|
+
(previously only auth-react's README showed any wiring, as a 5-level provider
|
|
81
|
+
nest). auth-react's wiring example moves to the one-provider shape with the
|
|
82
|
+
`queryRuntime`/`i18n` escape hatches spelled out.
|
|
83
|
+
- d3232a9: Zero-flow scaffolding removed (slim wave §21/S3). These six backends annotate
|
|
84
|
+
no `@flow_step`, so `gen:flows` now skips emission for them and the pair's
|
|
85
|
+
`src/flows/generated/` files are gone. The public flow surface is preserved
|
|
86
|
+
exactly by a tiny hand-written shim (`src/flows/registry.ts`): `<MOD>_FLOWS`
|
|
87
|
+
(still `{}`), `<Mod>FlowId`/`<Mod>FlowSpec` (still `never`), `FlowEndpoint`,
|
|
88
|
+
and `flowEndpoints` keep their names, types, and behavior. `toFlowError` and
|
|
89
|
+
the core flow-machine re-exports are untouched. No public-surface delta; the
|
|
90
|
+
generated registry returns automatically once the backend documents its first
|
|
91
|
+
flow.
|
|
92
|
+
|
|
3
93
|
## 0.1.0
|
|
4
94
|
|
|
5
95
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -5,18 +5,60 @@ Headless React flow pair for stapel-workspaces: typed API client, TanStack Query
|
|
|
5
5
|
Headless React flow pair for **stapel-workspaces** (frontend-standard §2). Business +
|
|
6
6
|
state only, zero visual opinion — any design layers on top. Built on
|
|
7
7
|
`@stapel/core` (typed client + `StapelApiError` envelope, token refresh,
|
|
8
|
-
verification-403 interception, i18n engine, analytics
|
|
8
|
+
verification-403 interception, i18n engine, analytics seam, TanStack Query).
|
|
9
9
|
|
|
10
10
|
Scaffolded by `stapel-new-react-lib`. See `MODULE.md` for the layer map, machine
|
|
11
11
|
table, extension seams, and persist policy.
|
|
12
12
|
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
pnpm add @stapel/workspaces-react @stapel/core @tanstack/react-query react
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Wire the app once
|
|
20
|
+
|
|
21
|
+
One `<StapelProvider>` for the whole app (core's config + query + i18n in a
|
|
22
|
+
single component — slim wave §21/S4), one `<WorkspacesProvider>` for this pair:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { createI18n, StapelProvider } from "@stapel/core";
|
|
26
|
+
import {
|
|
27
|
+
createWorkspacesRuntime,
|
|
28
|
+
WorkspacesProvider,
|
|
29
|
+
registerWorkspacesI18n,
|
|
30
|
+
} from "@stapel/workspaces-react";
|
|
31
|
+
|
|
32
|
+
const runtime = createWorkspacesRuntime({ baseUrl: "/workspaces/api/v1/" });
|
|
33
|
+
const i18n = createI18n({ locale: "en" });
|
|
34
|
+
registerWorkspacesI18n(i18n); // the pair's key bundle → core's engine
|
|
35
|
+
|
|
36
|
+
export function Root({ children }: { children: React.ReactNode }) {
|
|
37
|
+
return (
|
|
38
|
+
<StapelProvider client={runtime.client} i18n={i18n} cacheVersion="0.1.0">
|
|
39
|
+
<WorkspacesProvider runtime={runtime}>{children}</WorkspacesProvider>
|
|
40
|
+
</StapelProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Hooks and headless components work anywhere below `<WorkspacesProvider>`
|
|
46
|
+
(`useWorkspacesApi`, the query/mutation hooks, the render-prop components — see
|
|
47
|
+
`MODULE.md`). Already wired a `<StapelProvider>` for another pair (or
|
|
48
|
+
auth-react)? Keep the ONE provider: pass this runtime's client as a
|
|
49
|
+
per-module override — `clients={{ workspaces: runtime.client }}` — and nest
|
|
50
|
+
`<WorkspacesProvider>` next to your other pair providers. The individual core
|
|
51
|
+
providers (`StapelConfigProvider` + `QueryClientProvider` + `I18nProvider`)
|
|
52
|
+
remain exported for bespoke composition.
|
|
53
|
+
|
|
13
54
|
## Layers
|
|
14
55
|
|
|
15
56
|
```
|
|
16
57
|
src/
|
|
17
58
|
api/ typed client — thin adapter over @stapel/core `components`
|
|
18
59
|
model/ query keys, runtime wiring, context/hooks
|
|
19
|
-
flows/
|
|
60
|
+
flows/ toFlowError + zero-flow registry shim (machines + generated
|
|
61
|
+
registry arrive with the backend's first @flow_step)
|
|
20
62
|
headless/ renderless components (WorkspacesProvider, flow render-props)
|
|
21
63
|
i18n/ translation keys + generated backend error map
|
|
22
64
|
analytics/ generated typed-event registry (events.json)
|
|
@@ -27,7 +69,7 @@ demo/ first-class demos (compiled, product-linted, smoke-rendered)
|
|
|
27
69
|
|
|
28
70
|
| Surface | Path | Gate |
|
|
29
71
|
|---|---|---|
|
|
30
|
-
| Flow registry | `src/flows/generated/` | `pnpm gen:flows:check` |
|
|
72
|
+
| Flow registry | none — zero-flow module (`src/flows/registry.ts` shim); `gen:flows` emits `src/flows/generated/` once the backend documents flows | `pnpm gen:flows:check` |
|
|
31
73
|
| Backend error map + en bundle | `src/i18n/generated/` | `pnpm gen:errors:check` |
|
|
32
74
|
| Typed-event registry | `src/analytics/generated/events.json` | `pnpm gen:events:check` |
|
|
33
75
|
| Demos → Ladle stories | `demo/generated/` | `pnpm gen:demos:check` |
|