@chidchanun/bcp 0.1.25 → 0.1.26

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
@@ -1,16 +1,12 @@
1
1
  # BCP Framework Documentation Source
2
2
 
3
- The `docs/` directory is the documentation source of truth for BCP Framework and is intentionally organized so it can be consumed later by the **`bcp-docs-web`** documentation website.
3
+ The `docs/` directory is the documentation source of truth for BCP Framework and is intentionally organized for the future **`bcp-docs-web`** website.
4
4
 
5
- > **Documentation target:** BCP Framework `0.1.25`
5
+ > **Documentation target:** BCP Framework `0.1.26`
6
6
  >
7
- > The documentation target can be newer than the version currently published to npm. Unreleased behavior must be labeled as a development target until release validation and publication are complete.
7
+ > **Release state:** release-candidate source. Do not label `0.1.26` as published until RC validation and npm publication complete.
8
8
 
9
- ## Documentation goals
10
-
11
- The documentation source should make it possible to build `bcp-docs-web` without duplicating framework knowledge into a second repository.
12
-
13
- The expected relationship is:
9
+ ## Documentation flow
14
10
 
15
11
  ```text
16
12
  BCP Framework source/tests
@@ -20,28 +16,27 @@ BCP Framework source/tests
20
16
  bcp-docs-web
21
17
  ```
22
18
 
23
- Framework source and tests remain authoritative for behavior. Markdown under `docs/` is the authored documentation layer. The future website should primarily render, organize and search this source instead of becoming a separate source of truth.
19
+ Framework source and tests are authoritative for behavior. Markdown under `docs/` is the authored documentation layer. `bcp-docs-web` should render, organize and search these sources instead of becoming a competing source of truth.
24
20
 
25
- ## Content update rule
21
+ ## Update rule
26
22
 
27
23
  When framework behavior changes:
28
24
 
29
25
  1. Update framework source.
30
- 2. Add or update regression tests.
31
- 3. Update the matching documentation file under `docs/`.
32
- 4. Update the release note under `docs/releases/` when the change belongs to a release milestone.
33
- 5. Only present the feature as published after release validation and npm publication complete.
26
+ 2. Add/update regression tests.
27
+ 3. Update the matching file under `docs/`.
28
+ 4. Update `docs/releases/<version>.md`.
29
+ 5. Change release state to published only after npm publication succeeds.
34
30
 
35
31
  ## Recommended `bcp-docs-web` navigation
36
32
 
37
- The website should use these top-level groups:
38
-
39
33
  ```text
40
34
  Getting Started
41
35
  Routing & Data
42
36
  Authentication
43
37
  Database
44
38
  Runtime & Infrastructure
39
+ Storage & Uploads
45
40
  API Reference
46
41
  Releases
47
42
  ```
@@ -51,10 +46,10 @@ Releases
51
46
  | Website route | Markdown source | Purpose |
52
47
  | --- | --- | --- |
53
48
  | `/docs/getting-started` | `getting-started.md` | Create and run a BCP application |
54
- | `/docs/configuration` | `configuration.md` | Framework configuration and environment behavior |
55
- | `/docs/application-modules` | `application-modules.md` | Client/server boundaries and module rules |
49
+ | `/docs/configuration` | `configuration.md` | Framework configuration/environment |
50
+ | `/docs/application-modules` | `application-modules.md` | Client/server boundaries |
56
51
  | `/docs/deployment` | `deployment.md` | Standalone production deployment |
57
- | `/docs/updating` | `updating.md` | Framework upgrade workflow |
52
+ | `/docs/updating` | `updating.md` | Framework upgrades |
58
53
 
59
54
  ### Routing & Data
60
55
 
@@ -63,12 +58,10 @@ Releases
63
58
  | `/docs/routing` | `routing.md` | File-based page/API routing |
64
59
  | `/docs/server-data-loaders` | `server-data-loaders.md` | Server-side page data |
65
60
  | `/docs/route-guards` | `route-guards.md` | Scoped route authorization |
66
- | `/docs/form-actions` | `form-actions.md` | Server mutations and forms |
61
+ | `/docs/form-actions` | `form-actions.md` | Server mutations/forms |
67
62
  | `/docs/server-request-apis` | `server-request-apis.md` | Request/cookie/response APIs |
68
63
  | `/docs/validation` | `validation.md` | Typed validation |
69
64
  | `/docs/error-handling` | `error-handling.md` | Structured HTTP errors |
70
- | `/docs/file-upload` | `file-upload.md` | Multipart parsing and upload validation |
71
- | `/docs/storage` | `storage.md` | Storage adapters and production file delivery |
72
65
 
73
66
  ### Authentication
74
67
 
@@ -83,7 +76,7 @@ Releases
83
76
  | Website route | Markdown source | Purpose |
84
77
  | --- | --- | --- |
85
78
  | `/docs/database` | `database.md` | MySQL database primitives |
86
- | `/docs/database-migrations` | `database-migrations.md` | Migration CLI and migration files |
79
+ | `/docs/database-migrations` | `database-migrations.md` | Migration CLI/files |
87
80
 
88
81
  ### Runtime & Infrastructure
89
82
 
@@ -91,14 +84,20 @@ Releases
91
84
  | --- | --- | --- |
92
85
  | `/docs/middleware` | `middleware.md` | Middleware System v2 |
93
86
  | `/docs/hydration` | `hydration.md` | SSR/client hydration parity |
94
- | `/docs/developer-tools` | `developer-tools.md` | `doctor` and `inspect` diagnostics |
95
- | `/docs/development-logging` | `development-logging.md` | Structured logging and observability |
96
- | `/docs/caching` | `caching.md` | Cache and revalidation |
97
- | `/docs/security` | `security.md` | Security defaults and request body limits |
87
+ | `/docs/developer-tools` | `developer-tools.md` | `doctor` / `inspect` |
88
+ | `/docs/development-logging` | `development-logging.md` | Logging/observability |
89
+ | `/docs/caching` | `caching.md` | Cache/revalidation |
90
+ | `/docs/security` | `security.md` | Security/body limits |
98
91
 
99
- ## API Reference grouping
92
+ ### Storage & Uploads
93
+
94
+ | Website route | Markdown source | Purpose |
95
+ | --- | --- | --- |
96
+ | `/docs/file-upload` | `file-upload.md` | Buffered + streaming multipart uploads |
97
+ | `/docs/storage` | `storage.md` | StorageAdapter, streaming and file delivery |
98
+ | `/docs/s3-storage` | `s3-storage.md` | S3-compatible adapter/configuration |
100
99
 
101
- `bcp-docs-web` can derive an API-reference navigation layer from the authored guides.
100
+ ## API Reference ownership
102
101
 
103
102
  Recommended entrypoint groups:
104
103
 
@@ -114,14 +113,10 @@ bcp/config
114
113
  bcp/middleware
115
114
  ```
116
115
 
117
- The first version of the website does not need generated TypeDoc-style reference pages. It can begin by linking APIs to the guide that owns them, then add generated symbol-level reference later if useful.
118
-
119
- Suggested ownership:
120
-
121
116
  | Entrypoint | Primary guide |
122
117
  | --- | --- |
123
118
  | `bcp` | `routing.md`, `server-data-loaders.md`, `form-actions.md` |
124
- | `bcp/server` | `server-request-apis.md`, `file-upload.md`, `storage.md`, `development-logging.md` |
119
+ | `bcp/server` | `server-request-apis.md`, `file-upload.md`, `storage.md`, `s3-storage.md`, `development-logging.md` |
125
120
  | `bcp/auth` | `authentication.md`, `auth-route-guards.md` |
126
121
  | `bcp/database` | `database.md`, `database-migrations.md` |
127
122
  | `bcp/validation` | `validation.md` |
@@ -134,48 +129,43 @@ Suggested ownership:
134
129
 
135
130
  ### Application
136
131
 
137
- - React SSR and hydration
132
+ - React SSR/hydration
138
133
  - file-based page/API routing
139
- - dynamic routes
140
- - catch-all and optional catch-all routes
141
- - route groups
142
- - layouts and metadata
134
+ - static/dynamic/catch-all/optional-catch-all routes
135
+ - route groups/layouts/metadata
143
136
  - SPA navigation
144
- - server data loaders
145
- - route guards
146
- - form actions
137
+ - loaders/guards/form actions
147
138
  - client islands / partial hydration
148
139
  - Fast Refresh
149
- - deterministic development hydration
150
140
 
151
141
  ### Server
152
142
 
153
- - request-scoped server APIs
154
- - request IDs
155
- - cookies and redirects
156
- - JWT sessions
157
- - authentication helpers
143
+ - request-scoped APIs/cookies/redirects/request IDs
144
+ - JWT sessions/authentication
158
145
  - Middleware System v2
159
- - typed validation
160
- - structured errors
146
+ - validation/structured errors
161
147
  - structured logging
162
- - multipart file uploads
163
- - upload validation
164
- - storage adapter contract
165
- - local filesystem storage adapter
166
- - production file delivery
167
- - validators and byte ranges
148
+ - response caching/security gateway
149
+
150
+ ### Storage & Uploads
151
+
152
+ - buffered multipart `FormData` upload APIs
153
+ - production streaming multipart upload (`storeMultipartFile()`)
154
+ - `StorageAdapter` contract
155
+ - local filesystem adapter
156
+ - S3-compatible adapter
157
+ - streaming reads/writes
158
+ - byte ranges
159
+ - ETag/Last-Modified file delivery
160
+ - upload/storage limits and abort cleanup
168
161
 
169
162
  ### Database
170
163
 
171
164
  - `bcp/database`
172
165
  - lazy MySQL pool
173
- - prepared execution
174
- - query helpers
166
+ - prepared execution/query helpers
175
167
  - transactions
176
- - migrations
177
- - migration status
178
- - rollback
168
+ - migrations/status/rollback
179
169
 
180
170
  ### Developer Experience
181
171
 
@@ -183,108 +173,68 @@ Suggested ownership:
183
173
  - `bcp update`
184
174
  - `bcp doctor`
185
175
  - `bcp inspect`
186
- - route inspection
187
- - `bcp-framework` Windows-safe CLI alias
176
+ - Windows-safe `bcp-framework` alias
188
177
  - standalone production build
189
- - unit/integration/E2E/package tests
190
- - release/package smoke checks
178
+ - unit/integration/E2E/package/RC checks
191
179
 
192
- ## BCP 0.1.25 documentation focus
180
+ ## BCP 0.1.26 documentation focus
193
181
 
194
- ### Storage adapters
182
+ ### Storage streaming
195
183
 
196
- BCP `0.1.25` introduces the first application-facing storage abstraction through `bcp/server`:
184
+ Public additions include:
197
185
 
198
186
  ```ts
199
187
  import {
200
- createLocalStorage,
201
- createStorageResponse,
202
- normalizeStorageKey,
203
- StorageError,
204
- storeUploadedFile,
188
+ getStorageCapabilities,
189
+ putStorageStream,
190
+ readStorageStream,
205
191
  } from "bcp/server";
206
192
  ```
207
193
 
208
- The documentation must make these boundaries clear:
209
-
210
- - `StorageAdapter` is the application-facing contract.
211
- - `createLocalStorage()` is the built-in adapter in this milestone.
212
- - storage keys are logical relative paths, not operating-system paths.
213
- - absolute paths and traversal segments are rejected.
214
- - overwrite is opt-in.
215
- - local metadata persists content type and SHA-256 identity.
216
- - `createStorageResponse()` supports `GET` and `HEAD`.
217
- - validators include ETag and Last-Modified behavior.
218
- - single byte ranges are supported.
219
- - multiple ranges are intentionally unsupported in `0.1.25` and return `416`.
220
- - the default cache policy is private/revalidate.
221
- - public caching must be explicit.
222
- - storage keys do not replace authentication or authorization.
223
-
224
- See `storage.md`.
225
-
226
- ### File Upload
227
-
228
- BCP `0.1.24` introduced:
229
-
230
- - multipart parsing,
231
- - request/file size limits,
232
- - MIME allowlists,
233
- - extension allowlists,
234
- - required/optional file fields,
235
- - safe local file names,
236
- - traversal protection,
237
- - overwrite protection,
238
- - SHA-256 metadata.
239
-
240
- Those APIs remain supported in `0.1.25`.
241
-
242
- `storeUploadedFile()` is the bridge between a validated multipart `File` and a `StorageAdapter`.
243
-
244
- See:
245
-
246
- - `file-upload.md`
247
- - `storage.md`
248
-
249
- ### Production auth guard stabilization
250
-
251
- The `0.1.24` stabilization cycle unified standalone guard/action authentication imports with the active request-context runtime.
252
-
253
- This prevents production-only failures where APIs such as `cookies()`, `getSession()`, `requireAuth()` or `requireRole()` could see a different request-context instance after bundling.
254
-
255
- ### Development route graph synchronization
194
+ Streaming methods remain optional on custom adapters for `0.1.25` compatibility.
256
195
 
257
- The `0.1.24` stabilization cycle also fixed a development graph drift where the route scanner could see a new route while the incremental client bundle graph still represented the previous topology.
196
+ ### S3-compatible storage
258
197
 
259
- The development gateway now compares the actual page route graph and refreshes the internal client bundler when pathname/page/layout topology changes.
198
+ ```ts
199
+ import {
200
+ createS3Storage,
201
+ } from "bcp/server";
202
+ ```
260
203
 
261
- ### Logging and observability
204
+ Document:
262
205
 
263
- BCP `0.1.23` introduced:
206
+ - bucket/region/endpoint setup,
207
+ - optional explicit credentials,
208
+ - AWS default credential chain behavior,
209
+ - `forcePathStyle` for compatible services such as MinIO,
210
+ - prefix handling,
211
+ - multipart streaming,
212
+ - ranges/ETag metadata,
213
+ - overwrite limitations for concurrent multipart writers,
214
+ - server-only credential/security requirements.
264
215
 
265
- - `logger`,
266
- - `createLogger()`,
267
- - request-scoped `requestLogger()`,
268
- - log levels,
269
- - pretty/JSON formats,
270
- - request IDs,
271
- - structured development request logging,
272
- - SSR/import debug timing.
216
+ See `s3-storage.md`.
273
217
 
274
- See `development-logging.md`.
218
+ ### Production multipart streaming
275
219
 
276
- ### Developer tools
220
+ ```ts
221
+ import {
222
+ storeMultipartFile,
223
+ } from "bcp/server";
224
+ ```
277
225
 
278
- BCP `0.1.22` introduced:
226
+ Document:
279
227
 
280
- - `bcp doctor`,
281
- - `bcp inspect`,
282
- - JSON diagnostic output,
283
- - duplicate React detection,
284
- - duplicate BCP installation protection,
285
- - Windows-safe `bcp-framework` CLI alias.
228
+ - one named streamed file field per operation,
229
+ - total request limit,
230
+ - per-file limit,
231
+ - MIME/extension validation,
232
+ - fixed/callback storage keys,
233
+ - AbortSignal behavior,
234
+ - direct local/S3 streaming,
235
+ - difference from `request.formData()` / buffered APIs.
286
236
 
287
- See `developer-tools.md`.
237
+ See `file-upload.md`.
288
238
 
289
239
  ## CLI commands
290
240
 
@@ -306,7 +256,7 @@ bcp db status
306
256
  bcp db rollback
307
257
  ```
308
258
 
309
- On Windows systems where Microsoft SQL Server owns `bcp.exe`, direct project-local commands should prefer:
259
+ On Windows, direct project-local commands should prefer:
310
260
 
311
261
  ```powershell
312
262
  npm exec -- bcp-framework doctor
@@ -315,9 +265,9 @@ npm exec -- bcp-framework dev
315
265
  npm exec -- bcp-framework build
316
266
  ```
317
267
 
318
- Inside npm scripts, `bcp` remains safe because npm prepends `node_modules/.bin` to `PATH`.
268
+ Inside npm scripts, `bcp` is safe because npm prepends `node_modules/.bin` to `PATH`.
319
269
 
320
- ## Release documentation
270
+ ## Releases
321
271
 
322
272
  Release notes live under:
323
273
 
@@ -325,18 +275,17 @@ Release notes live under:
325
275
  docs/releases/
326
276
  ```
327
277
 
328
- Recommended website release routes:
278
+ Recommended routes:
329
279
 
330
280
  ```text
281
+ /releases/0.1.26
331
282
  /releases/0.1.25
332
283
  /releases/0.1.24
333
284
  /releases/0.1.23
334
285
  /releases/0.1.22
335
- /releases/0.1.21
336
- /releases/0.1.20
337
286
  ```
338
287
 
339
- The website should display a clear release state for each version:
288
+ Use one of these release states:
340
289
 
341
290
  ```text
342
291
  published
@@ -344,11 +293,9 @@ release candidate
344
293
  unreleased development target
345
294
  ```
346
295
 
347
- Do not infer publication state only from the existence of a Markdown release note.
348
-
349
- ## Suggested `bcp-docs-web` content model
296
+ The existence of a release note alone does not mean the npm version is published.
350
297
 
351
- A future website can represent each Markdown page with metadata similar to:
298
+ ## Suggested website model
352
299
 
353
300
  ```ts
354
301
  interface DocPage {
@@ -364,94 +311,85 @@ interface DocPage {
364
311
  }
365
312
  ```
366
313
 
367
- The metadata does not need to live in frontmatter immediately. The first implementation can use a route manifest in the docs website and consume Markdown files directly.
314
+ The first `bcp-docs-web` implementation can keep this mapping in a route manifest and consume Markdown directly.
368
315
 
369
316
  ## Suggested website features
370
317
 
371
- The first useful version of `bcp-docs-web` should prioritize:
372
-
373
- 1. Sidebar navigation generated from the route/source map.
374
- 2. Markdown rendering with syntax highlighting.
375
- 3. Previous/next page navigation.
376
- 4. Version/development-target banner.
377
- 5. Release note pages.
378
- 6. Search across Markdown content.
318
+ 1. Sidebar navigation from this source map.
319
+ 2. Markdown rendering + syntax highlighting.
320
+ 3. Previous/next navigation.
321
+ 4. Version/release-state banner.
322
+ 5. Release pages.
323
+ 6. Full-text search.
379
324
  7. Copy buttons for code blocks.
380
325
  8. Mobile navigation.
381
- 9. Direct GitHub source/edit links.
326
+ 9. GitHub source/edit links.
382
327
 
383
- Later additions can include:
328
+ Later:
384
329
 
385
- - generated API symbol reference,
386
- - versioned documentation snapshots,
387
- - interactive examples,
388
- - framework playgrounds,
330
+ - generated symbol reference,
331
+ - versioned snapshots,
332
+ - interactive examples/playgrounds,
389
333
  - release comparison pages.
390
334
 
391
335
  ## Source conventions
392
336
 
393
- For documentation intended for the website:
394
-
395
- - use one H1 per source page,
396
- - keep heading hierarchy stable,
397
- - use fenced code blocks with language tags,
398
- - use relative repository links for other docs,
399
- - keep API names exactly aligned with public exports,
400
- - distinguish current behavior from roadmap plans,
401
- - include security limitations next to the API they affect,
402
- - prefer runnable examples over pseudo APIs,
403
- - avoid documenting private/internal modules as public APIs.
404
-
405
- ## Stable vs development documentation
406
-
407
- `main` can contain documentation for the next release before npm publication.
408
-
409
- Therefore the website must distinguish:
410
-
411
- ```text
412
- Documentation target != necessarily current npm stable version
413
- ```
414
-
415
- For example, while `0.1.25` is under release validation, `docs/storage.md` can describe the `0.1.25` development target, but the website should not label it as published until the release is actually available.
337
+ - one H1 per page,
338
+ - stable heading hierarchy,
339
+ - fenced code blocks with language tags,
340
+ - relative links between docs,
341
+ - exact public API names,
342
+ - clear stable/RC/roadmap labels,
343
+ - security limitations next to affected APIs,
344
+ - runnable examples where possible,
345
+ - no private/internal modules presented as public API.
416
346
 
417
347
  ## Release validation
418
348
 
419
- Before publishing a framework release:
349
+ Before publishing:
420
350
 
421
351
  ```bash
422
352
  npm run typecheck
423
353
  npm run test:unit
354
+ npm run test:integration
424
355
  npm run test:e2e
425
356
  npm run test:package
426
357
  npm run rc:check
427
358
  ```
428
359
 
429
- Release validation should include packed-package smoke verification and representative production application testing.
360
+ For `0.1.26`, package validation must also confirm the staged npm artifact contains:
430
361
 
431
- ## Documentation QA checklist
362
+ ```text
363
+ @aws-sdk/client-s3
364
+ @aws-sdk/lib-storage
365
+ busboy
366
+ ```
432
367
 
433
- Before a docs release or website sync:
368
+ and the S3/multipart streaming source files/public exports.
369
+
370
+ ## Documentation QA checklist
434
371
 
435
- - all linked Markdown files exist,
372
+ - linked Markdown files exist,
436
373
  - examples use public exports,
437
- - version numbers are current,
438
- - unreleased features are labeled correctly,
439
- - Windows CLI instructions use the safe alias where needed,
440
- - security caveats are present for uploads/storage/authentication,
374
+ - version/release states are current,
375
+ - Windows direct CLI examples use `npm exec -- bcp-framework`,
376
+ - upload/storage/auth security caveats are present,
441
377
  - route names match the current router,
442
378
  - release notes match the framework version,
443
- - no generated `.bcp-framework` paths are presented as user-authored source files.
379
+ - S3 credentials are never shown as public browser variables,
380
+ - roadmap APIs are not presented as published guarantees.
444
381
 
445
- ## Roadmap
382
+ ## Next direction after 0.1.26
446
383
 
447
- After `0.1.25`, the current planned framework direction is:
384
+ Recommended `0.1.27` direction:
448
385
 
449
- 1. S3-compatible / cloud storage integration.
450
- 2. Production upload streaming.
451
- 3. Broader storage adapter ecosystem.
452
- 4. Additional production hardening.
386
+ - signed URLs where needed,
387
+ - object listing/copy/move capabilities,
388
+ - broader production hardening,
389
+ - graceful shutdown/resource cleanup,
390
+ - stronger storage/provider diagnostics.
453
391
 
454
- These are roadmap items, not published API guarantees.
392
+ These are roadmap items, not `0.1.26` guarantees.
455
393
 
456
394
  ## Repository authority
457
395
 
@@ -465,4 +403,4 @@ docs
465
403
  release notes
466
404
  ```
467
405
 
468
- `bcp-docs-web` should be treated as the presentation/search/navigation layer for this content rather than a competing documentation source.
406
+ `bcp-docs-web` is the presentation/search/navigation layer for this content.