@owlmeans/server-api 0.1.18-rc.13 → 0.1.18-rc.15
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 +9 -9
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-api/SKILL.md +24 -10
- package/build/errors.d.ts.map +1 -1
- package/build/errors.js.map +1 -1
- package/build/helper.d.ts.map +1 -1
- package/build/hold.d.ts.map +1 -1
- package/build/hold.js.map +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +6 -11
- package/build/server.js.map +1 -1
- package/build/types.d.ts +1 -2
- package/build/types.d.ts.map +1 -1
- package/build/utils/context.d.ts.map +1 -1
- package/build/utils/error.d.ts.map +1 -1
- package/build/utils/guards.d.ts.map +1 -1
- package/build/utils/guards.js +0 -20
- package/build/utils/guards.js.map +1 -1
- package/build/utils/payload.d.ts.map +1 -1
- package/build/utils/server.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/server.ts +33 -41
- package/src/types.ts +1 -3
- package/src/utils/guards.ts +0 -23
- package/build/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @owlmeans/server-api
|
|
2
2
|
|
|
3
|
-
Fastify-based HTTP/WebSocket server with handler wrappers for the OwlMeans
|
|
3
|
+
Fastify-based HTTP/WebSocket server with handler wrappers for the OwlMeans entrypoint system.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
7
|
- `handleBody`, `handleParams`, `handleRequest` wrap business logic with context injection and error handling
|
|
8
|
-
- Built on [Fastify](https://fastify.dev/) — registered
|
|
8
|
+
- Built on [Fastify](https://fastify.dev/) — registered entrypoints become Fastify routes automatically
|
|
9
9
|
- `createApiServer` / `appendApiServer` initialize the HTTP server in a context
|
|
10
10
|
- Not typically used directly — import handlers from `@owlmeans/server-app`
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ bun add @owlmeans/server-api
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
Handler functions
|
|
20
|
+
Handler functions attached with `elevate()`:
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
import { handleBody, handleParams, handleRequest } from '@owlmeans/server-app'
|
|
@@ -25,7 +25,7 @@ import { handleBody, handleParams, handleRequest } from '@owlmeans/server-app'
|
|
|
25
25
|
// Body handler: receives parsed + validated body as first arg
|
|
26
26
|
export const create = handleBody<CreateProject>(async (payload, context, req) => {
|
|
27
27
|
const ctx = context as Context
|
|
28
|
-
return await ctx.project().create({ ...payload, entityId: req.
|
|
28
|
+
return await ctx.project().create({ ...payload, entityId: req.entity!.id })
|
|
29
29
|
})
|
|
30
30
|
|
|
31
31
|
// Params handler: receives validated URL params as first arg
|
|
@@ -41,28 +41,28 @@ export const health = handleRequest(async (req, context) => {
|
|
|
41
41
|
|
|
42
42
|
## API
|
|
43
43
|
|
|
44
|
-
### `handleBody<T>(handler):
|
|
44
|
+
### `handleBody<T>(handler): RefedEntrypointHandler`
|
|
45
45
|
|
|
46
46
|
Wraps a handler that receives the validated request body as the first argument.
|
|
47
47
|
```typescript
|
|
48
48
|
handler: (payload: T, ctx: Context, req: AbstractRequest) => Promise<any>
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
### `handleParams<T>(handler):
|
|
51
|
+
### `handleParams<T>(handler): RefedEntrypointHandler`
|
|
52
52
|
|
|
53
53
|
Wraps a handler that receives the validated URL params as the first argument.
|
|
54
54
|
```typescript
|
|
55
55
|
handler: (payload: T, ctx: Context, req: AbstractRequest) => Promise<any>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
### `handleRequest(handler):
|
|
58
|
+
### `handleRequest(handler): RefedEntrypointHandler`
|
|
59
59
|
|
|
60
60
|
Wraps a handler that receives the full request object.
|
|
61
61
|
```typescript
|
|
62
62
|
handler: (req: AbstractRequest, ctx: Context, res?: AbstractResponse) => Promise<any>
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
### `handleIntermediate(handler):
|
|
65
|
+
### `handleIntermediate(handler): RefedEntrypointHandler`
|
|
66
66
|
|
|
67
67
|
Wraps middleware-layer handlers that do not return a final response.
|
|
68
68
|
|
|
@@ -73,7 +73,7 @@ Extract a multipart-uploaded file from the request.
|
|
|
73
73
|
## Related Packages
|
|
74
74
|
|
|
75
75
|
- [`@owlmeans/server-app`](../server-app) — re-exports all handlers; preferred import point
|
|
76
|
-
- [`@owlmeans/server-
|
|
76
|
+
- [`@owlmeans/server-entrypoint`](../server-entrypoint) — `elevate()` attaches handlers to entrypoints
|
|
77
77
|
- [`@owlmeans/server-socket`](../server-socket) — WebSocket `handleConnection` counterpart
|
|
78
78
|
|
|
79
79
|
<!-- owlmeans:agent-guidance:start -->
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/server-api",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.15",
|
|
5
|
+
"generatedAt": "2026-09-01T16:28:56.978Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,33 +8,47 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/server-api
|
|
9
9
|
|
|
10
10
|
**Layer:** Server
|
|
11
|
-
**Install:** `"@owlmeans/server-api": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/server-api": "^0.1.18-rc.15"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
15
15
|
| Export | Description |
|
|
16
16
|
|--------|-------------|
|
|
17
|
-
| `
|
|
17
|
+
| `createApiServer(alias)` | Factory for the Fastify-based API server |
|
|
18
|
+
| `appendApiServer(ctx, alias?)` | Register it and expose `ctx.getApiServer()` |
|
|
19
|
+
| `handleRequest` / `handleBody` / `handleParams` / `handleIntermediate` | Wrap an async function as an entrypoint handler |
|
|
20
|
+
| `extractUploadedFile(req)` | The multipart file behind a request |
|
|
18
21
|
| `holdApiPort(cfg, { okPath?, payload? })` | Own the app's port during boot; released by the real `listen()` |
|
|
19
|
-
| `
|
|
20
|
-
|
|
|
21
|
-
| Constants |
|
|
22
|
-
| Helpers | Middleware composition |
|
|
22
|
+
| `ApiServer`, `Request`, `Response` types | Runtime shapes |
|
|
23
|
+
| `AuthFailedError`, `AccessError`, `NoFileError` | Typed request-pipeline errors |
|
|
24
|
+
| Constants | `DEFAULT_ALIAS` (`api-server`), `PORT`, `CLOSED_HOST`, `OPENED_HOST` |
|
|
23
25
|
|
|
24
26
|
## Subpath Exports
|
|
25
27
|
|
|
26
|
-
- `./utils` —
|
|
28
|
+
- `./utils` — `handleError`, `authorize`, `provideRequest`, `executeResponse`, `populateContext`, `extractContext`, `canServeModule`, `createServerHandler`, `fixFormatDates`
|
|
27
29
|
|
|
28
30
|
## Usage
|
|
29
31
|
|
|
30
32
|
The server is normally constructed transparently by `@owlmeans/server-app#main()`. Use `server-api` directly only when you need to register raw Fastify plugins or customize transport:
|
|
31
33
|
|
|
32
34
|
```typescript
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
context.registerService(server)
|
|
35
|
+
import { appendApiServer } from '@owlmeans/server-api'
|
|
36
|
+
appendApiServer(context)
|
|
36
37
|
```
|
|
37
38
|
|
|
39
|
+
## Where a route is bound
|
|
40
|
+
|
|
41
|
+
Every route is registered at `entrypoint.mount()` — `base` plus every ancestor's segment, then this
|
|
42
|
+
one. A declaration states only the segment it contributes, so the full address takes the context the
|
|
43
|
+
entrypoint is registered in, and the table can therefore only be built once the context has resolved.
|
|
44
|
+
Intermediates are not bound as routes: they run in a `preHandler` hook and each one tests
|
|
45
|
+
`entrypoint.route.match(request, entrypoint.mount())` against the same mounted path, passing the
|
|
46
|
+
context it produced down the chain.
|
|
47
|
+
|
|
48
|
+
A route is bound only when its entrypoint carries a `handle`. Guards and gates come from
|
|
49
|
+
`getGuards()` / `getGates()`, which include everything the ancestors declared, and they run before
|
|
50
|
+
the handler — a handler that re-checks them is duplicating an enforced rule.
|
|
51
|
+
|
|
38
52
|
## Holding the port through the boot
|
|
39
53
|
|
|
40
54
|
The server builds its route table from the entrypoints the context knows about, so it can only
|
package/build/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,OAAuB,QAAQ,SAAoB;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,OAAuB,QAAQ,SAAoB;gBAEvC,OAAO,GAAE,MAAgB;CAItC;AAED,qBAAa,WAAY,SAAQ,QAAQ;IACvC,OAAuB,QAAQ,SAAsC;gBAEzD,OAAO,GAAE,MAAgB;CAItC;AAED,qBAAa,WAAY,SAAQ,QAAQ;IACvC,OAAuB,QAAQ,SAAgB;;CAMhD"}
|
package/build/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IACpC,MAAM,CAAU,QAAQ,GAAG,iBAAiB,CAAA;IAEnD,YAAY,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,O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CAAC,KAC7G,sBAAsB,CAAC,gBAAgB,CAAC,OAAO,GAAG,IAAI,CAAC,CAc3D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAU,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,KAAK,eAAe,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAItH,CAAA;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa;CAAI"}
|
package/build/hold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hold.d.ts","sourceRoot":"","sources":["../src/hold.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG5D,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"hold.d.ts","sourceRoot":"","sources":["../src/hold.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG5D,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,WAAW,GACtB,KAAK,YAAY,EAAE,OAAM,kBAAuB,KAC/C,OAAO,CAAC,WAAW,CA0BrB,CAAA"}
|
package/build/hold.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hold.js","sourceRoot":"","sources":["../src/hold.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAsB5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,GAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"hold.js","sourceRoot":"","sources":["../src/hold.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAsB5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,GAAiB,EAAE,OAA2B,EAAE,EAC1B,EAAE;IACxB,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACxC,MAAM,IAAI,GAAG,MAAM,EAAE,YAAY,IAAI,MAAM,EAAE,IAAI,IAAI,IAAI,CAAA;IACzD,MAAM,IAAI,GAAG,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAA;IAEhE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAE1D,8FAA8F;IAC9F,mFAAmF;IACnF,MAAM,MAAM,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CA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ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAiC5D,KAAK,MAAM,GAAG,YAAY,CAAA;AAK1B,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,SAkJ/C,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAC1E,KAAK,CAAC,EAAE,QAAO,MAAsB,KACpC,CAAC,GAAG,eAWN,CAAA"}
|
package/build/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assertContext, createService } from '@owlmeans/context';
|
|
2
2
|
import { canServeModule, executeResponse, provideRequest } from './utils/index.js';
|
|
3
3
|
import { DEFAULT_ALIAS, CLOSED_HOST, PORT, OPENED_HOST } from './consts.js';
|
|
4
4
|
import { RouteMethod } from '@owlmeans/route';
|
|
@@ -42,7 +42,6 @@ export const createApiServer = (alias) => {
|
|
|
42
42
|
},
|
|
43
43
|
}*/
|
|
44
44
|
}),
|
|
45
|
-
layers: [Layer.System],
|
|
46
45
|
listen: async () => {
|
|
47
46
|
const context = _assertContext(service.ctx);
|
|
48
47
|
const config = context.cfg.services[context.cfg.service];
|
|
@@ -107,10 +106,8 @@ export const createApiServer = (alias) => {
|
|
|
107
106
|
if (responded || reply.sent) {
|
|
108
107
|
return context;
|
|
109
108
|
}
|
|
110
|
-
// await module.route.resolve(context as any)
|
|
111
|
-
await module.resolve();
|
|
112
109
|
// Actually intermediate module can be created without handler by elevate function
|
|
113
|
-
if (module.route.match(request) && module.handle != null) {
|
|
110
|
+
if (module.route.match(request, module.mount()) && module.handle != null) {
|
|
114
111
|
const response = provideResponse(reply);
|
|
115
112
|
const currentRequest = provideRequest(module.alias, request, true);
|
|
116
113
|
currentRequest.original._ctx = context;
|
|
@@ -123,17 +120,15 @@ export const createApiServer = (alias) => {
|
|
|
123
120
|
return context;
|
|
124
121
|
}, Promise.resolve(context));
|
|
125
122
|
});
|
|
126
|
-
|
|
123
|
+
context.entrypoints()
|
|
127
124
|
.filter(module => canServeModule(context, module) && !module.route.isIntermediate())
|
|
128
|
-
.
|
|
129
|
-
// await module.route.resolve(context as any)
|
|
130
|
-
await module.resolve();
|
|
125
|
+
.forEach(module => {
|
|
131
126
|
const method = module.route.route.method ?? RouteMethod.GET;
|
|
132
127
|
if (module.handle == null) {
|
|
133
128
|
return;
|
|
134
129
|
}
|
|
135
130
|
server.route({
|
|
136
|
-
url: module.
|
|
131
|
+
url: module.mount(), method,
|
|
137
132
|
schema: {
|
|
138
133
|
consumes: [
|
|
139
134
|
'application/json',
|
|
@@ -154,7 +149,7 @@ export const createApiServer = (alias) => {
|
|
|
154
149
|
},
|
|
155
150
|
handler: createServerHandler(module, location)
|
|
156
151
|
});
|
|
157
|
-
})
|
|
152
|
+
});
|
|
158
153
|
service.initialized = true;
|
|
159
154
|
});
|
|
160
155
|
return service;
|
package/build/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAClF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM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B,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,GAAM,EAAE,QAAgB,aAAa,EAChB,EAAE;IACvB,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IACtC,MAAM,OAAO,GAAG,GAA0B,CAAA;IAE1C,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAEhC,IAAI,OAAO,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;QACjC,OAAO,CAAC,YAAY,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACzD,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
package/build/types.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { InitializedService
|
|
1
|
+
import type { InitializedService } from '@owlmeans/context';
|
|
2
2
|
import type { ServerConfig, ServerContext } from '@owlmeans/server-context';
|
|
3
3
|
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
|
4
4
|
import '@fastify/middie/types/index.d.ts';
|
|
5
5
|
export interface ApiServer extends InitializedService {
|
|
6
6
|
server: FastifyInstance;
|
|
7
|
-
layers: [Layer.System];
|
|
8
7
|
listen: () => Promise<void>;
|
|
9
8
|
}
|
|
10
9
|
export interface Request extends FastifyRequest {
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,kCAAkC,CAAA;AAEzC,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD,MAAM,EAAE,eAAe,CAAA;IAEvB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5B;AAED,MAAM,WAAW,OAAQ,SAAQ,cAAc;CAAI;AAEnD,MAAM,WAAW,QAAS,SAAQ,YAAY;CAAI;AAElD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,SAAS,CAAA;CAC9B;AAED,MAAM,WAAW,MAAO,SAAQ,YAAY;CAAI;AAEhD,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC,EAC1E,eAAe;CAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG3D,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG3D,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,EAAE,SAAS,CAAC,KAAG,IAC/D,CAAA;AAEpC,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,MAAM,KAAG,CACxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,EAAE,OAAO,YAAY,SAe5D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/utils/guards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/utils/guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAM3E,KAAK,MAAM,GAAG,YAAY,CAAA;AAC1B,UAAU,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;CAAI;AAEzE,eAAO,MAAM,SAAS,GAAU,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EACpE,SAAS,CAAC,EAAE,QAAQ,gBAAgB,CAAC,cAAc,CAAC,EACpD,KAAK,cAAc,EAAE,OAAO,YAAY,KACvC,OAAO,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAmD/C,CAAA"}
|
package/build/utils/guards.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { isContextWithoutIds, Layer } from '@owlmeans/context';
|
|
2
1
|
import { provideResponse } from '@owlmeans/entrypoint';
|
|
3
2
|
import { executeResponse, provideRequest } from './payload.js';
|
|
4
3
|
import { AuthFailedError } from '../errors.js';
|
|
5
|
-
import { entitySlugOf } from '@owlmeans/auth';
|
|
6
4
|
import { attachEntity } from '@owlmeans/auth-common';
|
|
7
5
|
export const authorize = async (context, module, req, reply) => {
|
|
8
6
|
const guards = module.getGuards();
|
|
@@ -40,7 +38,6 @@ export const authorize = async (context, module, req, reply) => {
|
|
|
40
38
|
// infrastructure names — keys on the entity's stable id. Resolving here, once, is what keeps a
|
|
41
39
|
// rename from being a sweep of every handler: the id arrives on the request, and a slug that
|
|
42
40
|
// has since been retired still resolves to the entity that retired it.
|
|
43
|
-
const entitySlug = entitySlugOf(request.auth);
|
|
44
41
|
const entity = await attachEntity(context, request);
|
|
45
42
|
if (entity != null) {
|
|
46
43
|
// Carried on the raw request the same way `_auth` is, so the request the handler is given
|
|
@@ -48,23 +45,6 @@ export const authorize = async (context, module, req, reply) => {
|
|
|
48
45
|
;
|
|
49
46
|
req._entity = entity;
|
|
50
47
|
}
|
|
51
|
-
if (entitySlug != null) {
|
|
52
|
-
// @TODO Probably we need to downgrade context in this case
|
|
53
|
-
if (!isContextWithoutIds(context)) {
|
|
54
|
-
throw SyntaxError(`Context should be without ids during authorization ${context.cfg.layer}:${context.cfg.layerId}`);
|
|
55
|
-
}
|
|
56
|
-
if (isContextWithoutIds(context) && context.cfg.layer !== Layer.Service) {
|
|
57
|
-
context = await context.updateContext(undefined, Layer.Service);
|
|
58
|
-
await context.waitForInitialized();
|
|
59
|
-
}
|
|
60
|
-
// The layer is keyed by the stable id where one exists — a per-entity database or schema
|
|
61
|
-
// name derived from a renameable slug would be orphaned by the first rename.
|
|
62
|
-
context = await context.updateContext(request.entity?.id ?? entitySlug, Layer.Entity);
|
|
63
|
-
await context.waitForInitialized();
|
|
64
|
-
// We elevate module to the context level if it was changed
|
|
65
|
-
module = context.entrypoint(module.alias);
|
|
66
|
-
await module.resolve();
|
|
67
|
-
}
|
|
68
48
|
}
|
|
69
49
|
// Update context in request object
|
|
70
50
|
req._ctx = context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/utils/guards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/utils/guards.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAKpD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,OAAU,EAAE,MAAwC,EACpD,GAAmB,EAAE,KAAmB,EACQ,EAAE;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IACjC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;QACvC,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QAEjD,IAAI,KAAK,GAA6B,SAAS,CAAA;QAC/C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAiB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;YACnD,IAAI,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;gBAC1C,KA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ot":"","sources":["../../src/utils/payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAE1C,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/utils/payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAE1C,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,EAAE,KAAK,OAAO,EAAE,YAAY,OAAO,KAAG,eAejF,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,UAAU,gBAAgB,CAAC,CAAC,CAAC,EAAE,OAAO,QAAQ,EAAE,eAAe,OAAO,KAAG,OAuB3G,CAAA;AAGD,eAAO,MAAM,cAAc,GAAI,QAAQ,eAAe,oBAgBrD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/utils/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE3D,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAG5D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAQ3E,KAAK,MAAM,GAAG,YAAY,CAAA;AAC1B,KAAK,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;AAEpC,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/utils/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE3D,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAG5D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAQ3E,KAAK,MAAM,GAAG,YAAY,CAAA;AAC1B,KAAK,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;AAEpC,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,EAAE,QAAQ,gBAAgB,KAAG,MAAM,IAAI,gBAAgB,CAAC,OAAO,CAY7G,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,QAAQ,gBAAgB,CAAC,cAAc,CAAC,EAAE,UAAU,MAAM,MACrF,KAAK,cAAc,EAAE,OAAO,YAAY,kBA0C9C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-api",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"@fastify/helmet": "^13.1.0",
|
|
33
33
|
"@fastify/middie": "^9.0.2",
|
|
34
34
|
"@fastify/multipart": "^9.0.1",
|
|
35
|
-
"@owlmeans/api": "^0.1.18-rc.
|
|
36
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
37
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
38
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
39
|
-
"@owlmeans/error": "^0.1.18-rc.
|
|
40
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
41
|
-
"@owlmeans/route": "^0.1.18-rc.
|
|
42
|
-
"@owlmeans/server-context": "^0.1.18-rc.
|
|
43
|
-
"@owlmeans/server-entrypoint": "^0.1.18-rc.
|
|
35
|
+
"@owlmeans/api": "^0.1.18-rc.11",
|
|
36
|
+
"@owlmeans/auth": "^0.1.18-rc.8",
|
|
37
|
+
"@owlmeans/auth-common": "^0.1.18-rc.11",
|
|
38
|
+
"@owlmeans/context": "^0.1.18-rc.7",
|
|
39
|
+
"@owlmeans/error": "^0.1.18-rc.7",
|
|
40
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.9",
|
|
41
|
+
"@owlmeans/route": "^0.1.18-rc.7",
|
|
42
|
+
"@owlmeans/server-context": "^0.1.18-rc.10",
|
|
43
|
+
"@owlmeans/server-entrypoint": "^0.1.18-rc.9",
|
|
44
44
|
"ajv-errors": "^3.0.0",
|
|
45
45
|
"fastify": "^5.0.0",
|
|
46
46
|
"fastify-raw-body": "^5.0.0",
|
package/src/server.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ServerConfig, ServerContext } from '@owlmeans/server-context'
|
|
2
2
|
import type { ApiServer, ApiServerAppend } from './types.js'
|
|
3
|
-
import {
|
|
3
|
+
import { assertContext, createService } from '@owlmeans/context'
|
|
4
4
|
import { canServeModule, executeResponse, provideRequest } from './utils/index.js'
|
|
5
5
|
import { DEFAULT_ALIAS, CLOSED_HOST, PORT, OPENED_HOST } from './consts.js'
|
|
6
6
|
import type { ServerEntrypoint } from '@owlmeans/server-entrypoint'
|
|
@@ -57,8 +57,6 @@ export const createApiServer = (alias: string): ApiServer => {
|
|
|
57
57
|
}*/
|
|
58
58
|
}),
|
|
59
59
|
|
|
60
|
-
layers: [Layer.System],
|
|
61
|
-
|
|
62
60
|
listen: async () => {
|
|
63
61
|
const context = _assertContext(service.ctx as Context)
|
|
64
62
|
|
|
@@ -133,10 +131,8 @@ export const createApiServer = (alias: string): ApiServer => {
|
|
|
133
131
|
return context
|
|
134
132
|
}
|
|
135
133
|
|
|
136
|
-
// await module.route.resolve(context as any)
|
|
137
|
-
await module.resolve()
|
|
138
134
|
// Actually intermediate module can be created without handler by elevate function
|
|
139
|
-
if (module.route.match(request) && module.handle != null) {
|
|
135
|
+
if (module.route.match(request, module.mount()) && module.handle != null) {
|
|
140
136
|
const response = provideResponse(reply)
|
|
141
137
|
const currentRequest = provideRequest(module.alias, request, true)
|
|
142
138
|
currentRequest.original._ctx = context
|
|
@@ -150,42 +146,38 @@ export const createApiServer = (alias: string): ApiServer => {
|
|
|
150
146
|
}, Promise.resolve(context))
|
|
151
147
|
})
|
|
152
148
|
|
|
153
|
-
|
|
154
|
-
context.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
headers: fixFormatDates(module.filter?.headers ?? {})
|
|
184
|
-
},
|
|
185
|
-
handler: createServerHandler(module, location)
|
|
186
|
-
})
|
|
149
|
+
context.entrypoints<ServerEntrypoint<FastifyRequest>>()
|
|
150
|
+
.filter(module => canServeModule(context, module) && !module.route.isIntermediate())
|
|
151
|
+
.forEach(module => {
|
|
152
|
+
const method = module.route.route.method ?? RouteMethod.GET
|
|
153
|
+
if (module.handle == null) {
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
server.route({
|
|
157
|
+
url: module.mount(), method,
|
|
158
|
+
schema: {
|
|
159
|
+
consumes: [
|
|
160
|
+
'application/json',
|
|
161
|
+
'application/x-www-form-urlencoded',
|
|
162
|
+
'multipart/form-data',
|
|
163
|
+
],
|
|
164
|
+
querystring: fixFormatDates(module.filter?.query ?? {}),
|
|
165
|
+
...(
|
|
166
|
+
[
|
|
167
|
+
RouteMethod.POST,
|
|
168
|
+
RouteMethod.PATCH,
|
|
169
|
+
RouteMethod.PUT
|
|
170
|
+
].includes(method)
|
|
171
|
+
? { body: fixFormatDates(module.filter?.body ?? {}) }
|
|
172
|
+
: {}
|
|
173
|
+
),
|
|
174
|
+
params: fixFormatDates(module.filter?.params ?? {}),
|
|
175
|
+
response: module.filter?.response,
|
|
176
|
+
headers: fixFormatDates(module.filter?.headers ?? {})
|
|
177
|
+
},
|
|
178
|
+
handler: createServerHandler(module, location)
|
|
187
179
|
})
|
|
188
|
-
|
|
180
|
+
})
|
|
189
181
|
|
|
190
182
|
service.initialized = true
|
|
191
183
|
})
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import type { InitializedService
|
|
2
|
+
import type { InitializedService } from '@owlmeans/context'
|
|
3
3
|
import type { ServerConfig, ServerContext } from '@owlmeans/server-context'
|
|
4
4
|
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'
|
|
5
5
|
import '@fastify/middie/types/index.d.ts'
|
|
@@ -7,8 +7,6 @@ import '@fastify/middie/types/index.d.ts'
|
|
|
7
7
|
export interface ApiServer extends InitializedService {
|
|
8
8
|
server: FastifyInstance
|
|
9
9
|
|
|
10
|
-
layers: [Layer.System]
|
|
11
|
-
|
|
12
10
|
listen: () => Promise<void>
|
|
13
11
|
}
|
|
14
12
|
|
package/src/utils/guards.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isContextWithoutIds, Layer } from '@owlmeans/context'
|
|
2
1
|
import type { FastifyReply, FastifyRequest } from 'fastify'
|
|
3
2
|
import type { ServerEntrypoint } from '@owlmeans/server-entrypoint'
|
|
4
3
|
import type { GuardService } from '@owlmeans/entrypoint'
|
|
@@ -7,7 +6,6 @@ import type { ServerConfig, ServerContext } from '@owlmeans/server-context'
|
|
|
7
6
|
import { executeResponse, provideRequest } from './payload.js'
|
|
8
7
|
import { AuthFailedError } from '../errors.js'
|
|
9
8
|
import type { Auth } from '@owlmeans/auth'
|
|
10
|
-
import { entitySlugOf } from '@owlmeans/auth'
|
|
11
9
|
import { attachEntity } from '@owlmeans/auth-common'
|
|
12
10
|
|
|
13
11
|
type Config = ServerConfig
|
|
@@ -56,33 +54,12 @@ export const authorize = async <C extends Config, T extends Context<C>>(
|
|
|
56
54
|
// infrastructure names — keys on the entity's stable id. Resolving here, once, is what keeps a
|
|
57
55
|
// rename from being a sweep of every handler: the id arrives on the request, and a slug that
|
|
58
56
|
// has since been retired still resolves to the entity that retired it.
|
|
59
|
-
const entitySlug = entitySlugOf(request.auth)
|
|
60
57
|
const entity = await attachEntity(context, request)
|
|
61
58
|
if (entity != null) {
|
|
62
59
|
// Carried on the raw request the same way `_auth` is, so the request the handler is given
|
|
63
60
|
// later — a different object, built after this runs — sees the same resolution.
|
|
64
61
|
;(req as any)._entity = entity
|
|
65
62
|
}
|
|
66
|
-
|
|
67
|
-
if (entitySlug != null) {
|
|
68
|
-
// @TODO Probably we need to downgrade context in this case
|
|
69
|
-
if (!isContextWithoutIds(context as any)) {
|
|
70
|
-
throw SyntaxError(`Context should be without ids during authorization ${context.cfg.layer}:${context.cfg.layerId}`)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (isContextWithoutIds(context as any) && context.cfg.layer !== Layer.Service) {
|
|
74
|
-
context = await context.updateContext(undefined, Layer.Service)
|
|
75
|
-
await context.waitForInitialized()
|
|
76
|
-
}
|
|
77
|
-
// The layer is keyed by the stable id where one exists — a per-entity database or schema
|
|
78
|
-
// name derived from a renameable slug would be orphaned by the first rename.
|
|
79
|
-
context = await context.updateContext(request.entity?.id ?? entitySlug, Layer.Entity)
|
|
80
|
-
await context.waitForInitialized()
|
|
81
|
-
|
|
82
|
-
// We elevate module to the context level if it was changed
|
|
83
|
-
module = context.entrypoint(module.alias)
|
|
84
|
-
await module.resolve()
|
|
85
|
-
}
|
|
86
63
|
}
|
|
87
64
|
// Update context in request object
|
|
88
65
|
(req as any)._ctx = context
|
package/build/.gitkeep
DELETED
|
File without changes
|