@owlmeans/context 0.1.7 → 0.1.8
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
|
@@ -90,3 +90,20 @@ CRASH // error fallback screen
|
|
|
90
90
|
- [`@owlmeans/server-context`](../server-context) — server-side context extension
|
|
91
91
|
- [`@owlmeans/client-context`](../client-context) — client-side context extension
|
|
92
92
|
- [`@owlmeans/server-app`](../server-app) — top-level server context factory
|
|
93
|
+
|
|
94
|
+
<!-- owlmeans:agent-guidance:start -->
|
|
95
|
+
## Agent guidance
|
|
96
|
+
|
|
97
|
+
This package ships embedded Claude Code skills and GitHub Copilot instructions under
|
|
98
|
+
`agent-meta/`. After installing your `@owlmeans/*` packages, run the OwlMeans
|
|
99
|
+
agent-skills installer to place them into your project's native locations
|
|
100
|
+
(`.claude/skills/` and `.github/instructions/`):
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
npx @owlmeans/agent-skills
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The embedded files are version-matched to this package release. Do not edit them
|
|
107
|
+
directly — they are regenerated on each publish. To contribute guidance edits,
|
|
108
|
+
open a PR against the source monorepo.
|
|
109
|
+
<!-- owlmeans:agent-guidance:end -->
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "How to use @owlmeans/context — base context (DI container) factory, registerService, service<T>() lookups, entrypoint<ClientEntrypoint<T>>() resolution. Use when building a makeContext factory."
|
|
3
|
+
applyTo: "**/context.ts, **/context.tsx, **/*.ts, **/*.tsx"
|
|
4
|
+
---
|
|
5
|
+
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
|
+
|
|
7
|
+
# @owlmeans/context
|
|
8
|
+
|
|
9
|
+
**Layer:** Core
|
|
10
|
+
**Install:** `"@owlmeans/context": "^0.1.8"` in `dependencies`
|
|
11
|
+
|
|
12
|
+
## Key Exports
|
|
13
|
+
|
|
14
|
+
| Export | Description |
|
|
15
|
+
|--------|-------------|
|
|
16
|
+
| `Context<C>` types | Generic context interface |
|
|
17
|
+
| `makeBasicContext` | Low-level factory |
|
|
18
|
+
| `registerService`, `service<T>`, `entrypoint<ClientEntrypoint<T>>` | Methods on every Context |
|
|
19
|
+
| `Service` types | Service interface and lifecycle |
|
|
20
|
+
| Constants | Built-in service/entrypoint aliases |
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { makeBackendContext } from '@owlmeans/server-context'
|
|
26
|
+
|
|
27
|
+
export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T => {
|
|
28
|
+
const context = makeBackendContext<C, T>(cfg)
|
|
29
|
+
context.registerService(makeMyService())
|
|
30
|
+
context.makeContext = makeContext as typeof context.makeContext
|
|
31
|
+
return context
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Cross-service call
|
|
35
|
+
const [response] = await ctx.entrypoint<ClientEntrypoint<ResponseType>>(alias).call({ body: { ... } })
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Depends On
|
|
39
|
+
|
|
40
|
+
- `@owlmeans/config` — context is parameterized by a Config
|
|
41
|
+
- `@owlmeans/entrypoint` — `ClientEntrypoint<T>` for cross-service calls
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"package": "@owlmeans/context",
|
|
4
|
+
"version": "0.1.8",
|
|
5
|
+
"generatedAt": "2026-06-11T16:30:27.186Z",
|
|
6
|
+
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
|
+
"entries": [
|
|
8
|
+
{
|
|
9
|
+
"kind": "skill",
|
|
10
|
+
"name": "context",
|
|
11
|
+
"category": "package-specific",
|
|
12
|
+
"file": "skills/context/SKILL.md",
|
|
13
|
+
"canonicalPath": ".claude/skills/context/SKILL.md"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"kind": "instruction",
|
|
17
|
+
"name": "context",
|
|
18
|
+
"category": "package-specific",
|
|
19
|
+
"file": "instructions/context.instructions.md",
|
|
20
|
+
"canonicalPath": ".github/instructions/context.instructions.md"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context
|
|
3
|
+
description: How to use @owlmeans/context — base context (DI container) factory, registerService(), service<T>() lookups, entrypoint<ClientEntrypoint<T>>() resolution. Auto-invoked when importing context primitives or building a makeContext factory.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
7
|
+
|
|
8
|
+
# @owlmeans/context
|
|
9
|
+
|
|
10
|
+
**Layer:** Core
|
|
11
|
+
**Install:** `"@owlmeans/context": "^0.1.8"` in `dependencies`
|
|
12
|
+
|
|
13
|
+
## Key Exports
|
|
14
|
+
|
|
15
|
+
| Export | Description |
|
|
16
|
+
|--------|-------------|
|
|
17
|
+
| `Context<C>` types | Generic context interface (typed by Config) |
|
|
18
|
+
| `makeBasicContext` | Low-level factory — usually you extend a layer-specific factory instead |
|
|
19
|
+
| `registerService` (method) | Add a service to the DI container |
|
|
20
|
+
| `service<T>(alias)` (method) | Resolve a service by alias |
|
|
21
|
+
| `entrypoint<ClientEntrypoint<T>>(alias)` (method) | Resolve an entrypoint to call cross-service |
|
|
22
|
+
| `Service` types | Service interface and lifecycle |
|
|
23
|
+
| Constants | Built-in service/entrypoint aliases |
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Always extend a layer-specific factory (`@owlmeans/server-context`, `@owlmeans/web-panel`, etc.) rather than calling the basic factory directly. Always reassign `context.makeContext` so child contexts inherit the typed factory:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { makeBackendContext } from '@owlmeans/server-context'
|
|
31
|
+
|
|
32
|
+
export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T => {
|
|
33
|
+
const context = makeBackendContext<C, T>(cfg)
|
|
34
|
+
context.registerService(makeMyService())
|
|
35
|
+
context.makeContext = makeContext as typeof context.makeContext
|
|
36
|
+
return context
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Resolve services and call cross-service entrypoints from a handler:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const someService = ctx.service<MyService>(MY_SERVICE_ALIAS)
|
|
44
|
+
|
|
45
|
+
const [response] = await ctx.entrypoint<ClientEntrypoint<ResponseType>>(
|
|
46
|
+
externalService.action.alias
|
|
47
|
+
).call({ body: { ... } })
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Depends On
|
|
51
|
+
|
|
52
|
+
- `@owlmeans/config` — context is parameterized by a Config
|
|
53
|
+
- `@owlmeans/entrypoint` — `ClientEntrypoint<T>` type for cross-service calls
|