@chidchanun/bcp 0.2.12 → 0.2.14

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/docs/README.md CHANGED
@@ -2,14 +2,12 @@
2
2
 
3
3
  The `docs/` directory is the documentation source of truth for BCP Framework and is organized for **`bcp-docs-web`**.
4
4
 
5
- > **Documentation target:** BCP Framework `0.2.12Transactional Outbox & Events`
5
+ > **Documentation target:** BCP Framework `0.2.14Testing Platform`
6
6
  >
7
7
  > **Release state:** unreleased development target until RC validation, tagging and npm publication complete.
8
8
 
9
9
  ## Documentation architecture
10
10
 
11
- BCP uses three machine-readable contracts:
12
-
13
11
  ```text
14
12
  docs/docs-web-manifest.json
15
13
  -> website navigation, routes, Markdown sources and release routes
@@ -40,54 +38,65 @@ Framework source and tests remain authoritative for runtime behavior.
40
38
  | `0.2.10` | Durable Jobs Platform |
41
39
  | `0.2.11` | Workflow Orchestration |
42
40
  | `0.2.12` | Transactional Outbox & Events |
41
+ | `0.2.13` | Realtime Platform |
42
+ | `0.2.14` | Testing Platform |
43
43
 
44
- ## 0.2.12Transactional Outbox & Events
44
+ ## 0.2.14Testing Platform
45
45
 
46
- `0.2.12` adds the server-only `bcp/events` public entrypoint.
46
+ `0.2.14` adds the server-only `bcp/testing` public entrypoint.
47
47
 
48
48
  Primary APIs:
49
49
 
50
50
  ```ts
51
51
  import {
52
- createEventBus,
53
- createMemoryOutboxStore,
54
- createOutboxDispatcher,
55
- createOutboxMigrationSql,
56
- createSqlOutboxStore,
57
- createTransactionalOutbox,
58
- } from "bcp/events";
52
+ createFakeClock,
53
+ createJobTestHarness,
54
+ createOutboxTestHarness,
55
+ createRealtimeTestHarness,
56
+ createRealtimeTestSocket,
57
+ createRouteTestHandler,
58
+ createSequenceIdFactory,
59
+ createTestApp,
60
+ createTestAuthSession,
61
+ createWorkflowTestHarness,
62
+ expectResponse,
63
+ readSseEvents,
64
+ runTestMiddleware,
65
+ withTestTransaction,
66
+ } from "bcp/testing";
59
67
  ```
60
68
 
61
- The central write model is:
69
+ Testing model:
62
70
 
63
71
  ```text
64
- BCP Database transaction
65
- |
66
- +-- business data
67
- +-- SQL outbox event
68
- |
69
- COMMIT
70
- |
71
- v
72
- Outbox Dispatcher
73
- |
74
- +-- bcp/jobs
75
- +-- custom publisher
76
- +-- local EventBus
72
+ node:test / Vitest / Jest / other runner
73
+ |
74
+ v
75
+ bcp/testing
76
+ |
77
+ +----------+-----------+
78
+ | | |
79
+ Request Database Infrastructure
80
+ Route rollback jobs/workflow
81
+ Response tx outbox/realtime
82
+ Auth SSE/socket
83
+ Middleware
77
84
  ```
78
85
 
79
- `createSqlOutboxStore()` supports MySQL, PostgreSQL and SQLite and writes the event using the caller-provided `TransactionDatabase`. The dispatcher adds leasing, stale recovery, retry/backoff and terminal failure handling after commit.
86
+ The helpers use existing BCP runtime contracts rather than defining a parallel mock framework. Signed auth sessions use the production session token implementation; middleware tests execute the real onion pipeline; job/workflow/outbox/realtime harnesses wrap their actual platform APIs.
87
+
88
+ BCP does not add a Jest or Vitest dependency.
80
89
 
81
- New/updated documentation sources:
90
+ New/updated sources:
82
91
 
83
92
  | Source | Purpose |
84
93
  | --- | --- |
85
- | `transactional-outbox-events.md` | Transactional publishing, SQL migration, dispatcher lifecycle and delivery guarantees |
86
- | `api-reference.md` | `bcp/events` public APIs |
87
- | `platform-manifest.json` | Events capability flags and public entrypoint |
88
- | `api-manifest.json` | `bcp/events` source/guide ownership |
89
- | `docs-web-manifest.json` | Outbox docs navigation and `0.2.12` release route |
90
- | `releases/0.2.12.md` | Transactional Outbox & Events release notes |
94
+ | `testing-platform.md` | Request, auth, database, middleware, jobs, workflow, outbox, realtime and SSE testing |
95
+ | `api-reference.md` | `bcp/testing` public APIs |
96
+ | `platform-manifest.json` | Testing capability flags and public entrypoint |
97
+ | `api-manifest.json` | `bcp/testing` source/guide ownership |
98
+ | `docs-web-manifest.json` | Testing docs navigation and `0.2.14` release route |
99
+ | `releases/0.2.14.md` | Testing Platform release notes |
91
100
 
92
101
  ## Update rule
93
102
 
@@ -107,16 +116,15 @@ When framework behavior or public surface changes:
107
116
  | Website route | Markdown source |
108
117
  | --- | --- |
109
118
  | `/docs/authentication` | `authentication.md` |
110
- | `/docs/authorization-security` | `authorization-security.md` |
111
119
  | `/docs/observability` | `observability.md` |
112
120
  | `/docs/background-jobs` | `background-jobs.md` |
113
- | `/docs/job-scheduling` | `job-scheduling.md` |
114
121
  | `/docs/durable-jobs` | `durable-jobs.md` |
115
122
  | `/docs/workflow-orchestration` | `workflow-orchestration.md` |
116
123
  | `/docs/transactional-outbox-events` | `transactional-outbox-events.md` |
117
- | `/docs/database` | `database.md` |
124
+ | `/docs/realtime-platform` | `realtime-platform.md` |
125
+ | `/docs/testing-platform` | `testing-platform.md` |
118
126
  | `/docs/api-reference` | `api-reference.md` |
119
- | `/releases/0.2.12` | `releases/0.2.12.md` |
127
+ | `/releases/0.2.14` | `releases/0.2.14.md` |
120
128
 
121
129
  Every route/source pair is validated by unit tests.
122
130
 
@@ -134,6 +142,8 @@ bcp/auth
134
142
  bcp/jobs
135
143
  bcp/workflow
136
144
  bcp/events
145
+ bcp/realtime
146
+ bcp/testing
137
147
  bcp/observability
138
148
  bcp/server
139
149
  bcp/server-only
@@ -144,7 +154,7 @@ The API-manifest entrypoint set must match the platform public-entrypoint set ex
144
154
 
145
155
  ## Release validation
146
156
 
147
- Before publishing `0.2.12`:
157
+ Before publishing `0.2.14`:
148
158
 
149
159
  ```bash
150
160
  npm run typecheck
@@ -155,20 +165,6 @@ npm run test:package
155
165
  npm run rc:check
156
166
  ```
157
167
 
158
- Transactional Outbox & Events validation covers:
159
-
160
- - transaction-bound SQL outbox insertion,
161
- - queue handoff,
162
- - custom/event-bus delivery,
163
- - retry and terminal failure,
164
- - dispatcher lease recovery,
165
- - MySQL/PostgreSQL/SQLite migration generation,
166
- - server-only browser boundary enforcement,
167
- - compiled `events.mjs` package execution,
168
- - docs/platform/API version parity.
168
+ Testing Platform validation covers request/route behavior, cookie persistence, signed auth sessions, rollback transactions, middleware execution, deterministic clocks/IDs, job/workflow/outbox/realtime harnesses, SSE parsing, server-only boundaries, compiled `testing.mjs` execution and docs/platform/API parity.
169
169
 
170
170
  The final release tag must point to the exact commit that passed the complete RC sequence.
171
-
172
- ## Repository authority
173
-
174
- The framework repository remains authoritative for source, public exports, tests, Markdown docs, manifests and release notes. `bcp-docs-web` remains the presentation/search/navigation layer.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "framework": "bcp",
4
- "version": "0.2.12",
4
+ "version": "0.2.14",
5
5
  "releaseState": "unreleased",
6
6
  "coverage": "public-entrypoints",
7
7
  "entrypoints": [
@@ -11,12 +11,7 @@
11
11
  "environment": "universal",
12
12
  "route": "/docs/api-reference#bcp",
13
13
  "summary": "React application APIs for routing, links, forms, loader/guard data, islands, metadata and route error handling.",
14
- "guides": [
15
- "/docs/routing",
16
- "/docs/server-data-loaders",
17
- "/docs/route-guards",
18
- "/docs/form-actions"
19
- ]
14
+ "guides": ["/docs/routing", "/docs/server-data-loaders", "/docs/route-guards", "/docs/form-actions", "/docs/testing-platform"]
20
15
  },
21
16
  {
22
17
  "package": "bcp/island",
@@ -24,9 +19,7 @@
24
19
  "environment": "universal",
25
20
  "route": "/docs/api-reference#bcp-island",
26
21
  "summary": "Partial-hydration island creation and island loading strategy types.",
27
- "guides": [
28
- "/docs/hydration"
29
- ]
22
+ "guides": ["/docs/hydration"]
30
23
  },
31
24
  {
32
25
  "package": "bcp/cache",
@@ -34,9 +27,7 @@
34
27
  "environment": "server-preferred",
35
28
  "route": "/docs/api-reference#bcp-cache",
36
29
  "summary": "Cache, deduplication, statistics and path/tag revalidation primitives.",
37
- "guides": [
38
- "/docs/caching"
39
- ]
30
+ "guides": ["/docs/caching"]
40
31
  },
41
32
  {
42
33
  "package": "bcp/config",
@@ -44,10 +35,7 @@
44
35
  "environment": "server",
45
36
  "route": "/docs/api-reference#bcp-config",
46
37
  "summary": "Typed BCP configuration, environment-schema validation and configuration diagnostics APIs.",
47
- "guides": [
48
- "/docs/configuration",
49
- "/docs/environment-validation"
50
- ]
38
+ "guides": ["/docs/configuration", "/docs/environment-validation"]
51
39
  },
52
40
  {
53
41
  "package": "bcp/validation",
@@ -55,9 +43,7 @@
55
43
  "environment": "universal",
56
44
  "route": "/docs/api-reference#bcp-validation",
57
45
  "summary": "Typed validators, parse helpers and structured validation errors.",
58
- "guides": [
59
- "/docs/validation"
60
- ]
46
+ "guides": ["/docs/validation"]
61
47
  },
62
48
  {
63
49
  "package": "bcp/error",
@@ -65,9 +51,7 @@
65
51
  "environment": "universal",
66
52
  "route": "/docs/api-reference#bcp-error",
67
53
  "summary": "Structured HTTP error creation, classification and response helpers.",
68
- "guides": [
69
- "/docs/error-handling"
70
- ]
54
+ "guides": ["/docs/error-handling"]
71
55
  },
72
56
  {
73
57
  "package": "bcp/database",
@@ -75,11 +59,7 @@
75
59
  "environment": "server",
76
60
  "route": "/docs/api-reference#bcp-database",
77
61
  "summary": "Provider-neutral MySQL, PostgreSQL and SQLite query, transaction, lifecycle and migration primitives.",
78
- "guides": [
79
- "/docs/database",
80
- "/docs/database-migrations",
81
- "/docs/transactional-outbox-events"
82
- ]
62
+ "guides": ["/docs/database", "/docs/database-migrations", "/docs/transactional-outbox-events", "/docs/testing-platform"]
83
63
  },
84
64
  {
85
65
  "package": "bcp/auth",
@@ -87,13 +67,7 @@
87
67
  "environment": "server",
88
68
  "route": "/docs/api-reference#bcp-auth",
89
69
  "summary": "Authentication Platform v2 plus permission checks, authorization policies and auth/guest/role/permission route guards.",
90
- "guides": [
91
- "/docs/authentication",
92
- "/docs/auth-session-store",
93
- "/docs/auth-route-guards",
94
- "/docs/authorization-security",
95
- "/docs/session-auth"
96
- ]
70
+ "guides": ["/docs/authentication", "/docs/auth-session-store", "/docs/auth-route-guards", "/docs/authorization-security", "/docs/session-auth", "/docs/testing-platform"]
97
71
  },
98
72
  {
99
73
  "package": "bcp/jobs",
@@ -101,13 +75,7 @@
101
75
  "environment": "server",
102
76
  "route": "/docs/api-reference#bcp-jobs",
103
77
  "summary": "Background queues and schedules with visibility leases, heartbeats, stale recovery, DLQ maintenance and Redis-compatible durable adapters.",
104
- "guides": [
105
- "/docs/background-jobs",
106
- "/docs/job-scheduling",
107
- "/docs/durable-jobs",
108
- "/docs/transactional-outbox-events",
109
- "/docs/observability"
110
- ]
78
+ "guides": ["/docs/background-jobs", "/docs/job-scheduling", "/docs/durable-jobs", "/docs/transactional-outbox-events", "/docs/realtime-platform", "/docs/testing-platform", "/docs/observability"]
111
79
  },
112
80
  {
113
81
  "package": "bcp/workflow",
@@ -115,11 +83,7 @@
115
83
  "environment": "server",
116
84
  "route": "/docs/api-reference#bcp-workflow",
117
85
  "summary": "Persistent workflow orchestration with sequential and parallel steps, retries, delays, compensation, run leases and optional durable queue execution.",
118
- "guides": [
119
- "/docs/workflow-orchestration",
120
- "/docs/durable-jobs",
121
- "/docs/observability"
122
- ]
86
+ "guides": ["/docs/workflow-orchestration", "/docs/durable-jobs", "/docs/realtime-platform", "/docs/testing-platform", "/docs/observability"]
123
87
  },
124
88
  {
125
89
  "package": "bcp/events",
@@ -127,12 +91,23 @@
127
91
  "environment": "server",
128
92
  "route": "/docs/api-reference#bcp-events",
129
93
  "summary": "Transactional outbox and event delivery APIs with SQL persistence, dispatcher leases, retries, stale recovery, queue handoff and in-process event bus delivery.",
130
- "guides": [
131
- "/docs/transactional-outbox-events",
132
- "/docs/database",
133
- "/docs/durable-jobs",
134
- "/docs/observability"
135
- ]
94
+ "guides": ["/docs/transactional-outbox-events", "/docs/database", "/docs/durable-jobs", "/docs/realtime-platform", "/docs/testing-platform", "/docs/observability"]
95
+ },
96
+ {
97
+ "package": "bcp/realtime",
98
+ "source": "packages/client/src/realtime.ts",
99
+ "environment": "server",
100
+ "route": "/docs/api-reference#bcp-realtime",
101
+ "summary": "Realtime channels, cross-hub broker delivery, presence, channel authorization, WebSocket adapter integration, heartbeat handling and built-in Server-Sent Events responses.",
102
+ "guides": ["/docs/realtime-platform", "/docs/authentication", "/docs/testing-platform", "/docs/observability"]
103
+ },
104
+ {
105
+ "package": "bcp/testing",
106
+ "source": "packages/client/src/testing.ts",
107
+ "environment": "server",
108
+ "route": "/docs/api-reference#bcp-testing",
109
+ "summary": "Framework-native testing utilities for Request/Response handlers, signed auth sessions, rollback transactions, middleware, jobs, workflows, outbox delivery, realtime sockets and SSE.",
110
+ "guides": ["/docs/testing-platform", "/docs/authentication", "/docs/database", "/docs/durable-jobs", "/docs/workflow-orchestration", "/docs/transactional-outbox-events", "/docs/realtime-platform"]
136
111
  },
137
112
  {
138
113
  "package": "bcp/observability",
@@ -140,10 +115,7 @@
140
115
  "environment": "server",
141
116
  "route": "/docs/api-reference#bcp-observability",
142
117
  "summary": "In-process metrics, Prometheus exposition, request metrics middleware and health/readiness checks.",
143
- "guides": [
144
- "/docs/observability",
145
- "/docs/development-logging"
146
- ]
118
+ "guides": ["/docs/observability", "/docs/development-logging"]
147
119
  },
148
120
  {
149
121
  "package": "bcp/server",
@@ -151,14 +123,7 @@
151
123
  "environment": "server",
152
124
  "route": "/docs/api-reference#bcp-server",
153
125
  "summary": "Request context, cookies, CSRF/same-origin protection, logging, production hardening, upload, storage, response and session APIs.",
154
- "guides": [
155
- "/docs/server-request-apis",
156
- "/docs/authorization-security",
157
- "/docs/file-upload",
158
- "/docs/storage",
159
- "/docs/storage-ecosystem",
160
- "/docs/production-hardening"
161
- ]
126
+ "guides": ["/docs/server-request-apis", "/docs/authorization-security", "/docs/file-upload", "/docs/storage", "/docs/storage-ecosystem", "/docs/production-hardening", "/docs/testing-platform"]
162
127
  },
163
128
  {
164
129
  "package": "bcp/server-only",
@@ -166,9 +131,7 @@
166
131
  "environment": "server-marker",
167
132
  "route": "/docs/api-reference#bcp-server-only",
168
133
  "summary": "Server-only module boundary marker that prevents accidental browser inclusion.",
169
- "guides": [
170
- "/docs/application-modules"
171
- ]
134
+ "guides": ["/docs/application-modules"]
172
135
  },
173
136
  {
174
137
  "package": "bcp/middleware",
@@ -176,9 +139,7 @@
176
139
  "environment": "server",
177
140
  "route": "/docs/api-reference#bcp-middleware",
178
141
  "summary": "Middleware System v2 request/response pipeline types and helpers.",
179
- "guides": [
180
- "/docs/middleware"
181
- ]
142
+ "guides": ["/docs/middleware", "/docs/testing-platform"]
182
143
  }
183
144
  ]
184
145
  }