@chidchanun/bcp 0.2.19 → 0.3.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.
@@ -1,8 +1,8 @@
1
1
  # Framework Platform Contract
2
2
 
3
- BCP Framework `0.2.x` exposes an explicit, machine-readable application-platform contract rather than relying on private repository structure.
3
+ BCP Framework exposes an explicit, machine-readable application-platform contract rather than relying on private repository structure.
4
4
 
5
- The current development baseline is **`0.2.19Stability & API Freeze`** and remains unreleased until the complete RC sequence passes, the exact release commit is tagged and npm publication completes.
5
+ The current development baseline is **`0.3.1Dependency Injection & Service Container`** and remains unreleased until the complete RC sequence passes, the exact release commit is tagged and npm publication completes.
6
6
 
7
7
  ## Sources of truth
8
8
 
@@ -14,17 +14,17 @@ docs/api-manifest.json
14
14
  -> public package source/environment/documentation ownership
15
15
 
16
16
  docs/api-freeze-snapshot.json
17
- -> frozen 0.2.19 CLI and prepared npm export contract
17
+ -> reviewed CLI and prepared npm export baseline
18
18
 
19
19
  docs/docs-web-manifest.json
20
20
  -> documentation routes and release navigation
21
21
  ```
22
22
 
23
- Framework source and tests remain authoritative for runtime behavior. The manifests make that supported surface testable during release validation.
23
+ Framework source and tests remain authoritative for runtime behavior.
24
24
 
25
- ## Frozen public entrypoints
25
+ ## Public entrypoints
26
26
 
27
- The `0.2.19` baseline supports:
27
+ The `0.3.1` baseline supports:
28
28
 
29
29
  ```text
30
30
  bcp
@@ -43,18 +43,61 @@ bcp/testing
43
43
  bcp/plugins
44
44
  bcp/observability
45
45
  bcp/deployment
46
+ bcp/container
47
+ bcp/application
46
48
  bcp/server
47
49
  bcp/server-only
48
50
  bcp/middleware
49
51
  ```
50
52
 
51
- Application code should use these entrypoints instead of private `packages/*` implementation paths.
53
+ `bcp/container` is the new entrypoint relative to `0.3.0`. No `0.3.0` public entrypoint is intentionally removed.
52
54
 
53
- The prepared npm package also exposes `./package.json`; that package export is included in the freeze snapshot even though it is not an application API module.
55
+ The prepared package also exposes `./package.json`; it is part of package-export snapshot validation but is not an application API module.
56
+
57
+ ## Application and DI baseline
58
+
59
+ `bcp/application` remains the composition root while `bcp/container` adds typed dependency injection:
60
+
61
+ ```text
62
+ ServiceToken<T>
63
+ value providers
64
+ factory providers
65
+ class providers
66
+ singleton/scoped/transient lifetimes
67
+ child/request scopes
68
+ test overrides
69
+ dependency graph diagnostics
70
+ circular dependency detection
71
+ reverse disposal
72
+ ```
73
+
74
+ Application integration exposes:
75
+
76
+ ```text
77
+ app.container
78
+ app.context.container
79
+ app.register(provider)
80
+ app.createScope(options)
81
+ ```
82
+
83
+ The existing Plugin Platform registry remains available through `app.services` / `context.services` for compatibility.
84
+
85
+ ## Lifecycle contract
86
+
87
+ Application deployment resources start in this order:
88
+
89
+ ```text
90
+ bcp:container
91
+ bcp:plugins
92
+ application resources
93
+ bcp:application
94
+ ```
95
+
96
+ Shutdown reverses that order. This keeps injected dependencies available while workers/resources/plugins stop, then disposes injected services before final application disposal.
54
97
 
55
98
  ## CLI baseline
56
99
 
57
- The frozen command families are:
100
+ The command families remain:
58
101
 
59
102
  ```text
60
103
  bcp dev
@@ -83,21 +126,25 @@ build target: standalone-node
83
126
  package target: standalone-node
84
127
  ```
85
128
 
86
- Prepared server/runtime entrypoints resolve to compiled ESM where required by the package contract. Their exact `types`, `default` and `browser` targets are frozen in `api-freeze-snapshot.json`.
129
+ Prepared npm packages expose compiled server ESM. `0.3.1` adds:
130
+
131
+ ```text
132
+ bcp/container -> container.mjs
133
+ ```
134
+
135
+ and preserves compiled `application.mjs` from `0.3.0`.
87
136
 
88
137
  ## Compatibility policy
89
138
 
90
- For `0.2.19`:
139
+ For `0.3.1`:
91
140
 
92
141
  ```text
93
- previous baseline: 0.2.18
142
+ previous baseline: 0.3.0
94
143
  intentional breaking changes: false
95
- freeze state: frozen
144
+ baseline: dependency-injection-service-container
96
145
  ```
97
146
 
98
- Bug fixes may correct implementation behavior, but they must not silently remove a documented public entrypoint or change its prepared package-resolution/browser-boundary contract.
99
-
100
- Intentional public-platform changes should normally move to `0.3.0` with explicit compatibility metadata and migration documentation.
147
+ Bug fixes must not silently remove a documented entrypoint or change its prepared package-resolution/browser-boundary contract.
101
148
 
102
149
  ## API compatibility gate
103
150
 
@@ -105,16 +152,14 @@ Intentional public-platform changes should normally move to `0.3.0` with explici
105
152
  npm run api:check
106
153
  ```
107
154
 
108
- The gate prepares the publish package, regenerates the current contract in memory and compares it to `docs/api-freeze-snapshot.json`.
155
+ The gate prepares the publish package, regenerates the current contract in memory and compares it with `docs/api-freeze-snapshot.json`.
109
156
 
110
- To intentionally regenerate the snapshot:
157
+ Regenerate the snapshot only for an intentional reviewed baseline change:
111
158
 
112
159
  ```bash
113
160
  npm run api:snapshot
114
161
  ```
115
162
 
116
- Snapshot changes during `0.2.19` require explicit review; regeneration is not a routine fix for a failing compatibility check.
117
-
118
163
  ## Release readiness
119
164
 
120
165
  ```bash
@@ -122,11 +167,11 @@ npm run release:readiness
122
167
  npm run release:readiness:report
123
168
  ```
124
169
 
125
- The readiness gate checks version/lock/manifests parity, compatibility metadata, freeze parity, release docs and stability capabilities. The optional local report is written to `.bcp-framework/release-readiness.json`.
170
+ The readiness gate checks package/lock/manifests parity, the `0.3.0` previous baseline, public entrypoint/API snapshot parity, container/application ownership, release docs and DI/Application capability flags.
126
171
 
127
172
  ## Release validation
128
173
 
129
- Before `0.2.19` is tagged or published:
174
+ Before `0.3.1` is tagged or published:
130
175
 
131
176
  ```bash
132
177
  npm run typecheck
@@ -141,4 +186,4 @@ npm run rc:check
141
186
 
142
187
  `rc:check` must pass on the exact commit used for the release tag.
143
188
 
144
- See [Stability & API Freeze](stability-api-freeze.md) and [Migrating to 0.2.x](migration-0.2.md).
189
+ See [Dependency Injection & Service Container](service-container.md), [Application Platform](application-platform.md), [Migrating to 0.3.x](migration-0.3.md), and the historical [Stability & API Freeze](stability-api-freeze.md).
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "framework": "bcp",
4
- "version": "0.2.19",
4
+ "version": "0.3.1",
5
5
  "releaseState": "unreleased",
6
- "baseline": "stability-api-freeze",
6
+ "baseline": "dependency-injection-service-container",
7
7
  "runtime": {
8
8
  "node": ">=24.11.0",
9
9
  "react": "19",
@@ -27,6 +27,8 @@
27
27
  "bcp/plugins",
28
28
  "bcp/observability",
29
29
  "bcp/deployment",
30
+ "bcp/container",
31
+ "bcp/application",
30
32
  "bcp/server",
31
33
  "bcp/server-only",
32
34
  "bcp/middleware"
@@ -95,6 +97,34 @@
95
97
  "compiledAuthRuntime": true,
96
98
  "compiledServerRuntime": true,
97
99
  "compiledMiddlewareRuntime": true,
100
+ "applicationPlatform": true,
101
+ "applicationDefinitions": true,
102
+ "applicationRuntime": true,
103
+ "applicationConfigSchemas": true,
104
+ "applicationServiceRegistry": true,
105
+ "applicationPluginComposition": true,
106
+ "applicationModuleComposition": true,
107
+ "applicationResourceLifecycle": true,
108
+ "applicationReadiness": true,
109
+ "applicationDiagnostics": true,
110
+ "applicationLifecycleRollback": true,
111
+ "applicationLifecycleIdempotency": true,
112
+ "compiledApplicationRuntime": true,
113
+ "dependencyInjectionContainer": true,
114
+ "typedServiceTokens": true,
115
+ "serviceValueProviders": true,
116
+ "serviceFactoryProviders": true,
117
+ "serviceClassProviders": true,
118
+ "serviceSingletonLifetime": true,
119
+ "serviceScopedLifetime": true,
120
+ "serviceTransientLifetime": true,
121
+ "serviceChildScopes": true,
122
+ "serviceScopeOverrides": true,
123
+ "serviceDependencyGraph": true,
124
+ "serviceCircularDependencyDetection": true,
125
+ "serviceReverseDisposal": true,
126
+ "applicationServiceContainer": true,
127
+ "compiledContainerRuntime": true,
98
128
  "stabilityApiFreeze": true,
99
129
  "apiFreezeSnapshot": true,
100
130
  "apiCompatibilityGate": true,
@@ -230,9 +260,9 @@
230
260
  "s3-compatible"
231
261
  ],
232
262
  "compatibility": {
233
- "previousBaseline": "0.2.18",
263
+ "previousBaseline": "0.3.0",
234
264
  "intentionalBreakingChangesFromPreviousBaseline": false,
235
- "migrationGuide": "migration-0.2.md"
265
+ "migrationGuide": "migration-0.3.md"
236
266
  },
237
267
  "documentation": {
238
268
  "navigationManifest": "docs-web-manifest.json",
@@ -243,6 +273,8 @@
243
273
  "documentationPlatform": "documentation-platform.md",
244
274
  "apiReference": "api-reference.md",
245
275
  "stabilityApiFreeze": "stability-api-freeze.md",
276
+ "applicationPlatform": "application-platform.md",
277
+ "serviceContainer": "service-container.md",
246
278
  "environmentValidation": "environment-validation.md",
247
279
  "applicationPackaging": "application-packaging.md",
248
280
  "authentication": "authentication.md",
@@ -260,7 +292,7 @@
260
292
  "testingPlatform": "testing-platform.md",
261
293
  "pluginModulePlatform": "plugin-module-platform.md",
262
294
  "cachePlatformV2": "cache-platform-v2.md",
263
- "migrationGuide": "migration-0.2.md",
264
- "releaseNotes": "releases/0.2.19.md"
295
+ "migrationGuide": "migration-0.3.md",
296
+ "releaseNotes": "releases/0.3.1.md"
265
297
  }
266
298
  }
@@ -0,0 +1,129 @@
1
+ # BCP Framework 0.3.0 — Application Platform
2
+
3
+ `0.3.0` establishes the first BCP Application Platform baseline on top of the infrastructure and API freeze completed in `0.2.x`.
4
+
5
+ > **Release state:** unreleased until the complete RC gate passes, `v0.3.0` is tagged and both npm packages are published successfully.
6
+
7
+ ## Highlights
8
+
9
+ - Adds the server-only `bcp/application` public entrypoint.
10
+ - Adds `defineApp()` for validated application definitions.
11
+ - Adds `createApp()` for a unified application composition root.
12
+ - Reuses the existing Plugin Platform service registry and hook bus.
13
+ - Reuses existing plugin/module definitions without conversion.
14
+ - Reuses Deployment Platform resources, readiness, diagnostics, signal handling and shutdown hooks.
15
+ - Adds typed application-level config parsing.
16
+ - Adds deterministic application lifecycle ordering.
17
+ - Adds startup rollback and terminal cleanup through the deployment resource graph.
18
+ - Adds concurrent/repeated start and shutdown idempotency coverage.
19
+ - Publishes `application.mjs` as a compiled production runtime.
20
+ - Adds prepared-package smoke coverage for the new entrypoint and lifecycle.
21
+
22
+ ## Public API
23
+
24
+ ```ts
25
+ import {
26
+ ApplicationLifecycleError,
27
+ createApp,
28
+ defineApp,
29
+ } from "bcp/application";
30
+ ```
31
+
32
+ Key types:
33
+
34
+ ```text
35
+ Application
36
+ ApplicationConfigParser
37
+ ApplicationConfigSchema
38
+ ApplicationContext
39
+ ApplicationDefinition
40
+ ApplicationState
41
+ ```
42
+
43
+ ## Application composition
44
+
45
+ ```ts
46
+ const app =
47
+ createApp({
48
+ name: "orders-api",
49
+ version: "1.0.0",
50
+ plugins: [
51
+ authPlugin,
52
+ jobsPlugin,
53
+ ],
54
+ resources: [
55
+ databaseResource,
56
+ workerResource,
57
+ ],
58
+ });
59
+
60
+ await app.start();
61
+ ```
62
+
63
+ The application exposes the shared platform objects directly:
64
+
65
+ ```text
66
+ app.services
67
+ app.hooks
68
+ app.plugins
69
+ app.deployment
70
+ ```
71
+
72
+ Existing provider-native database, cache, job, workflow, event and realtime instances can be stored in the service registry or wrapped in deployment resources as appropriate.
73
+
74
+ ## Lifecycle
75
+
76
+ Startup:
77
+
78
+ ```text
79
+ application.setup
80
+ plugin setup/start
81
+ resources start in registration order
82
+ application.start
83
+ ```
84
+
85
+ Shutdown:
86
+
87
+ ```text
88
+ application.stop
89
+ resources stop in reverse order
90
+ plugin stop/dispose
91
+ application.dispose
92
+ ```
93
+
94
+ Startup failures roll back already-started resources in reverse order.
95
+
96
+ ## Compatibility
97
+
98
+ The `0.2.19` Stability & API Freeze release is the compatibility baseline for `0.3.0`.
99
+
100
+ `0.3.0` intentionally adds:
101
+
102
+ ```text
103
+ bcp/application
104
+ ```
105
+
106
+ No existing `0.2.19` public entrypoint is intentionally removed.
107
+
108
+ The API snapshot/compatibility tooling is updated to establish the reviewed `0.3.0` package baseline after the new entrypoint is added.
109
+
110
+ ## Validation
111
+
112
+ Before tagging:
113
+
114
+ ```bash
115
+ npm run typecheck
116
+ npm run test:unit
117
+ npm run test:integration
118
+ npm run test:e2e
119
+ npm run test:package
120
+ npm run api:check
121
+ npm run release:readiness
122
+ npm run rc:check
123
+ ```
124
+
125
+ Do not publish until these commands pass on the exact final release commit.
126
+
127
+ ## Next milestone
128
+
129
+ `0.3.1 — Dependency Injection & Service Container` is planned to add typed service tokens, singleton/scoped/transient lifetimes, request scopes, factories and testing overrides on top of the shared Application Platform service composition model.
@@ -0,0 +1,116 @@
1
+ # BCP Framework 0.3.1 — Dependency Injection & Service Container
2
+
3
+ **State:** unreleased
4
+
5
+ `0.3.1` adds typed dependency injection to the Application Platform without removing the Plugin Platform service registry introduced in `0.2.x`.
6
+
7
+ ## Highlights
8
+
9
+ - new server-only `bcp/container` public entrypoint;
10
+ - typed `ServiceToken<T>` values;
11
+ - value, factory and class providers;
12
+ - singleton, scoped and transient lifetimes;
13
+ - child/request scopes;
14
+ - scope-local provider overrides for tests;
15
+ - dependency graph diagnostics;
16
+ - circular dependency detection;
17
+ - reverse-order disposal and aggregate disposal errors;
18
+ - concurrent/repeated disposal idempotency;
19
+ - `createApp()` integration through `providers`, `container`, `register()` and `createScope()`;
20
+ - compiled `container.mjs` production runtime;
21
+ - server-only browser poison boundary;
22
+ - unit and prepared-package smoke coverage.
23
+
24
+ ## Public APIs
25
+
26
+ ```text
27
+ createServiceToken
28
+ createServiceContainer
29
+ provideValue
30
+ provideFactory
31
+ provideClass
32
+ ServiceNotFoundError
33
+ ServiceResolutionError
34
+ ServiceDisposalError
35
+ ```
36
+
37
+ Important types:
38
+
39
+ ```text
40
+ ServiceToken<T>
41
+ ServiceProvider<T>
42
+ ServiceLifetime
43
+ ServiceFactoryContext
44
+ ServiceContainer
45
+ ServiceScope
46
+ ServiceScopeOptions
47
+ ServiceGraphNode
48
+ ```
49
+
50
+ ## Application Platform changes
51
+
52
+ `ApplicationDefinition` now accepts:
53
+
54
+ ```ts
55
+ providers?: readonly ServiceProvider<any>[];
56
+ ```
57
+
58
+ `Application` and `ApplicationContext` now expose:
59
+
60
+ ```text
61
+ container
62
+ ```
63
+
64
+ Applications can also call:
65
+
66
+ ```text
67
+ app.register(provider)
68
+ app.createScope(options)
69
+ ```
70
+
71
+ The existing `app.services` / `context.services` Plugin Platform registry remains supported for compatibility.
72
+
73
+ ## Lifecycle
74
+
75
+ The application deployment chain now starts the DI container resource before the plugin host and application infrastructure. Shutdown reverses the chain so disposable injected services remain alive until application/plugin/resource shutdown completes.
76
+
77
+ ## Compatibility
78
+
79
+ Previous baseline:
80
+
81
+ ```text
82
+ 0.3.0
83
+ ```
84
+
85
+ Intentional breaking changes:
86
+
87
+ ```text
88
+ false
89
+ ```
90
+
91
+ `0.3.1` is additive. Existing `0.3.0` applications do not need to adopt dependency injection immediately.
92
+
93
+ ## Packaging
94
+
95
+ Prepared npm packages expose:
96
+
97
+ ```text
98
+ bcp/container -> packages/client/src/container.mjs
99
+ ```
100
+
101
+ with TypeScript declarations sourced from `packages/client/src/container.ts` and browser builds redirected to the server-only poison module.
102
+
103
+ ## Validation
104
+
105
+ Before publication run the complete framework RC sequence on the final commit:
106
+
107
+ ```bash
108
+ npm run typecheck
109
+ npm run test:unit
110
+ npm run test:integration
111
+ npm run test:e2e
112
+ npm run test:package
113
+ npm run api:check
114
+ npm run release:readiness
115
+ npm run rc:check
116
+ ```