@owlmeans/client-context 0.1.18-rc.1 → 0.1.18-rc.11
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/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-context/SKILL.md +7 -9
- package/build/config.d.ts.map +1 -1
- package/build/context.d.ts.map +1 -1
- package/build/context.js +14 -2
- package/build/context.js.map +1 -1
- package/package.json +7 -7
- package/src/context.ts +17 -3
- package/build/.gitkeep +0 -0
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/client-context",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.11",
|
|
5
|
+
"generatedAt": "2026-09-01T16:28:56.995Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,24 +8,22 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/client-context
|
|
9
9
|
|
|
10
10
|
**Layer:** Client
|
|
11
|
-
**Install:** `"@owlmeans/client-context": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/client-context": "^0.1.18-rc.11"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
15
15
|
| Export | Description |
|
|
16
16
|
|--------|-------------|
|
|
17
17
|
| `makeClientContext` | Client-side context factory (cross-platform) |
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
|
|
|
21
|
-
|
|
22
|
-
## Subpath Exports
|
|
23
|
-
|
|
24
|
-
- `./utils`
|
|
18
|
+
| `ClientContext<C>` | Client Context interface — adds `serviceRoute(alias)` |
|
|
19
|
+
| `ClientConfig`, `config()` | Client config shape and its factory |
|
|
20
|
+
| `PLUGINS` | Alias of the plugins config resource |
|
|
25
21
|
|
|
26
22
|
## Usage
|
|
27
23
|
|
|
28
|
-
Most apps don't call this directly — `@owlmeans/web-panel` and native equivalents wrap it.
|
|
24
|
+
Most apps don't call this directly — `@owlmeans/web-panel` and native equivalents wrap it. A wrapper
|
|
25
|
+
calls it once, applies its own idempotent `append*(context)` mixins, and returns that same context:
|
|
26
|
+
one context per process, built by one factory.
|
|
29
27
|
|
|
30
28
|
```typescript
|
|
31
29
|
import { makeClientContext } from '@owlmeans/client-context'
|
package/build/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,YAAY,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,YAAY,EAAE,SAAS,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,CAIlF,CAAA"}
|
package/build/context.d.ts.map
CHANGED
|
@@ -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,
|
|
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,EAAE,KAAK,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
|
-
|
|
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
|
package/build/context.js.map
CHANGED
|
@@ -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,M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/B,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IAED,eAAe,CAAO,OAAO,CAAC,CAAA;IAE9B,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/client-context",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.11",
|
|
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.
|
|
32
|
-
"@owlmeans/client-config": "^0.1.18-rc.
|
|
33
|
-
"@owlmeans/config": "^0.1.18-rc.
|
|
34
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
35
|
-
"@owlmeans/i18n": "^0.1.18-rc.
|
|
36
|
-
"@owlmeans/route": "^0.1.18-rc.
|
|
31
|
+
"@owlmeans/api": "^0.1.18-rc.11",
|
|
32
|
+
"@owlmeans/client-config": "^0.1.18-rc.10",
|
|
33
|
+
"@owlmeans/config": "^0.1.18-rc.10",
|
|
34
|
+
"@owlmeans/context": "^0.1.18-rc.7",
|
|
35
|
+
"@owlmeans/i18n": "^0.1.18-rc.7",
|
|
36
|
+
"@owlmeans/route": "^0.1.18-rc.7"
|
|
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
|
-
|
|
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
|