@webpieces/rules-config 0.4.869 → 0.4.870

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/rules-config",
3
- "version": "0.4.869",
3
+ "version": "0.4.870",
4
4
  "description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -19,9 +19,9 @@
19
19
  "inversify": "7.10.4",
20
20
  "reflect-metadata": "0.2.2",
21
21
  "minimatch": "10.0.1",
22
- "@webpieces/tooling-common": "0.4.869",
23
- "@webpieces/repo-workflow-core": "0.4.869",
24
- "@webpieces/rules-sdk": "0.4.869"
22
+ "@webpieces/tooling-common": "0.4.870",
23
+ "@webpieces/repo-workflow-core": "0.4.870",
24
+ "@webpieces/rules-sdk": "0.4.870"
25
25
  },
26
26
  "author": "Dean Hiller",
27
27
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "devDependencies": {
37
- "@webpieces/tooling-testkit": "0.4.869"
37
+ "@webpieces/tooling-testkit": "0.4.870"
38
38
  },
39
39
  "types": "./src/index.d.ts",
40
40
  "bin": {
@@ -140,36 +140,57 @@ Instead of importing, receive the dependency as a constructor or method paramete
140
140
  - The best dependency is the one you don't need
141
141
  - When in doubt, refactor rather than add dependencies
142
142
 
143
- ## Canonical runtime client migration
143
+ ## Canonical runtime client registration
144
144
 
145
- For every owner tagged `webpieces` or `webpieces-lib`, keep topology in `src/wiring.ts`
146
- and replace supported hand-written singleton/provider factories with the public helpers:
145
+ For every owner tagged `webpieces` or `webpieces-lib`, keep topology in `src/wiring.ts`. Each
146
+ `BindModule.configure(binder: Binder)` registers clients through its host's binder, replacing
147
+ hand-written singleton/provider factories:
147
148
 
148
149
  ```typescript
149
- // @webpieces/http-client-node (filters remain the optional fourth argument)
150
- const clients = new RuntimeClients(options);
151
- clients.bindRpc(TOKEN, SaveApi, 'save', filters);
150
+ // Node: Binder from @webpieces/http-routing. The token defaults to the API class itself.
151
+ binder.createRpcClientAndBind(SaveApi, 'save');
152
+ binder.createRpcClientAndBind(SaveApi, 'save-eu', new ClientBindOptions<SaveApi>(SAVE_EU, filters));
153
+ binder.createPubSubClientAndBind(TaskApi, 'worker');
154
+ binder.bindExternal(TextToSpeechApi, GcpTextToSpeechClient);
155
+
156
+ // Browser: Binder from @webpieces/http-client-browser (no filter argument is supported)
157
+ binder.createRpcClientAndBind(SaveApi, 'save');
158
+ binder.provide(new BrowserValueProvider(MutableContextStore, new MutableContextStore()));
159
+ ```
160
+
161
+ Supply `ClientBindOptions` / `PubSubBindOptions` with a `token` only when two clients of the same
162
+ API must coexist; filters ride on `ClientBindOptions` for RPC clients. `bindExternal(Api,
163
+ VendorImpl)` binds a vendor implementation AND records the external-contract graph edge.
164
+ `RuntimeClients`, `RuntimeTaskClients`, `provideRpcClient`, `ExternalContractUse`, `ClientToken`,
165
+ `BrowserBindings` and `BindingModule` no longer exist; `getBindingModules` / `getRoutingModules`
166
+ are now `getBindModules` / `getRouteModules`, and `runtime-deps.json` uses `bindModules` /
167
+ `routeModules`. `RouteModule` is Node-only; a browser Wiring has no route channel.
152
168
 
153
- // @webpieces/cloudtasks-client (no filter argument is supported)
154
- new RuntimeTaskClients(options).bindPubSub(TASK_TOKEN, TaskApi, 'worker');
169
+ Each owner's `src/wiring.ts` shows its actual wiring: the Wiring/AppWiring class AND the named
170
+ BindModule and RouteModule classes it selects, with their real registrations (`binder.bind`
171
+ chains, `binder.createRpcClientAndBind`, `binder.createPubSubClientAndBind`, `binder.bindExternal`,
172
+ browser `binder.provide` recipes, `addRoutes`, `addFilter`) in their `configure` methods. The rule
173
+ is OWNER-canonical: an AppWiring may select a BindModule declared in a library owner's canonical
174
+ `src/wiring.ts` (resolved by symbol, so a barrel re-export is fine), and a library's canonical
175
+ wiring.ts may export only BindModules:
155
176
 
156
- // @webpieces/http-client-browser (no filter argument is supported)
157
- provideRpcClient(BROWSER_TOKEN, SaveApi, 'save');
177
+ ```typescript
178
+ getBindModules(): BindModule[] {
179
+ return [new RemoteFsdbBindModule(), new GcpTtsBindModule(this.config.tts)];
180
+ }
158
181
  ```
159
182
 
160
- Each owner's `src/wiring.ts` shows its actual wiring: the Wiring/AppWiring class AND the named
161
- BindingModule and RouteModule classes it selects, with their real registrations (`bindRpc`,
162
- `provideRpcClient`, `bindPubSub`, `addRoutes`, `addFilter`, DI binds and provider recipes) in their
163
- `configure` methods. A selected module declared in any other file is rejected. Runtime extraction
164
- reads only canonical `wiring.ts` files; an AppWiring brings in a library through that library's
165
- Wiring, whose modules live in the library's own `wiring.ts`.
183
+ A selected module declared in any other file, or a `ContainerModule`, is rejected naming the module
184
+ and the file. A vendor `ContainerModule` loaded with `.load(options)` is no longer a registration:
185
+ give the vendor library a canonical wiring.ts with its own BindModule. Runtime extraction reads only
186
+ canonical `wiring.ts` files.
166
187
 
167
188
  The wiring-format rule checks canonical `src/wiring.ts` in every participating tagged owner,
168
189
  including unchanged projects outside the diff, and never format-checks other files. Select modules
169
- with literal arrays of named instances; only AppWiring selects library Wirings. Set maxLines
170
- explicitly (the agreed limit is 400). Preserve each existing token, API, deployment and supported
171
- filter list. Registration remains lazy and singleton; test overrides must still avoid resolving the
172
- production factory. Keep configuration building, translations, environment discovery and
173
- initializer or factory bodies in imported implementations, and reference them by name from the
174
- registration that stays visible in `wiring.ts`. Review the resulting runtime declaration candidates
175
- and qualified API/deployment relationships before updating approvals.
190
+ with literal arrays of named instances; only AppWiring selects library Wirings or another owner's
191
+ BindModules. Set maxLines explicitly (the agreed limit is 400). Preserve each existing token, API,
192
+ deployment and supported filter list. Registration remains lazy and singleton; test overrides must
193
+ still avoid resolving the production factory. Keep configuration building, translations,
194
+ environment discovery and initializer or factory bodies in imported implementations, and reference
195
+ them by name from the registration that stays visible in `wiring.ts`. Review the resulting runtime
196
+ declaration candidates and qualified API/deployment relationships before updating approvals.