@owlmeans/client-context 0.1.18-rc.2 → 0.1.18-rc.21

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/README.md CHANGED
@@ -12,7 +12,7 @@ Client-side context factory extending `BasicContext` with API client and service
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/client-context
15
+ bun add @owlmeans/client-context@^0.1.18-rc.12
16
16
  ```
17
17
 
18
18
  ## Usage
@@ -57,7 +57,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
57
57
  your project's skill store (`.agents/skills/`):
58
58
 
59
59
  ```sh
60
- npx @owlmeans/agent-skills
60
+ npx @owlmeans/agent-skills@^0.1.18-rc.20
61
61
  ```
62
62
 
63
63
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/client-context",
4
- "version": "0.1.18-rc.0",
5
- "generatedAt": "2026-08-16T22:20:50.514Z",
4
+ "version": "0.1.18-rc.21",
5
+ "generatedAt": "2026-09-12T14:18:54.796Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: client-context
3
- description: How to use @owlmeans/client-context — client-side context factory used as the base for web and native contexts. Auto-invoked when importing client context primitives.
3
+ description: How to use @owlmeans/client-context — makeClientContext(), the ClientConfig shape, config() and serviceRoute(alias, makeDefault?) — the platform-agnostic client context every web and native context is built from. Auto-invoked when building a client context, declaring a client config, or resolving a service route on the client.
4
4
  user-invocable: false
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
@@ -8,30 +8,60 @@ user-invocable: false
8
8
  # @owlmeans/client-context
9
9
 
10
10
  **Layer:** Client
11
- **Install:** `"@owlmeans/client-context": "^0.1.18-rc.0"` in `dependencies`
11
+ **Install:** `"@owlmeans/client-context": "^0.1.18-rc.21"` in `dependencies`
12
12
 
13
13
  ## Key Exports
14
14
 
15
15
  | Export | Description |
16
16
  |--------|-------------|
17
- | `makeClientContext` | Client-side context factory (cross-platform) |
18
- | `Context` (client) types | Client Context interface |
19
- | `Config` (client) types | Client config shape |
20
- | Constants | Default aliases |
21
-
22
- ## Subpath Exports
23
-
24
- - `./utils`
17
+ | `makeClientContext(cfg)` | The base client context factory a basic context plus `serviceRoute` and a registered API client |
18
+ | `ClientContext<C>` | The context interface — `BasicContext` + `ConfigResourceAppend` + `serviceRoute(alias, makeDefault?)` |
19
+ | `ClientConfig` | `BasicClientConfig` + `services` (the service-route table) + optional `i18n` |
20
+ | `config(service, cfg?)` | Build a `ClientConfig` for `service` with `AppType.Frontend` already set |
21
+ | `PLUGINS` (`plugins`) | Alias of the second config resource, the one plugin records live in |
25
22
 
26
23
  ## Usage
27
24
 
28
- Most apps don't call this directly — `@owlmeans/web-panel` and native equivalents wrap it.
25
+ Most apps never call this directly — `@owlmeans/client` wraps it (adding state, modal, debug and
26
+ the router accessor), and `@owlmeans/web-client`, `@owlmeans/web-panel` and their native
27
+ counterparts wrap that. A wrapper calls the layer below once, applies its own idempotent
28
+ `append*(context)` mixins, and returns the same context: one context per process, built by one
29
+ factory.
29
30
 
30
31
  ```typescript
31
- import { makeClientContext } from '@owlmeans/client-context'
32
+ import { makeClientContext, config } from '@owlmeans/client-context'
33
+
34
+ const cfg = config<Config>(MY_APP, { services: { ... } })
32
35
  const context = makeClientContext<Config, Context>(cfg)
33
36
  ```
34
37
 
38
+ `makeClientContext` appends the API client (`appendApiClient`) itself, so an entrypoint can make a
39
+ call as soon as the context is configured — nothing else has to register a carrier. Which carrier a
40
+ given call uses is `cfg.webService`, from `@owlmeans/client-config`.
41
+
42
+ ## Service routes
43
+
44
+ ```typescript
45
+ const route = context.serviceRoute(MANAGER, true) // and mark it the default one
46
+ ```
47
+
48
+ `serviceRoute` reads `cfg.services[alias]` and, with a boolean second argument, sets that route's
49
+ `default` flag — which is how an app says "unqualified addresses belong to this service". It
50
+ returns the live route object, so the flag is set on the config the rest of the context reads.
51
+
52
+ An unknown alias throws a `SyntaxError` that **names every registered service**. Expect to see it
53
+ during import, with a blank page and a stack pointing into the framework; the usual cause is a
54
+ route alias passed where a service alias belongs, since both are plain strings and nothing earlier
55
+ objects.
56
+
35
57
  ## Depends On
36
58
 
37
- - `@owlmeans/context`, `@owlmeans/client-config`, `@owlmeans/client-entrypoint`, `@owlmeans/client-route`
59
+ - `@owlmeans/context` — `makeBasicContext`, `AppType`, `makeBasicConfig`
60
+ - `@owlmeans/client-config` — `BasicClientConfig`
61
+ - `@owlmeans/api` — the API client appended into every client context
62
+ - `@owlmeans/route` (`CommonServiceRoute`), `@owlmeans/i18n`, `@owlmeans/config`
63
+
64
+ ## Related
65
+
66
+ - [[client]] — the React layer, whose own `makeClientContext` builds on this one
67
+ - [[client-config]] — `webService` and the rest of the base client config
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG7D,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,KAAG,CAqB9F,CAAA"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG7D,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,KAAG,CAmC9F,CAAA"}
package/build/context.js CHANGED
@@ -5,7 +5,20 @@ export const makeClientContext = (cfg) => {
5
5
  context.serviceRoute = (alias, makeDefault) => {
6
6
  const service = context.cfg.services[alias];
7
7
  if (service == null) {
8
- throw new SyntaxError(`Service not found ${alias}`);
8
+ /**
9
+ * The alternatives belong in the message, not in a debugger session.
10
+ *
11
+ * This throws at module scope, during import, so the app is blank and the stack points at
12
+ * a framework file — there is nowhere for a reader to look up what WAS registered. And
13
+ * the mistake it reports is almost always one specific confusion: a route alias passed
14
+ * where a service alias belongs. Both are strings, so nothing before this point objects.
15
+ *
16
+ * `?? {}` because `services` is optional on the config — an error must never be replaced
17
+ * by a worse one thrown while describing it.
18
+ */
19
+ const registered = Object.keys(context.cfg.services ?? {});
20
+ throw new SyntaxError(`Service not found ${alias}. Registered services: `
21
+ + (registered.length > 0 ? registered.join(', ') : '(none)'));
9
22
  }
10
23
  if (typeof makeDefault === 'boolean') {
11
24
  service.default = makeDefault;
@@ -13,7 +26,6 @@ export const makeClientContext = (cfg) => {
13
26
  return service;
14
27
  };
15
28
  appendApiClient(context);
16
- context.makeContext = makeClientContext;
17
29
  return context;
18
30
  };
19
31
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAqD,GAAM,EAAK,EAAE;IACjG,MAAM,OAAO,GAAG,gBAAgB,CAAC,GAAG,CAAM,CAAA;IAE1C,OAAO,CAAC,YAAY,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC3C,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,WAAW,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAA;QACrD,CAAC;QAED,IAAI,OAAO,WAAW,KAAK,SAAS,EAAE,CAAC;YACrC,OAAO,CAA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AA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/client-context",
3
- "version": "0.1.18-rc.2",
3
+ "version": "0.1.18-rc.21",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -28,12 +28,12 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@owlmeans/api": "^0.1.18-rc.2",
32
- "@owlmeans/client-config": "^0.1.18-rc.2",
33
- "@owlmeans/config": "^0.1.18-rc.2",
34
- "@owlmeans/context": "^0.1.18-rc.2",
35
- "@owlmeans/i18n": "^0.1.18-rc.2",
36
- "@owlmeans/route": "^0.1.18-rc.2"
31
+ "@owlmeans/api": "^0.1.18-rc.21",
32
+ "@owlmeans/client-config": "^0.1.18-rc.20",
33
+ "@owlmeans/config": "^0.1.18-rc.20",
34
+ "@owlmeans/context": "^0.1.18-rc.16",
35
+ "@owlmeans/i18n": "^0.1.18-rc.16",
36
+ "@owlmeans/route": "^0.1.18-rc.17"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@owlmeans/dep-config": "workspace:*",
package/src/context.ts CHANGED
@@ -8,7 +8,23 @@ export const makeClientContext = <C extends ClientConfig, T extends ClientContex
8
8
  context.serviceRoute = (alias, makeDefault) => {
9
9
  const service = context.cfg.services[alias]
10
10
  if (service == null) {
11
- throw new SyntaxError(`Service not found ${alias}`)
11
+ /**
12
+ * The alternatives belong in the message, not in a debugger session.
13
+ *
14
+ * This throws at module scope, during import, so the app is blank and the stack points at
15
+ * a framework file — there is nowhere for a reader to look up what WAS registered. And
16
+ * the mistake it reports is almost always one specific confusion: a route alias passed
17
+ * where a service alias belongs. Both are strings, so nothing before this point objects.
18
+ *
19
+ * `?? {}` because `services` is optional on the config — an error must never be replaced
20
+ * by a worse one thrown while describing it.
21
+ */
22
+ const registered = Object.keys(context.cfg.services ?? {})
23
+
24
+ throw new SyntaxError(
25
+ `Service not found ${alias}. Registered services: `
26
+ + (registered.length > 0 ? registered.join(', ') : '(none)')
27
+ )
12
28
  }
13
29
 
14
30
  if (typeof makeDefault === 'boolean') {
@@ -20,7 +36,5 @@ export const makeClientContext = <C extends ClientConfig, T extends ClientContex
20
36
 
21
37
  appendApiClient<C, T>(context)
22
38
 
23
- context.makeContext = makeClientContext as typeof context.makeContext
24
-
25
39
  return context
26
40
  }
package/build/.gitkeep DELETED
File without changes