@stapel/workspaces-react 0.1.0 → 0.4.0

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 (65) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +45 -3
  3. package/dist/api/generated/schema.d.ts +759 -0
  4. package/dist/api/generated/schema.d.ts.map +1 -0
  5. package/dist/api/generated/schema.js +2 -0
  6. package/dist/api/generated/schema.js.map +1 -0
  7. package/dist/api/types.d.ts +22 -6
  8. package/dist/api/types.d.ts.map +1 -1
  9. package/dist/api/workspacesApi.d.ts +3 -3
  10. package/dist/api/workspacesApi.d.ts.map +1 -1
  11. package/dist/api/workspacesApi.js +14 -1
  12. package/dist/api/workspacesApi.js.map +1 -1
  13. package/dist/flows/registry.d.ts +22 -0
  14. package/dist/flows/registry.d.ts.map +1 -0
  15. package/dist/flows/registry.js +20 -0
  16. package/dist/flows/registry.js.map +1 -0
  17. package/dist/headless/Members.d.ts +6 -1
  18. package/dist/headless/Members.d.ts.map +1 -1
  19. package/dist/headless/Members.js +1 -1
  20. package/dist/headless/Members.js.map +1 -1
  21. package/dist/headless/WorkspacesProvider.d.ts +4 -3
  22. package/dist/headless/WorkspacesProvider.d.ts.map +1 -1
  23. package/dist/headless/WorkspacesProvider.js +4 -6
  24. package/dist/headless/WorkspacesProvider.js.map +1 -1
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/model/context.d.ts +6 -9
  30. package/dist/model/context.d.ts.map +1 -1
  31. package/dist/model/context.js +11 -16
  32. package/dist/model/context.js.map +1 -1
  33. package/dist/model/queries.d.ts +6 -4
  34. package/dist/model/queries.d.ts.map +1 -1
  35. package/dist/model/queries.js +8 -5
  36. package/dist/model/queries.js.map +1 -1
  37. package/dist/model/queryKeys.d.ts +2 -0
  38. package/dist/model/queryKeys.d.ts.map +1 -1
  39. package/dist/model/queryKeys.js +3 -0
  40. package/dist/model/queryKeys.js.map +1 -1
  41. package/dist/model/runtime.d.ts +12 -21
  42. package/dist/model/runtime.d.ts.map +1 -1
  43. package/dist/model/runtime.js +2 -14
  44. package/dist/model/runtime.js.map +1 -1
  45. package/llms.txt +3 -3
  46. package/manifest.json +12 -10
  47. package/package.json +5 -4
  48. package/src/analytics/generated/events.json +1 -1
  49. package/src/api/generated/schema.ts +761 -0
  50. package/src/api/types.ts +23 -6
  51. package/src/api/workspacesApi.ts +17 -5
  52. package/src/flows/registry.ts +32 -0
  53. package/src/headless/Members.tsx +7 -2
  54. package/src/headless/WorkspacesProvider.tsx +5 -10
  55. package/src/index.ts +4 -3
  56. package/src/model/context.tsx +16 -17
  57. package/src/model/queries.ts +16 -7
  58. package/src/model/queryKeys.ts +9 -0
  59. package/src/model/runtime.ts +14 -35
  60. package/dist/flows/generated/flows.gen.d.ts +0 -19
  61. package/dist/flows/generated/flows.gen.d.ts.map +0 -1
  62. package/dist/flows/generated/flows.gen.js +0 -23
  63. package/dist/flows/generated/flows.gen.js.map +0 -1
  64. package/src/flows/generated/flows.gen.ts +0 -38
  65. package/src/flows/generated/flows.json +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,83 @@
1
1
  # @stapel/workspaces-react
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b1b327e: Track stapel-workspaces 0.4.x (scheme B; contract pin bumped to the `0.4.1`
8
+ HEAD — G12 anchor pagination for member listing). **Breaking**: `GET
9
+ /{id}/members` is no longer a flat array wrapper — it is now an
10
+ anchor-paginated page (core `AnchorPagination`, the same shape as
11
+ notifications-react's feed), matching the backend's move off unbounded member
12
+ listing:
13
+
14
+ - **`MemberListData`** (the `MemberList` export) now aliases
15
+ `PaginatedMemberResponseList` — `{ items, next_anchor, prev_anchor, has_next,
16
+ has_prev, count }` — instead of `{ members }`. Read `.items` where you used
17
+ to read `.members`.
18
+ - **`useMembers(workspaceId, params?)`** takes an optional second
19
+ `MembersParams` (`{ anchor, direction, limit, search }`, all optional; no
20
+ params fetches the newest page, default limit 100/max 500) and its query key
21
+ now carries those params (`workspacesQueryKeys.membersPage`); the bare
22
+ `workspacesQueryKeys.members(workspaceId)` prefix still invalidates every
23
+ page (mutations unchanged).
24
+ - **`WorkspacesApi.listMembers(workspaceId, params?)`** sends
25
+ `?anchor=&direction=&limit=&search=`.
26
+ - `<Members>` (headless) is unaffected at the call-site level — it still hands
27
+ `children` a flat `members` array (now sourced from the page's `.items`,
28
+ first page only; a follow-up can add pager controls to its bag for consumers
29
+ with >100 members).
30
+
31
+ `backend.contract` is now `>=0.4 <0.5`.
32
+
33
+ ### Patch Changes
34
+
35
+ - 2fa025a: §17 arch-contract-pipeline Wave 2 + Wave 3 — the five original pairs are now
36
+ self-contained per-module contracts, aligned to their backend minor.
37
+
38
+ **Wave 2 (contract isolation).** Each pair generates its typed surface from its
39
+ backend module's OWN committed `docs/{schema,flows}.json` (byte-identical to the
40
+ former monolith slice) instead of the unified monolith aggregate:
41
+
42
+ - `gen:api` emits a package-LOCAL `src/api/generated/schema.ts` per pair (via the
43
+ `API_SCHEMA`/`API_OUT` knobs — the calendar/recordings §17-native shape);
44
+ `api/types.ts` aliases `components` from `./generated/schema.js`, no longer from
45
+ `@stapel/core`. `@stapel/core` stays a RUNTIME peer (client / react-query),
46
+ not the type source.
47
+ - `gen:flows` reads `../stapel-<mod>/docs/flows.json`; `gen:manifest` reads the
48
+ per-module `docs/schema.json`. Public types are unchanged — the repoint is a
49
+ zero-diff source-swap (byte-identity proven), so no consumer breaks.
50
+
51
+ **Wave 3 (version scheme B).** Each pair's minor now tracks its backend minor:
52
+ `auth-react → 0.5.0` (stapel-auth 0.5.x), `notifications-react → 0.3.0`,
53
+ `profiles-react → 0.3.0`, `billing-react → 0.4.0`, `workspaces-react → 0.3.0`.
54
+ `manifest.backend.contract` records the one-minor compatibility window
55
+ (`>=0.5 <0.6` etc.), auto-derived from the backend `pyproject.toml`.
56
+
57
+ - 4e6f442: Internal plumbing swap (slim wave §21/S2) — the pair's stamped
58
+ `model/runtime.ts` / `model/context.tsx` / `headless/<Mod>Provider.tsx`
59
+ boilerplate (byte-identical across the six standard pairs) now binds
60
+ `@stapel/core`'s `createModuleRuntime` / `createModuleContext` factories
61
+ instead of carrying its own copy. Public API preserved exactly: same exported
62
+ names and signatures (`create<Mod>Runtime`, `<Mod>Runtime`,
63
+ `Create<Mod>RuntimeOptions`, `<Mod>RuntimeContext`, `use<Mod>Runtime`,
64
+ `use<Mod>Api`, `use<Mod>Analytics`, `<Mod>Provider>`), same guard-hook error
65
+ messages. No behavior change.
66
+ - c3482e7: README wave (slim wave §21/S4): every pair now documents its setup — a new
67
+ Install + "Wire the app once" section built on core's `<StapelProvider>`
68
+ (previously only auth-react's README showed any wiring, as a 5-level provider
69
+ nest). auth-react's wiring example moves to the one-provider shape with the
70
+ `queryRuntime`/`i18n` escape hatches spelled out.
71
+ - d3232a9: Zero-flow scaffolding removed (slim wave §21/S3). These six backends annotate
72
+ no `@flow_step`, so `gen:flows` now skips emission for them and the pair's
73
+ `src/flows/generated/` files are gone. The public flow surface is preserved
74
+ exactly by a tiny hand-written shim (`src/flows/registry.ts`): `<MOD>_FLOWS`
75
+ (still `{}`), `<Mod>FlowId`/`<Mod>FlowSpec` (still `never`), `FlowEndpoint`,
76
+ and `flowEndpoints` keep their names, types, and behavior. `toFlowError` and
77
+ the core flow-machine re-exports are untouched. No public-surface delta; the
78
+ generated registry returns automatically once the backend documents its first
79
+ flow.
80
+
3
81
  ## 0.1.0
4
82
 
5
83
  ### 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 facade, TanStack Query).
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/" });
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/ createFlowMachine flow machines (+ generated registry)
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` |