@owlmeans/context 0.1.18-rc.2 → 0.1.18-rc.20

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.
Files changed (43) hide show
  1. package/README.md +255 -50
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/context/SKILL.md +14 -42
  4. package/build/config.d.ts.map +1 -1
  5. package/build/config.js +0 -2
  6. package/build/config.js.map +1 -1
  7. package/build/consts.d.ts +1 -9
  8. package/build/consts.d.ts.map +1 -1
  9. package/build/consts.js +0 -9
  10. package/build/consts.js.map +1 -1
  11. package/build/context.d.ts.map +1 -1
  12. package/build/context.js +26 -109
  13. package/build/context.js.map +1 -1
  14. package/build/helper.d.ts +0 -1
  15. package/build/helper.d.ts.map +1 -1
  16. package/build/helper.js +4 -13
  17. package/build/helper.js.map +1 -1
  18. package/build/types.d.ts +21 -23
  19. package/build/types.d.ts.map +1 -1
  20. package/build/utils/context.d.ts +2 -7
  21. package/build/utils/context.d.ts.map +1 -1
  22. package/build/utils/context.js +0 -11
  23. package/build/utils/context.js.map +1 -1
  24. package/build/utils/index.d.ts +0 -1
  25. package/build/utils/index.d.ts.map +1 -1
  26. package/build/utils/index.js +0 -1
  27. package/build/utils/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/config.ts +1 -2
  30. package/src/consts.ts +1 -10
  31. package/src/context.ts +32 -134
  32. package/src/helper.ts +4 -18
  33. package/src/types.ts +22 -26
  34. package/src/utils/context.ts +2 -20
  35. package/src/utils/index.ts +0 -1
  36. package/tests/context.ts +1 -2
  37. package/tests/service.spec.ts +1 -1
  38. package/build/.gitkeep +0 -0
  39. package/build/utils/layer.d.ts +0 -6
  40. package/build/utils/layer.d.ts.map +0 -1
  41. package/build/utils/layer.js +0 -12
  42. package/build/utils/layer.js.map +0 -1
  43. package/src/utils/layer.ts +0 -17
package/README.md CHANGED
@@ -1,95 +1,300 @@
1
1
  # @owlmeans/context
2
2
 
3
- Lightweight dependency injection and service lifecycle management for fullstack OwlMeans applications.
4
-
5
- ## Overview
6
-
7
- - Context holds services, modules, and resources; passed top-down through the app
8
- - Services are registered by alias and retrieved via `context.service(alias)`
9
- - Supports layered contexts (System → Global → Service → Entity → User) for multi-tenant apps
10
- - Route constants (`ROOT`, `HOME`, `GUEST`, `BASE`) are used by the module system across all packages
3
+ Lightweight dependency injection and service lifecycle for fullstack OwlMeans applications. An app
4
+ uses it to author its own services (`createService`, `createLazyService`), to type its context and
5
+ config, and to look up services, resources and entrypoints at runtime. An app almost never calls
6
+ `makeBasicContext` or `makeBasicConfig` itself — it builds its context with the layer factory
7
+ (`makeContext` from `@owlmeans/server-app` or `@owlmeans/web-panel`, `makeClientContext` from
8
+ `@owlmeans/client-context`) and its config with `config()` from `@owlmeans/config` or the layer
9
+ config package. Protocol declarations live in `@owlmeans/entrypoint`; data access contracts live in
10
+ `@owlmeans/resource`.
11
11
 
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/context
15
+ bun add @owlmeans/context@^0.1.18-rc.19
16
16
  ```
17
17
 
18
+ ## Concepts
19
+
20
+ - **Context** — the DI container: three flat registries (services, resources, entrypoints) keyed
21
+ by alias, plus a middleware table. One context is built per process by one factory; there is no
22
+ child context and nothing is stored for re-creation.
23
+ - **Contextual** — any object carrying `alias`, `registerContext` and `assertCtx`. It binds to
24
+ exactly one context, the first one that registers it.
25
+ - **Service** — a contextual with an initialization state. `createService` gets an eager `init()`
26
+ run during `context.init()`; `createLazyService` gets `lazyInit()` started on first lookup.
27
+ Both expose `ready()`.
28
+ - **Stage** — `ContextStage.Configuration` → `Loading` (after `configure()`) → `Ready` (after
29
+ `init()` resolves). `waitForConfigured()` / `waitForInitialized()` resolve at those points.
30
+ - **Middleware** — a hook keyed by `MiddlewareType` (`Config` / `Context`) and `MiddlewareStage`,
31
+ applied at fixed points of the lifecycle (see Usage 4).
32
+ - **`append*` mixin** — an idempotent function that registers a service, resource or middleware on
33
+ a context, optionally adds a typed accessor, and returns the same context. Layer factories are
34
+ compositions of these.
35
+
18
36
  ## Usage
19
37
 
20
- Creating and registering a service:
38
+ ### 1. Author a service
21
39
 
22
- ```typescript
40
+ `createService` wraps a partial implementation with `alias`, `initialized`, `init`, `ready` and the
41
+ contextual helpers. Inside methods, `service.assertCtx()` returns the context it was registered in.
42
+
43
+ ```ts
23
44
  import { createService } from '@owlmeans/context'
45
+ import type { InitializedService } from '@owlmeans/context'
46
+ import type { AppConfig, AppContext } from '../types.js'
47
+
48
+ export const INVOICE_SERVICE = 'invoice'
24
49
 
25
- export const makeIamService = (alias: string = IAM_SERVICE) => {
26
- const service = createService<IamService>(alias, {
27
- getEntityAdminConfig: async (entityId) => {
28
- const ctx = service.assertCtx<Config, Context>()
29
- return ctx.service<KeycloakService>(KC_SERVICE).getConfig(entityId)
30
- }
50
+ export interface InvoiceService extends InitializedService {
51
+ total: (projectId: string) => Promise<number>
52
+ }
53
+
54
+ export const makeInvoiceService = (alias: string = INVOICE_SERVICE): InvoiceService => {
55
+ const service: InvoiceService = createService<InvoiceService>(alias, {
56
+ total: async projectId => {
57
+ const ctx = service.assertCtx<AppConfig, AppContext>()
58
+ const { items } = await ctx.invoices().list({ projectId })
59
+
60
+ return items.reduce((sum, invoice) => sum + invoice.amount, 0)
61
+ },
31
62
  })
63
+
32
64
  return service
33
65
  }
34
66
  ```
35
67
 
36
- Registering and retrieving services from context:
68
+ A custom initializer is the third argument. It receives the service and returns the async function
69
+ `context.init()` runs — and it must set `initialized` itself:
37
70
 
38
- ```typescript
39
- const context = makeBasicContext(config)
40
- context.registerService(makeIamService())
71
+ ```ts
72
+ export const makeReminderService = (alias: string = 'reminder'): ReminderService =>
73
+ createService<ReminderService>(alias, { staleAfter: () => STALE_AFTER_MS }, service => async () => {
74
+ // open connections, start timers, read config — then mark the service usable
75
+ service.initialized = true
76
+ })
77
+ ```
78
+
79
+ ### 2. Register it through an `append*` mixin
80
+
81
+ The mixin registers the service, adds a typed accessor and returns the same context. The app's
82
+ factory calls the factory of the layer below and then its own mixins.
83
+
84
+ ```ts
85
+ import type { BasicConfig, BasicContext } from '@owlmeans/context'
86
+ import { makeContext as makeServerContext } from '@owlmeans/server-app'
87
+
88
+ export interface WithInvoiceService {
89
+ invoice: () => InvoiceService
90
+ }
91
+
92
+ export const appendInvoiceService = <C extends BasicConfig, T extends BasicContext<C>>(
93
+ ctx: T, alias: string = INVOICE_SERVICE
94
+ ): T & WithInvoiceService => {
95
+ const context = ctx as T & WithInvoiceService
96
+ if (!context.hasService(alias)) {
97
+ context.registerService(makeInvoiceService(alias))
98
+ }
99
+ context.invoice = () => context.service(alias)
100
+
101
+ return context
102
+ }
41
103
 
104
+ export const makeContext = <C extends AppConfig, T extends AppContext<C>>(cfg: C): T => {
105
+ const context = makeServerContext<C, T>(cfg)
106
+ appendInvoiceService<C, T>(context)
107
+
108
+ return context
109
+ }
110
+
111
+ const context = makeContext(config)
42
112
  await context.configure().init()
43
113
 
44
- const iamService = context.service<IamService>(IAM_SERVICE)
114
+ await context.invoice().total(projectId)
45
115
  ```
46
116
 
47
- ## API
117
+ ### 3. Look things up
48
118
 
49
- ### `createService<S>(alias, implementation): S`
119
+ `service`, `resource` and `entrypoint` throw a `SyntaxError` when the alias is not registered; use
120
+ the `has*` predicates for optional collaborators. Entrypoints are looked up by the shared protocol
121
+ declaration, which also supplies request and response types.
50
122
 
51
- Creates a service registered under `alias`. Inside method implementations, call `service.assertCtx()` to get the current context.
123
+ ```ts
124
+ import { projectProtocols } from 'my-app-common'
52
125
 
53
- ### `createLazyService<S>(alias, implementation): S`
126
+ const project = await context.entrypoint(projectProtocols.get).call({
127
+ params: { id },
128
+ })
54
129
 
55
- Like `createService` but initialized on first access via `lazyInit()`.
130
+ const policy = context.hasService(RELEASE_POLICY)
131
+ ? context.service<ReleasePolicy>(RELEASE_POLICY)
132
+ : null
56
133
 
57
- ### `appendContextual(alias, obj): Contextual`
134
+ const cache = context.resource<Resource<ProjectRecord>>(PROJECT_CACHE)
135
+ ```
58
136
 
59
- Wraps a plain object as a contextual entity (adds `registerContext`, `assertCtx`, etc.).
137
+ ### 4. Lazy services and lifecycle hooks
60
138
 
61
- ### `assertContext(ctx, location?): T`
139
+ A lazy service starts `lazyInit()` the first time `context.service(alias)` returns it and does not
140
+ wait for it, so its methods await `ready()` first:
62
141
 
63
- Asserts that a context is defined; throws if not.
142
+ ```ts
143
+ import { createLazyService } from '@owlmeans/context'
144
+ import type { GateService } from '@owlmeans/entrypoint'
145
+
146
+ export const makeProjectGate = (alias: string = PROJECT_GATE): GateService => {
147
+ const service: GateService = createLazyService<GateService>(alias, {
148
+ assert: async (req, _res, params) => {
149
+ await service.ready()
150
+ const ctx = service.assertCtx<AppConfig, AppContext>()
151
+ // ... check req.auth against params using ctx resources
152
+ },
153
+ })
154
+
155
+ return service
156
+ }
157
+ ```
64
158
 
65
- ### `makeBasicContext<C>(cfg): BasicContext<C>`
159
+ Middlewares run at fixed points:
160
+
161
+ | When | Type / stage |
162
+ |------|--------------|
163
+ | `configure()` | `Config` / `Configuration` |
164
+ | `init()`, before services | `Context` / `Configuration` |
165
+ | after every eager `service.init()` | `Config` / `Loading` |
166
+ | after every `resource.init()` | `Context` / `Loading` |
167
+ | after the stage becomes `Ready` (not awaited) | `Context` / `Ready` |
168
+
169
+ `Context` / `Loading` is the moment services are initialized but nothing has started listening yet —
170
+ the place to mount a raw server route:
171
+
172
+ ```ts
173
+ import { MiddlewareStage, MiddlewareType } from '@owlmeans/context'
174
+
175
+ export const appendHealthEndpoint = <C extends AppConfig, T extends AppContext<C>>(context: T): T => {
176
+ context.registerMiddleware({
177
+ type: MiddlewareType.Context,
178
+ stage: MiddlewareStage.Loading,
179
+ apply: async ctx => {
180
+ const server = (ctx as unknown as T).getApiServer().server
181
+ server.route({ method: 'GET', url: '/healthz', handler: async () => ({ ok: true }) })
182
+ },
183
+ })
66
184
 
67
- Creates a context from a config object. Rarely used directly — prefer the higher-level `makeContext` from `@owlmeans/server-app` or `@owlmeans/client-context`.
185
+ return context
186
+ }
187
+ ```
68
188
 
69
- ### Enums
189
+ Work that needs the whole context ready without blocking the factory hangs off
190
+ `waitForInitialized()`:
70
191
 
71
- ```typescript
72
- enum Layer { System, Global, Service, Entity, User }
73
- enum AppType { Backend, Frontend }
74
- enum ContextStage { Configuration, Loading, Ready }
192
+ ```ts
193
+ context.waitForInitialized().then(async () => {
194
+ context.service<DevService>(DEV_SERVICE).setMetadataFactory(metadataFactory)
195
+ })
75
196
  ```
76
197
 
77
- ### Route Constants
198
+ ### 5. A plain contextual object
78
199
 
79
- ```typescript
80
- ROOT // intermediate base route
81
- HOME // default/home route
82
- GUEST // unauthenticated area
83
- BASE // authenticated area
84
- CRASH // error fallback screen
200
+ `appendContextual` turns any object into something a context can register — the basis of custom
201
+ resources and entrypoints:
202
+
203
+ ```ts
204
+ import { appendContextual } from '@owlmeans/context'
205
+ import type { BasicResource } from '@owlmeans/context'
206
+
207
+ const resource = appendContextual<BasicResource>('project-cache', {
208
+ init: async () => { /* warm up */ },
209
+ })
210
+
211
+ context.registerResource(resource)
85
212
  ```
86
213
 
87
- ## Related Packages
214
+ ## API
88
215
 
89
- - [`@owlmeans/config`](../config) — configuration builder used with context
90
- - [`@owlmeans/server-context`](../server-context) — server-side context extension
91
- - [`@owlmeans/client-context`](../client-context) — client-side context extension
216
+ ### Functions
217
+
218
+ | Symbol | Kind | Purpose |
219
+ |--------|------|---------|
220
+ | `makeBasicContext<C>(cfg)` | function | Build the bare container; wrapped by every layer factory |
221
+ | `makeBasicConfig<C>(type, service, cfg?)` | function | Build a `BasicConfig` with `ready: false`, empty `services`, `records`, `debug` |
222
+ | `createService<S>(alias, service, init?)` | function | Service initialized eagerly by `context.init()` |
223
+ | `createLazyService<S>(alias, service, init?)` | function | Service initialized on first `context.service(alias)` |
224
+ | `appendContextual<T>(alias, obj)` | function | Add `alias`, `registerContext`, `assertCtx` to an object |
225
+ | `assertContext(ctx, location?)` | function | Return `ctx` or throw `SyntaxError` naming `location` |
226
+
227
+ ### `BasicContext<C>` members
228
+
229
+ | Member | Purpose |
230
+ |--------|---------|
231
+ | `cfg`, `config` | Config object; `config` is a promise resolving after configuration |
232
+ | `stage` | Current `ContextStage` |
233
+ | `configure()`, `init()` | Run the lifecycle; `init()` resolves once the context is `Ready` |
234
+ | `waitForConfigured()`, `waitForInitialized()` | Promises for those two points |
235
+ | `registerService`, `registerResource`, `registerEntrypoint`, `registerEntrypoints`, `registerMiddleware` | Registration; a repeated alias replaces the earlier entry |
236
+ | `service(alias)`, `resource(alias)`, `entrypoint(protocol \| alias)` | Lookup; throws `SyntaxError` when missing or (eager service) not initialized |
237
+ | `hasService`, `hasResource`, `hasEntrypoint` | Presence checks by alias |
238
+ | `entrypoints()` | Every registered entrypoint |
239
+
240
+ ### Constants and enums
241
+
242
+ | Symbol | Kind | Purpose |
243
+ |--------|------|---------|
244
+ | `AppType` | enum | `Backend`, `Frontend` |
245
+ | `ContextStage` | enum | `Configuration`, `Loading`, `Ready` |
246
+ | `MiddlewareType` | enum | `Config`, `Context` |
247
+ | `MiddlewareStage` | enum | `Configuration`, `Loading`, `Ready` |
248
+ | `CONFIG_RECORD` | const | Config key holding `ConfigRecord[]` (`'records'`) |
249
+ | `EMPTY_ENTITY`, `EMPTY_PROFILE` | const | Placeholders for an unset organization entity or profile |
250
+ | `ROOT` | const | Intermediate base route alias |
251
+ | `HOME` | const | Default final route alias |
252
+ | `GUEST` | const | Intermediate area without authentication |
253
+ | `BASE` | const | Intermediate area requiring authentication |
254
+ | `CRASH` | const | Fallback error screen alias |
255
+
256
+ ### Types
257
+
258
+ | Symbol | Kind | Purpose |
259
+ |--------|------|---------|
260
+ | `BasicConfig` | interface | `ready`, `service`, `alias?`, `type`, `services?`, `records?`, `debug?` |
261
+ | `ConfigRecord` | interface | Free-form config record with `id` and optional `recordType` |
262
+ | `BasicContext<C>` | interface | The container (members above) |
263
+ | `Contextual` | interface | `ctx?`, `alias`, `registerContext`, `assertCtx` |
264
+ | `Service` | interface | Contextual with `initialized`, `init?`, `lazyInit?`, `ready?` |
265
+ | `InitializedService` | interface | Service with required `init` and `ready` |
266
+ | `LazyService` | interface | Service with required `lazyInit` and `ready` |
267
+ | `InitMethod<S>` | interface | `(service) => () => Promise<void>` custom initializer |
268
+ | `BasicResource` | interface | Contextual with optional `init` |
269
+ | `BasicEntrypoint` | interface | Contextual marked `_entrypoint: true` |
270
+ | `EntrypointReference<T>` | interface | `{ alias, entrypointType? }` — what a protocol declaration satisfies for typed lookup |
271
+ | `Middleware` | interface | `type`, `stage`, `apply(context, args?)` |
272
+
273
+ ## Common pitfalls
274
+
275
+ - Pass protocol declarations to `context.entrypoint(...)`, never alias strings — the declaration
276
+ carries the request and response types.
277
+ - Build one context per process with one factory; do not create child contexts or reuse a service
278
+ object in a second context — it stays bound to the first one.
279
+ - A custom `init` passed to `createService` must set `service.initialized = true`, or
280
+ `context.service(alias)` throws "is not initialized".
281
+ - `context.service(alias)` on a lazy service does not wait for `lazyInit()`; methods await
282
+ `service.ready()` before touching state.
283
+ - Registering an alias twice silently replaces the earlier entry — guard `append*` mixins with
284
+ `has*` so they stay idempotent.
285
+ - `Context` / `Ready` middlewares are not awaited by `init()`; do not rely on them having finished.
286
+ - Keep the organization `entitySlug` on the wire; resolve the stable `entityId` inside the context
287
+ before persisting relations or calling third parties.
288
+
289
+ ## Related packages
290
+
291
+ - [`@owlmeans/config`](../config) — the application config built on `BasicConfig`
292
+ - [`@owlmeans/entrypoint`](../entrypoint) — protocol declarations looked up through `context.entrypoint`
293
+ - [`@owlmeans/resource`](../resource) — the resource contract registered through `registerResource`
294
+ - [`@owlmeans/server-context`](../server-context) — server-side context layer
295
+ - [`@owlmeans/client-context`](../client-context) — client-side context layer
92
296
  - [`@owlmeans/server-app`](../server-app) — top-level server context factory
297
+ - [`@owlmeans/web-panel`](../web-panel) — top-level browser context factory
93
298
 
94
299
  <!-- owlmeans:agent-guidance:start -->
95
300
  ## Agent guidance
@@ -99,7 +304,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
99
304
  your project's skill store (`.agents/skills/`):
100
305
 
101
306
  ```sh
102
- npx @owlmeans/agent-skills
307
+ npx @owlmeans/agent-skills@^0.1.18-rc.24
103
308
  ```
104
309
 
105
310
  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/context",
4
- "version": "0.1.18-rc.0",
5
- "generatedAt": "2026-08-16T22:20:50.516Z",
4
+ "version": "0.1.18-rc.20",
5
+ "generatedAt": "2026-09-15T12:59:01.074Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,53 +1,25 @@
1
1
  ---
2
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
3
+ description: Use OwlMeans context services, resources and typed entrypoint protocol references.
5
4
  ---
6
5
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
7
6
 
8
- # @owlmeans/context
7
+ # Context lookups
9
8
 
10
- **Layer:** Core
11
- **Install:** `"@owlmeans/context": "^0.1.18-rc.0"` in `dependencies`
9
+ **Install:** `bun add @owlmeans/context@^0.1.18-rc.19`
12
10
 
13
- ## Key Exports
11
+ Use a protocol declaration directly when obtaining an entrypoint. The declaration supplies the
12
+ registered entrypoint’s request and response types.
14
13
 
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: { ... } })
14
+ ```ts
15
+ const project = await context.entrypoint(projectProtocols.get).call({
16
+ params: { id },
17
+ })
48
18
  ```
49
19
 
50
- ## Depends On
20
+ Use `context.service(alias)` for registered services and context resource APIs for data access.
21
+ Protocol declarations are shared immutable values; context registration receives local server or
22
+ client entrypoints created with `bind()`, `bindAll()` or `bindScreen()`.
51
23
 
52
- - `@owlmeans/config` — context is parameterized by a Config
53
- - `@owlmeans/entrypoint` — `ClientEntrypoint<T>` type for cross-service calls
24
+ Keep organization entity addressing on the wire as `entitySlug`. Resolve the stable `entityId`
25
+ inside the context before persisting relations or calling third parties.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,WAAW,QAAQ,OAAO,WAAW,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC,KAAG,CAazG,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,WAAW,QAAQ,OAAO,WAAW,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC,KAAG,CAYzG,CAAA"}
package/build/config.js CHANGED
@@ -1,9 +1,7 @@
1
- import { AppType, Layer } from './consts.js';
2
1
  export const makeBasicConfig = (type, service, cfg) => {
3
2
  const config = {
4
3
  ready: false,
5
4
  service,
6
- layer: type === AppType.Frontend ? Layer.Service : Layer.System,
7
5
  type,
8
6
  debug: {},
9
7
  services: {},
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAG5C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAwB,IAAa,EAAE,OAAe,EAAE,GAAgB,EAAK,EAAE;IAC5G,MAAM,MAAM,GAAG;QACb,KAAK,EAAE,KAAK;QACZ,OAAO;QACP,KAAK,EAAE,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM;QAC/D,IAAI;QACJ,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,GAAG,GAAG;KACF,CAAA;IAEN,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAwB,IAAa,EAAE,OAAe,EAAE,GAAgB,EAAK,EAAE;IAC5G,MAAM,MAAM,GAAG;QACb,KAAK,EAAE,KAAK;QACZ,OAAO;QACP,IAAI;QACJ,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,GAAG,GAAG;KACF,CAAA;IAEN,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
package/build/consts.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- export declare enum Layer {
2
- System = "system",
3
- Global = "global",
4
- Service = "service",
5
- Entity = "entity",
6
- User = "user"
7
- }
8
1
  export declare enum AppType {
9
2
  Backend = "backend",
10
3
  Frontend = "frontend"
@@ -21,8 +14,7 @@ export declare enum ContextStage {
21
14
  export declare enum MiddlewareStage {
22
15
  Configuration = "configuration",
23
16
  Loading = "loading",
24
- Ready = "ready",
25
- Switching = "switching"
17
+ Ready = "ready"
26
18
  }
27
19
  export declare const CONFIG_RECORD = "records";
28
20
  export declare const EMPTY_ENTITY = "[UNDEFINED_ENTITY]";
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,oBAAY,KAAK;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,OAAO;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oBAAY,YAAY;IACtB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,eAAe;IACzB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,SAAS,cAAc;CACxB;AAED,eAAO,MAAM,aAAa,YAAY,CAAA;AAEtC,eAAO,MAAM,YAAY,uBAAuB,CAAA;AAChD,eAAO,MAAM,aAAa,wBAAwB,CAAA;AAGlD;;GAEG;AACH,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B;;GAEG;AACH,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B;;GAEG;AACH,eAAO,MAAM,KAAK,UAAU,CAAA;AAC5B;;GAEG;AACH,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B;;GAEG;AACH,eAAO,MAAM,KAAK,UAAU,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,oBAAY,OAAO;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oBAAY,YAAY;IACtB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,eAAe;IACzB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,aAAa,YAAY,CAAA;AAEtC,eAAO,MAAM,YAAY,uBAAuB,CAAA;AAChD,eAAO,MAAM,aAAa,wBAAwB,CAAA;AAGlD;;GAEG;AACH,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B;;GAEG;AACH,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B;;GAEG;AACH,eAAO,MAAM,KAAK,UAAU,CAAA;AAC5B;;GAEG;AACH,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B;;GAEG;AACH,eAAO,MAAM,KAAK,UAAU,CAAA"}
package/build/consts.js CHANGED
@@ -1,11 +1,3 @@
1
- export var Layer;
2
- (function (Layer) {
3
- Layer["System"] = "system";
4
- Layer["Global"] = "global";
5
- Layer["Service"] = "service";
6
- Layer["Entity"] = "entity";
7
- Layer["User"] = "user";
8
- })(Layer || (Layer = {}));
9
1
  export var AppType;
10
2
  (function (AppType) {
11
3
  AppType["Backend"] = "backend";
@@ -27,7 +19,6 @@ export var MiddlewareStage;
27
19
  MiddlewareStage["Configuration"] = "configuration";
28
20
  MiddlewareStage["Loading"] = "loading";
29
21
  MiddlewareStage["Ready"] = "ready";
30
- MiddlewareStage["Switching"] = "switching";
31
22
  })(MiddlewareStage || (MiddlewareStage = {}));
32
23
  export const CONFIG_RECORD = 'records';
33
24
  export const EMPTY_ENTITY = '[UNDEFINED_ENTITY]';
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,KAMX;AAND,WAAY,KAAK;IACf,0BAAiB,CAAA;IACjB,0BAAiB,CAAA;IACjB,4BAAmB,CAAA;IACnB,0BAAiB,CAAA;IACjB,sBAAa,CAAA;AACf,CAAC,EANW,KAAK,KAAL,KAAK,QAMhB;AAED,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,8BAAmB,CAAA;IACnB,gCAAqB,CAAA;AACvB,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;AACrB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,+CAA+B,CAAA;IAC/B,mCAAmB,CAAA;IACnB,+BAAe,CAAA;AACjB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,kDAA+B,CAAA;IAC/B,sCAAmB,CAAA;IACnB,kCAAe,CAAA;IACf,0CAAuB,CAAA;AACzB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAA;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAA;AAElD,wBAAwB;AACxB;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAC1B;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAC1B;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAA;AAC5B;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAC1B;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAA"}
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,8BAAmB,CAAA;IACnB,gCAAqB,CAAA;AACvB,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;AACrB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,+CAA+B,CAAA;IAC/B,mCAAmB,CAAA;IACnB,+BAAe,CAAA;AACjB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,kDAA+B,CAAA;IAC/B,sCAAmB,CAAA;IACnB,kCAAe,CAAA;AACjB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAA;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAA;AAElD,wBAAwB;AACxB;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAC1B;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAC1B;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAA;AAC5B;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAC1B;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAoE,MAAM,YAAY,CAAA;AAO7H,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,WAAW,OAAO,CAAC,KAAG,YAAY,CAAC,CAAC,CA6Q9E,CAAA"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAAE,YAAY,EAC1B,MAAM,YAAY,CAAA;AAKnB,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,WAAW,OAAO,CAAC,KAAG,YAAY,CAAC,CAAC,CAuK9E,CAAA"}