@toa.io/extensions.exposition 1.0.0-alpha.287 → 1.0.0-alpha.289
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/CHANGELOG.md +19 -0
- package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
- package/components/identity.clients/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
- package/components/identity.grants/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/manifest.toa.yaml +2 -1
- package/components/identity.passkeys/source/errors.test.ts +34 -0
- package/components/identity.passkeys/source/webauthn.test.ts +26 -0
- package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/types/toa.d.ts +1 -1
- package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/documentation/access.md +23 -4
- package/documentation/discovery.md +81 -0
- package/documentation/help.md +122 -0
- package/documentation/introspection.md +42 -9
- package/documentation/mcp.md +13 -16
- package/documentation/octets.md +20 -0
- package/features/cors.feature +31 -1
- package/features/dev.feature +2 -0
- package/features/discovery.feature +213 -0
- package/features/discovery.ui.feature +213 -0
- package/features/help.feature +512 -0
- package/features/introspection.feature +94 -8
- package/features/map.feature +1 -0
- package/features/mcp.feature +74 -12
- package/features/methods.feature +2 -1
- package/features/oauth.grants.feature +3 -1
- package/features/octets.download.feature +1 -0
- package/features/octets.feature +59 -0
- package/features/octets.meta.feature +1 -0
- package/features/site/_app/immutable/asset.js +1 -0
- package/features/site/favicon.ico +0 -0
- package/features/site/index.html +10 -0
- package/features/steps/Components.ts +4 -2
- package/features/steps/Database.ts +7 -1
- package/features/steps/Gateway.ts +23 -21
- package/features/steps/Parameters.ts +37 -16
- package/features/steps/Realtime.ts +3 -3
- package/package.json +7 -5
- package/readme.md +3 -0
- package/source/Directive.ts +4 -11
- package/source/Discovery/Explorer.ts +34 -0
- package/source/Discovery/Site.test.ts +147 -0
- package/source/Discovery/Site.ts +202 -0
- package/source/Discovery/index.ts +3 -0
- package/source/Discovery/tree.test.ts +175 -0
- package/source/Discovery/tree.ts +77 -0
- package/source/Discovery/trunk.ts +33 -0
- package/source/Endpoint.ts +4 -0
- package/source/Factory.ts +3 -86
- package/source/Gateway.ts +34 -4
- package/source/HTTP/Context.ts +7 -0
- package/source/HTTP/Probe.ts +0 -11
- package/source/HTTP/Server.ts +2 -3
- package/source/HTTP/messages.ts +4 -2
- package/source/Introspection.ts +58 -7
- package/source/MCP/schema.ts +16 -5
- package/source/MCP/tools.ts +14 -32
- package/source/Mapping.ts +5 -0
- package/source/Query.ts +17 -2
- package/source/RTD/Directives.ts +10 -0
- package/source/RTD/Endpoint.ts +8 -1
- package/source/RTD/Node.ts +20 -6
- package/source/RTD/Tree.ts +19 -9
- package/source/RTD/factory.ts +37 -1
- package/source/RTD/segment.ts +21 -0
- package/source/const.ts +26 -0
- package/source/deployment.ts +2 -2
- package/source/directives/auth/Anonymous.test.ts +31 -5
- package/source/directives/auth/Anonymous.ts +15 -3
- package/source/directives/auth/Anyone.ts +6 -0
- package/source/directives/auth/Assert.ts +5 -0
- package/source/directives/auth/Delegate.ts +5 -2
- package/source/directives/auth/Federation.ts +11 -0
- package/source/directives/auth/Id.ts +15 -0
- package/source/directives/auth/Input.ts +5 -0
- package/source/directives/auth/Role.ts +17 -0
- package/source/directives/cors/CORS.test.ts +75 -0
- package/source/directives/cors/CORS.ts +10 -3
- package/source/directives/help/Family.ts +122 -0
- package/source/directives/help/Help.test.ts +227 -0
- package/source/directives/help/Help.ts +47 -0
- package/source/directives/help/Parameters.ts +47 -0
- package/source/directives/help/described.ts +57 -0
- package/source/directives/help/index.ts +45 -0
- package/source/directives/index.ts +8 -1
- package/source/directives/map/Headers.ts +6 -6
- package/source/directives/mcp/MCP.ts +12 -21
- package/source/directives/mcp/Tool.test.ts +22 -68
- package/source/directives/mcp/Tool.ts +14 -41
- package/source/directives/octets/Directive.ts +7 -0
- package/source/directives/octets/Octets.ts +8 -0
- package/source/directives/octets/Put.ts +10 -0
- package/source/manifest.ts +1 -1
- package/source/root.ts +2 -2
- package/source/service.ts +94 -0
- package/source/shortcuts.ts +14 -0
- package/transpiled/Directive.d.ts +1 -1
- package/transpiled/Directive.js +3 -11
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/Discovery/Explorer.d.ts +11 -0
- package/transpiled/Discovery/Explorer.js +29 -0
- package/transpiled/Discovery/Explorer.js.map +1 -0
- package/transpiled/Discovery/Site.d.ts +43 -0
- package/transpiled/Discovery/Site.js +171 -0
- package/transpiled/Discovery/Site.js.map +1 -0
- package/transpiled/Discovery/index.d.ts +3 -0
- package/transpiled/Discovery/index.js +4 -0
- package/transpiled/Discovery/index.js.map +1 -0
- package/transpiled/Discovery/tree.d.ts +26 -0
- package/transpiled/Discovery/tree.js +50 -0
- package/transpiled/Discovery/tree.js.map +1 -0
- package/transpiled/Discovery/trunk.d.ts +13 -0
- package/transpiled/Discovery/trunk.js +29 -0
- package/transpiled/Discovery/trunk.js.map +1 -0
- package/transpiled/Endpoint.d.ts +2 -1
- package/transpiled/Endpoint.js +3 -0
- package/transpiled/Endpoint.js.map +1 -1
- package/transpiled/Factory.js +3 -61
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.d.ts +4 -0
- package/transpiled/Gateway.js +29 -4
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Context.d.ts +6 -0
- package/transpiled/HTTP/Context.js +6 -0
- package/transpiled/HTTP/Context.js.map +1 -1
- package/transpiled/HTTP/Probe.d.ts +0 -10
- package/transpiled/HTTP/Probe.js +0 -10
- package/transpiled/HTTP/Probe.js.map +1 -1
- package/transpiled/HTTP/Server.d.ts +0 -1
- package/transpiled/HTTP/Server.js +2 -2
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/messages.js +4 -2
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Introspection.d.ts +38 -6
- package/transpiled/Introspection.js +18 -1
- package/transpiled/Introspection.js.map +1 -1
- package/transpiled/MCP/schema.d.ts +2 -2
- package/transpiled/MCP/schema.js +11 -5
- package/transpiled/MCP/schema.js.map +1 -1
- package/transpiled/MCP/tools.d.ts +1 -1
- package/transpiled/MCP/tools.js +12 -28
- package/transpiled/MCP/tools.js.map +1 -1
- package/transpiled/Mapping.d.ts +2 -0
- package/transpiled/Mapping.js +4 -0
- package/transpiled/Mapping.js.map +1 -1
- package/transpiled/Query.d.ts +12 -0
- package/transpiled/Query.js +16 -2
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RTD/Directives.d.ts +8 -0
- package/transpiled/RTD/Endpoint.d.ts +7 -1
- package/transpiled/RTD/Node.d.ts +11 -2
- package/transpiled/RTD/Node.js +12 -2
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Tree.js +15 -8
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/RTD/factory.js +27 -1
- package/transpiled/RTD/factory.js.map +1 -1
- package/transpiled/RTD/segment.d.ts +7 -0
- package/transpiled/RTD/segment.js +17 -0
- package/transpiled/RTD/segment.js.map +1 -1
- package/transpiled/const.d.ts +21 -0
- package/transpiled/const.js +21 -0
- package/transpiled/const.js.map +1 -1
- package/transpiled/deployment.js +2 -2
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/auth/Anonymous.d.ts +11 -2
- package/transpiled/directives/auth/Anonymous.js +13 -3
- package/transpiled/directives/auth/Anonymous.js.map +1 -1
- package/transpiled/directives/auth/Anyone.d.ts +3 -0
- package/transpiled/directives/auth/Anyone.js +4 -0
- package/transpiled/directives/auth/Anyone.js.map +1 -1
- package/transpiled/directives/auth/Assert.d.ts +2 -0
- package/transpiled/directives/auth/Assert.js +4 -0
- package/transpiled/directives/auth/Assert.js.map +1 -1
- package/transpiled/directives/auth/Delegate.d.ts +4 -1
- package/transpiled/directives/auth/Delegate.js +5 -2
- package/transpiled/directives/auth/Delegate.js.map +1 -1
- package/transpiled/directives/auth/Federation.d.ts +5 -0
- package/transpiled/directives/auth/Federation.js +8 -0
- package/transpiled/directives/auth/Federation.js.map +1 -1
- package/transpiled/directives/auth/Id.d.ts +9 -0
- package/transpiled/directives/auth/Id.js +12 -0
- package/transpiled/directives/auth/Id.js.map +1 -1
- package/transpiled/directives/auth/Input.d.ts +2 -0
- package/transpiled/directives/auth/Input.js +4 -0
- package/transpiled/directives/auth/Input.js.map +1 -1
- package/transpiled/directives/auth/Role.d.ts +7 -0
- package/transpiled/directives/auth/Role.js +11 -0
- package/transpiled/directives/auth/Role.js.map +1 -1
- package/transpiled/directives/cors/CORS.js +9 -2
- package/transpiled/directives/cors/CORS.js.map +1 -1
- package/transpiled/directives/help/Family.d.ts +28 -0
- package/transpiled/directives/help/Family.js +83 -0
- package/transpiled/directives/help/Family.js.map +1 -0
- package/transpiled/directives/help/Help.d.ts +22 -0
- package/transpiled/directives/help/Help.js +36 -0
- package/transpiled/directives/help/Help.js.map +1 -0
- package/transpiled/directives/help/Parameters.d.ts +18 -0
- package/transpiled/directives/help/Parameters.js +34 -0
- package/transpiled/directives/help/Parameters.js.map +1 -0
- package/transpiled/directives/help/described.d.ts +16 -0
- package/transpiled/directives/help/described.js +23 -0
- package/transpiled/directives/help/described.js.map +1 -0
- package/transpiled/directives/help/index.d.ts +22 -0
- package/transpiled/directives/help/index.js +34 -0
- package/transpiled/directives/help/index.js.map +1 -0
- package/transpiled/directives/index.d.ts +4 -0
- package/transpiled/directives/index.js +8 -1
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/map/Headers.d.ts +5 -0
- package/transpiled/directives/map/Headers.js +7 -5
- package/transpiled/directives/map/Headers.js.map +1 -1
- package/transpiled/directives/mcp/MCP.d.ts +8 -5
- package/transpiled/directives/mcp/MCP.js +9 -13
- package/transpiled/directives/mcp/MCP.js.map +1 -1
- package/transpiled/directives/mcp/Tool.d.ts +6 -12
- package/transpiled/directives/mcp/Tool.js +10 -23
- package/transpiled/directives/mcp/Tool.js.map +1 -1
- package/transpiled/directives/octets/Directive.d.ts +6 -0
- package/transpiled/directives/octets/Directive.js.map +1 -1
- package/transpiled/directives/octets/Octets.d.ts +3 -0
- package/transpiled/directives/octets/Octets.js +6 -0
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/octets/Put.d.ts +3 -0
- package/transpiled/directives/octets/Put.js +8 -0
- package/transpiled/directives/octets/Put.js.map +1 -1
- package/transpiled/manifest.js +1 -1
- package/transpiled/root.js +2 -2
- package/transpiled/root.js.map +1 -1
- package/transpiled/service.d.ts +7 -0
- package/transpiled/service.js +74 -0
- package/transpiled/service.js.map +1 -0
- package/transpiled/shortcuts.d.ts +3 -0
- package/transpiled/shortcuts.js +13 -0
- package/transpiled/shortcuts.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/dist/_app/env.js +1 -0
- package/ui/dist/_app/immutable/assets/0.Bl7vLmIK.css +2 -0
- package/ui/dist/_app/immutable/assets/2.BC0-Jhqu.css +1 -0
- package/ui/dist/_app/immutable/assets/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
- package/ui/dist/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/ui/dist/_app/immutable/chunks/CDMRPWCx.js +6 -0
- package/ui/dist/_app/immutable/chunks/DJTKIUs8.js +1 -0
- package/ui/dist/_app/immutable/chunks/DjIYL2zC.js +3 -0
- package/ui/dist/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/ui/dist/_app/immutable/chunks/z-DVUbQC.js +1 -0
- package/ui/dist/_app/immutable/entry/app.5S2Jtv46.js +2 -0
- package/ui/dist/_app/immutable/entry/start.Bqi6IBmH.js +1 -0
- package/ui/dist/_app/immutable/nodes/0.D4LwNilH.js +1 -0
- package/ui/dist/_app/immutable/nodes/1.CSRya9So.js +1 -0
- package/ui/dist/_app/immutable/nodes/2.BtiGmR6I.js +14 -0
- package/ui/dist/_app/version.json +1 -0
- package/ui/dist/apple-touch-icon.png +0 -0
- package/ui/dist/favicon-96x96.png +0 -0
- package/ui/dist/favicon.ico +0 -0
- package/ui/dist/index.html +66 -0
- package/components/identity.bans/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.basic/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.clients/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.federation/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.grants/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.keys/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.otp/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.passkeys/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.roles/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.tokens/migrations/0001-system-properties.yaml +0 -14
|
@@ -4,99 +4,53 @@ import { Tool } from './Tool.js'
|
|
|
4
4
|
import { MCP } from './MCP.js'
|
|
5
5
|
|
|
6
6
|
describe('mcp:tool', () => {
|
|
7
|
-
it('should
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
assert.strictEqual(tool.description, 'The pots that are hot.')
|
|
11
|
-
assert.strictEqual(tool.title, undefined)
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('should take a title beside the description', () => {
|
|
15
|
-
const tool = new Tool(
|
|
16
|
-
{ title: 'Hot pots', description: 'The pots that are hot.' },
|
|
17
|
-
'/pots'
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
assert.strictEqual(tool.title, 'Hot pots')
|
|
21
|
-
assert.strictEqual(tool.description, 'The pots that are hot.')
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('should not accept a mapping without a description', () => {
|
|
25
|
-
assert.throws(() => new Tool({ title: 'Hot pots' }, '/pots'), /cannot be empty/)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('should not accept an empty title', () => {
|
|
29
|
-
assert.throws(
|
|
30
|
-
() => new Tool({ title: ' ', description: 'A pot.' }, '/pots'),
|
|
31
|
-
/a title cannot be empty/
|
|
32
|
-
)
|
|
7
|
+
it('should publish a method', () => {
|
|
8
|
+
assert.strictEqual(new Tool(true, '/pots/hot').published, true)
|
|
33
9
|
})
|
|
34
10
|
|
|
35
|
-
it('should
|
|
36
|
-
assert.
|
|
37
|
-
() => new Tool({ description: 'A pot.', name: 'pots' }, '/pots'),
|
|
38
|
-
/unknown 'name'/
|
|
39
|
-
)
|
|
11
|
+
it('should withdraw one, because a declaration is inherited', () => {
|
|
12
|
+
assert.strictEqual(new Tool(false, '/pots/hot').published, false)
|
|
40
13
|
})
|
|
41
14
|
|
|
42
|
-
it('should not accept
|
|
43
|
-
assert.throws(() => new Tool('
|
|
15
|
+
it('should not accept what a tool is, which is `help:method`', () => {
|
|
16
|
+
assert.throws(() => new Tool('The pots that are hot.', '/pots'), /`help:method`/)
|
|
17
|
+
assert.throws(() => new Tool({ title: 'Hot pots' }, '/pots'), /`help:method`/)
|
|
44
18
|
})
|
|
45
19
|
|
|
46
20
|
it('should not accept a value that is not one', () => {
|
|
47
|
-
|
|
48
|
-
assert.throws(() => new Tool(
|
|
49
|
-
assert.throws(() => new Tool(false, '/pots'), /the value is what the tool is/)
|
|
50
|
-
assert.throws(() => new Tool(1, '/pots'), /the value is what the tool is/)
|
|
51
|
-
assert.throws(() => new Tool(['A pot.'], '/pots'), /the value is what the tool is/)
|
|
21
|
+
assert.throws(() => new Tool(undefined, '/pots'), /whether the method is published/)
|
|
22
|
+
assert.throws(() => new Tool(null, '/pots'), /whether the method is published/)
|
|
52
23
|
})
|
|
53
24
|
|
|
54
25
|
it('should refuse a route no name can spell', () => {
|
|
55
|
-
assert.throws(() => new Tool(
|
|
56
|
-
assert.throws(() => new Tool('A pot.', '/pots/:a.b'), /no tool name can spell/)
|
|
57
|
-
|
|
58
|
-
// an underscore is what the convention keeps for itself
|
|
59
|
-
assert.throws(() => new Tool('A pot.', '/pots/a_b'), /no tool name can spell/)
|
|
26
|
+
assert.throws(() => new Tool(true, '/pots/v1.0'), /no tool name can spell/)
|
|
60
27
|
})
|
|
61
28
|
|
|
62
29
|
it('should name the route it refuses', () => {
|
|
63
|
-
assert.throws(() => new Tool(
|
|
30
|
+
assert.throws(() => new Tool(true, '/pots/v1.0'), /'\/pots\/v1\.0'/)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('should not ask a route it does not publish to be spellable', () => {
|
|
34
|
+
assert.strictEqual(new Tool(false, '/pots/v1.0').published, false)
|
|
64
35
|
})
|
|
65
36
|
})
|
|
66
37
|
|
|
67
38
|
describe('mcp:tool inheritance', () => {
|
|
68
|
-
const
|
|
39
|
+
const mcp = new MCP()
|
|
69
40
|
|
|
70
41
|
it('should take the nearest declaration', () => {
|
|
71
|
-
const
|
|
72
|
-
const
|
|
42
|
+
const nearest = new Tool(false, '/pots')
|
|
43
|
+
const further = new Tool(true, '/pots')
|
|
73
44
|
|
|
74
|
-
assert.strictEqual(MCP.published([
|
|
45
|
+
assert.strictEqual(MCP.published([nearest, further]), false)
|
|
75
46
|
})
|
|
76
47
|
|
|
77
48
|
it('should publish nothing where nothing is declared', () => {
|
|
78
|
-
assert.strictEqual(MCP.published(undefined),
|
|
79
|
-
assert.strictEqual(MCP.published([]),
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('should describe a method with what the route states', () => {
|
|
83
|
-
const described = family.explain(
|
|
84
|
-
[new Tool('What the route is.', '/pots')],
|
|
85
|
-
null as never,
|
|
86
|
-
{ description: 'What the operation is.' }
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
assert.strictEqual(described.description, 'What the route is.')
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
it('should state nothing where nothing is declared', () => {
|
|
93
|
-
assert.strictEqual(family.explain([], null as never, {}).description, undefined)
|
|
49
|
+
assert.strictEqual(MCP.published(undefined), false)
|
|
50
|
+
assert.strictEqual(MCP.published([]), false)
|
|
94
51
|
})
|
|
95
52
|
|
|
96
53
|
it('should refuse a directive it does not know', () => {
|
|
97
|
-
assert.throws(
|
|
98
|
-
() => family.create('resource', 'A pot.', null, '/pots'),
|
|
99
|
-
/Unknown directive: mcp:resource/
|
|
100
|
-
)
|
|
54
|
+
assert.throws(() => mcp.create('tools', true, null, '/pots'), /Unknown directive/)
|
|
101
55
|
})
|
|
102
56
|
})
|
|
@@ -3,57 +3,30 @@ import { refusal } from '../../RPC/names.js'
|
|
|
3
3
|
import { segment } from '../../RTD/segment.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* says
|
|
8
|
-
*
|
|
6
|
+
* Whether one method is published to a model. Declaring it is what publishes it, and it
|
|
7
|
+
* says nothing else — what a tool is, is [`help:method`](../help/Help.ts), which is what
|
|
8
|
+
* describes the method to everything else as well.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* a mapping.
|
|
13
|
-
*
|
|
14
|
-
* The operation states what it is too, and that is not this. An operation is written without
|
|
15
|
-
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
16
|
-
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
10
|
+
* `false` withdraws one: the declaration is inherited, as every directive is, and a node
|
|
11
|
+
* publishing what is under it is how a subtree is published at all.
|
|
17
12
|
*/
|
|
18
13
|
export class Tool {
|
|
19
|
-
public readonly
|
|
20
|
-
public readonly title: string | undefined
|
|
14
|
+
public readonly published: boolean
|
|
21
15
|
|
|
22
16
|
public constructor(value: unknown, route: string) {
|
|
23
|
-
const stated = typeof value === 'string' ? { description: value } : value
|
|
24
|
-
|
|
25
|
-
assert.ok(
|
|
26
|
-
typeof stated === 'object' && stated !== null && !Array.isArray(stated),
|
|
27
|
-
'Directive mcp:tool: the value is what the tool is, or a `title` and a `description`'
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
const { description, title, ...rest } = stated as Record<string, unknown>
|
|
31
|
-
|
|
32
|
-
assert.ok(
|
|
33
|
-
Object.keys(rest).length === 0,
|
|
34
|
-
`Directive mcp:tool: unknown ${Object.keys(rest)
|
|
35
|
-
.map((key) => `'${key}'`)
|
|
36
|
-
.join(', ')}`
|
|
37
|
-
)
|
|
38
|
-
|
|
39
17
|
assert.ok(
|
|
40
|
-
typeof
|
|
41
|
-
'Directive mcp:tool:
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
assert.ok(
|
|
45
|
-
title === undefined || (typeof title === 'string' && title.trim().length > 0),
|
|
46
|
-
'Directive mcp:tool: a title cannot be empty'
|
|
18
|
+
typeof value === 'boolean',
|
|
19
|
+
'Directive mcp:tool: the value is whether the method is published; what it is, is `help:method`'
|
|
47
20
|
)
|
|
48
21
|
|
|
49
22
|
// a tool is called by name, so a route that cannot be named cannot be one — said where
|
|
50
23
|
// the mistake is, rather than as a tool that is quietly never listed
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
24
|
+
if (value)
|
|
25
|
+
assert.ok(
|
|
26
|
+
refusal(segment(route)) === null,
|
|
27
|
+
`Directive mcp:tool: '${route}' holds a segment no tool name can spell`
|
|
28
|
+
)
|
|
55
29
|
|
|
56
|
-
this.
|
|
57
|
-
this.title = title as string | undefined
|
|
30
|
+
this.published = value
|
|
58
31
|
}
|
|
59
32
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Input } from './types.js'
|
|
2
2
|
import type { Parameter } from '../../RTD/index.js'
|
|
3
|
+
import type { Introspection } from '../../Introspection.js'
|
|
3
4
|
import type * as io from '../../io.js'
|
|
4
5
|
|
|
5
6
|
export abstract class Directive {
|
|
@@ -11,4 +12,10 @@ export abstract class Directive {
|
|
|
11
12
|
input: Input,
|
|
12
13
|
parameters: Parameter[]
|
|
13
14
|
): Promise<io.Output>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* What a caller has to know to make the request. Only sending a file takes anything a
|
|
18
|
+
* schema does not already say; reading one and deleting one take nothing.
|
|
19
|
+
*/
|
|
20
|
+
public describe?(introspection: Introspection): void
|
|
14
21
|
}
|
|
@@ -9,6 +9,7 @@ import type { Output } from '../../io.js'
|
|
|
9
9
|
import type { Component } from '@toa.io/core'
|
|
10
10
|
import type { Remotes } from '../../Remotes.js'
|
|
11
11
|
import type { Parameter, DirectiveFamily } from '../../RTD/index.js'
|
|
12
|
+
import type { Introspection } from '../../Introspection.js'
|
|
12
13
|
import type { Input } from './types.js'
|
|
13
14
|
|
|
14
15
|
export class Octets implements DirectiveFamily<Directive> {
|
|
@@ -28,6 +29,13 @@ export class Octets implements DirectiveFamily<Directive> {
|
|
|
28
29
|
return new Class(value, this.discovery, remotes)
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
/** What the request takes, which only sending a file says anything about. */
|
|
33
|
+
public explain(directives: Directive[], _: Input, introspection: Introspection): Introspection {
|
|
34
|
+
for (const directive of directives) directive.describe?.(introspection)
|
|
35
|
+
|
|
36
|
+
return introspection
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
public async precall(
|
|
32
40
|
directives: Directive[],
|
|
33
41
|
input: Input,
|
|
@@ -12,6 +12,7 @@ import type { Unit, Location } from './workflows/index.js'
|
|
|
12
12
|
import type { Entry } from '@toa.io/extensions.storages'
|
|
13
13
|
import type { Remotes } from '../../Remotes.js'
|
|
14
14
|
import type { Component } from '@toa.io/core'
|
|
15
|
+
import type { Introspection } from '../../Introspection.js'
|
|
15
16
|
import type { Output } from '../../io.js'
|
|
16
17
|
import type { Input } from './types.js'
|
|
17
18
|
|
|
@@ -63,6 +64,15 @@ export class Put extends Directive {
|
|
|
63
64
|
cors.allow('content-location')
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
/** What sending a file here takes: what may be sent, how much of it, and what comes back. */
|
|
68
|
+
public override describe(introspection: Introspection): void {
|
|
69
|
+
introspection.octets = {
|
|
70
|
+
...(this.accept === undefined ? {} : { accept: this.accept }),
|
|
71
|
+
limit: this.limitString,
|
|
72
|
+
...(this.workflow === undefined ? {} : { stream: true })
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
public async apply(
|
|
67
77
|
storage: string,
|
|
68
78
|
input: Input,
|
package/source/manifest.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert'
|
|
2
2
|
import { parse, type Node, type Method, type Query } from './RTD/syntax/index.js'
|
|
3
|
-
import { shortcuts } from './
|
|
3
|
+
import { shortcuts } from './shortcuts.js'
|
|
4
4
|
import * as schemas from './schemas.js'
|
|
5
5
|
import type { Manifest } from '@toa.io/norm'
|
|
6
6
|
|
package/source/root.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { merge } from '@toa.io/generic'
|
|
1
|
+
import { environment, merge } from '@toa.io/generic'
|
|
2
2
|
import { syntax } from './RTD/index.js'
|
|
3
3
|
|
|
4
4
|
export function resolve(): syntax.Node {
|
|
5
|
-
const value =
|
|
5
|
+
const value = environment.get('TOA_EXPOSITION')
|
|
6
6
|
const root =
|
|
7
7
|
value !== undefined ? (JSON.parse(value) as syntax.Node) : syntax.createNode()
|
|
8
8
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { console, traces, type LevelName, type TracesOptions } from 'openspan'
|
|
3
|
+
import { Gateway } from './Gateway.js'
|
|
4
|
+
import { Remotes } from './Remotes.js'
|
|
5
|
+
import { Tree } from './RTD/index.js'
|
|
6
|
+
import { EndpointsFactory } from './Endpoint.js'
|
|
7
|
+
import { families, interceptors } from './directives/index.js'
|
|
8
|
+
import { DirectivesFactory } from './Directive.js'
|
|
9
|
+
import { Composition } from './Composition.js'
|
|
10
|
+
import * as root from './root.js'
|
|
11
|
+
import { ATOM_GROUP, CHANNEL } from './const.js'
|
|
12
|
+
import { Interception } from './Interception.js'
|
|
13
|
+
import { Dispatcher } from './RPC/index.js'
|
|
14
|
+
import { Server as Model } from './MCP/index.js'
|
|
15
|
+
import * as http from './HTTP/index.js'
|
|
16
|
+
import { environment } from '@toa.io/generic'
|
|
17
|
+
import type { Broadcast } from './Gateway.js'
|
|
18
|
+
import type { Connector } from '@toa.io/core'
|
|
19
|
+
import type { Host } from './Factory.js'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The gateway. A composition loads this extension for its tenants alone, so what the
|
|
23
|
+
* gateway is made of is reached from here and nowhere the factory imports.
|
|
24
|
+
*/
|
|
25
|
+
export async function service(host: Host): Promise<Connector | null> {
|
|
26
|
+
const properties = environment.get('TOA_EXPOSITION_PROPERTIES')
|
|
27
|
+
|
|
28
|
+
assert.ok(properties !== undefined, 'TOA_EXPOSITION_PROPERTIES is undefined')
|
|
29
|
+
|
|
30
|
+
configureLogs()
|
|
31
|
+
|
|
32
|
+
const options = JSON.parse(properties) as http.Options
|
|
33
|
+
const broadcast: Broadcast = await host.broadcast(CHANNEL)
|
|
34
|
+
const server = http.Server.create({ ...options })
|
|
35
|
+
const remotes = new Remotes(host)
|
|
36
|
+
const node = root.resolve()
|
|
37
|
+
const methods = new EndpointsFactory(remotes)
|
|
38
|
+
const directives = new DirectivesFactory(families, remotes, host, options)
|
|
39
|
+
const interception = new Interception(interceptors, options)
|
|
40
|
+
const tree = new Tree(node, methods, directives)
|
|
41
|
+
|
|
42
|
+
const composition = new Composition(host)
|
|
43
|
+
const dispatcher = options.rpc === undefined ? null : new Dispatcher(options.rpc)
|
|
44
|
+
const mcp = options.mcp === undefined ? null : new Model(options.mcp, tree)
|
|
45
|
+
const gateway = new Gateway(broadcast, tree, interception, directives, dispatcher, mcp)
|
|
46
|
+
|
|
47
|
+
gateway.depends(remotes)
|
|
48
|
+
gateway.depends(composition)
|
|
49
|
+
// what the directives meter through; one atom per process, connected once
|
|
50
|
+
gateway.depends(host.atom(ATOM_GROUP))
|
|
51
|
+
|
|
52
|
+
server.attach(gateway.process.bind(gateway))
|
|
53
|
+
server.depends(gateway)
|
|
54
|
+
|
|
55
|
+
return server
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const LOGS_PREFIX = 'TOA_TELEMETRY_LOGS'
|
|
59
|
+
const TRACES_ENV = 'TOA_TELEMETRY_TRACES'
|
|
60
|
+
|
|
61
|
+
function configureLogs(): void {
|
|
62
|
+
const globEnv = environment.get(LOGS_PREFIX)
|
|
63
|
+
const level: LevelName = environment.get('TOA_DEV') === '1' ? 'trace' : 'info'
|
|
64
|
+
const options =
|
|
65
|
+
globEnv === undefined ? { level } : (JSON.parse(globEnv) as { level?: LevelName })
|
|
66
|
+
|
|
67
|
+
console.configure({ level: options.level ?? level })
|
|
68
|
+
|
|
69
|
+
const tracesEnv = environment.get(TRACES_ENV)
|
|
70
|
+
const tracing =
|
|
71
|
+
tracesEnv === undefined ? development() : (JSON.parse(tracesEnv) as TracesOptions)
|
|
72
|
+
|
|
73
|
+
// `openspan` is not Toa's and reads the environment, which no longer holds the context by
|
|
74
|
+
// the time the exporter is made — so the service is named here
|
|
75
|
+
if (tracing.exporters?.otlp !== undefined)
|
|
76
|
+
tracing.exporters.otlp.service ??= environment.get('TOA_CONTEXT')
|
|
77
|
+
|
|
78
|
+
traces(tracing)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Tracing is off unless it is configured. The console exporter is a local development
|
|
83
|
+
* mechanism, so it is turned on for `toa dev` and for a boot trace the CLI has already
|
|
84
|
+
* asked for (`runtime/boot/src/span.js`), and nowhere else — a deployment that wants
|
|
85
|
+
* traces annotates `telemetry.traces.exporters`.
|
|
86
|
+
*
|
|
87
|
+
* The gateway boots without the telemetry extension, hence the copy of
|
|
88
|
+
* `extensions/telemetry/source/extension.ts`.
|
|
89
|
+
*/
|
|
90
|
+
function development(): TracesOptions {
|
|
91
|
+
const local = environment.get('TOA_DEV') === '1' || environment.get('TOA_BOOT_TRACE') === '1'
|
|
92
|
+
|
|
93
|
+
return local ? { exporters: { console: {} } } : {}
|
|
94
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Shortcuts } from './RTD/syntax/index.js'
|
|
2
|
+
|
|
3
|
+
/** What a directive may be written as, where the family is implied. */
|
|
4
|
+
export const shortcuts: Shortcuts = new Map([
|
|
5
|
+
['anonymous', 'auth:anonymous'],
|
|
6
|
+
['anyone', 'auth:anyone'],
|
|
7
|
+
['id', 'auth:id'],
|
|
8
|
+
['role', 'auth:role'],
|
|
9
|
+
['rule', 'auth:rule'],
|
|
10
|
+
['incept', 'auth:incept'],
|
|
11
|
+
['input', 'io:input'],
|
|
12
|
+
['output', 'io:output'],
|
|
13
|
+
['languages', 'map:languages']
|
|
14
|
+
])
|
|
@@ -36,8 +36,8 @@ export declare class DirectivesFactory implements RTD.DirectiveFactory {
|
|
|
36
36
|
/** Request-scoped, on the message going back. */
|
|
37
37
|
depart(context: Context, response: OutgoingMessage): Promise<void>;
|
|
38
38
|
create(declarations: RTD.syntax.Directive[], route?: string): Directives;
|
|
39
|
+
inheritable(directive: RTD.syntax.Directive): boolean;
|
|
39
40
|
dispose(): void;
|
|
40
41
|
/** Mandatory families first, in their own order; everything else keeps its own. */
|
|
41
42
|
private rank;
|
|
42
43
|
}
|
|
43
|
-
export declare const shortcuts: RTD.syntax.Shortcuts;
|
package/transpiled/Directive.js
CHANGED
|
@@ -141,6 +141,9 @@ export class DirectivesFactory {
|
|
|
141
141
|
this.instances.push(directives);
|
|
142
142
|
return directives;
|
|
143
143
|
}
|
|
144
|
+
inheritable(directive) {
|
|
145
|
+
return this.families[directive.family]?.inherited !== false;
|
|
146
|
+
}
|
|
144
147
|
dispose() {
|
|
145
148
|
for (const directives of this.instances)
|
|
146
149
|
directives.dispose();
|
|
@@ -157,15 +160,4 @@ function options(set, stage) {
|
|
|
157
160
|
options.attributes = { directives: Array.from(new Set(set.names)).join(' ') };
|
|
158
161
|
return options;
|
|
159
162
|
}
|
|
160
|
-
export const shortcuts = new Map([
|
|
161
|
-
['anonymous', 'auth:anonymous'],
|
|
162
|
-
['anyone', 'auth:anyone'],
|
|
163
|
-
['id', 'auth:id'],
|
|
164
|
-
['role', 'auth:role'],
|
|
165
|
-
['rule', 'auth:rule'],
|
|
166
|
-
['incept', 'auth:incept'],
|
|
167
|
-
['input', 'io:input'],
|
|
168
|
-
['output', 'io:output'],
|
|
169
|
-
['languages', 'map:languages']
|
|
170
|
-
]);
|
|
171
163
|
//# sourceMappingURL=Directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Directive.js","sourceRoot":"","sources":["../source/Directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoB,MAAM,UAAU,CAAA;AAQpD,MAAM,OAAO,UAAU;IACJ,IAAI,CAAoB;IAEzC,iFAAiF;IAChE,KAAK,CAAS;IAE/B,YAAmB,IAAwB;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC9B,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC;YAC9B,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC;SACjC,CAAC,CAAC,CAAA;IACL,CAAC;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CAAA;QAE5C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAA;IACrD,CAAC;CACF;AAED,SAAS,OAAO,CACd,GAAqB,EACrB,KAAuC;IAEvC,MAAM,OAAO,GAAgB,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAA;IAEpE,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QACjD,OAAO,CAAC,UAAU,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IAE/E,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as http from '../HTTP/index.js';
|
|
2
|
+
import type { Tree } from '../RTD/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* What an application serves, for every route at once. Each entry is what `OPTIONS` on that
|
|
5
|
+
* path answers, so a key taken from here is a request that can be made.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Explorer {
|
|
8
|
+
private readonly tree;
|
|
9
|
+
constructor(tree: Tree);
|
|
10
|
+
process(context: http.Context): Promise<http.OutgoingMessage>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as http from '../HTTP/index.js';
|
|
2
|
+
import { BRANCH_TTL } from '../const.js';
|
|
3
|
+
import { describe } from './tree.js';
|
|
4
|
+
/**
|
|
5
|
+
* What an application serves, for every route at once. Each entry is what `OPTIONS` on that
|
|
6
|
+
* path answers, so a key taken from here is a request that can be made.
|
|
7
|
+
*/
|
|
8
|
+
export class Explorer {
|
|
9
|
+
tree;
|
|
10
|
+
constructor(tree) {
|
|
11
|
+
this.tree = tree;
|
|
12
|
+
}
|
|
13
|
+
async process(context) {
|
|
14
|
+
if (context.request.method !== 'OPTIONS')
|
|
15
|
+
throw new http.MethodNotAllowed(new Headers({ allow: ALLOW }));
|
|
16
|
+
return {
|
|
17
|
+
body: await describe(this.tree, context),
|
|
18
|
+
headers: new Headers({
|
|
19
|
+
allow: ALLOW,
|
|
20
|
+
// it stands until a branch expires, and it is filtered by who asked
|
|
21
|
+
'cache-control': `private, max-age=${BRANCH_TTL / 1000}`,
|
|
22
|
+
vary: 'authorization'
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** The verbs of this path, which are not the verbs of the tree it answers with. */
|
|
28
|
+
const ALLOW = 'GET, HEAD, OPTIONS';
|
|
29
|
+
//# sourceMappingURL=Explorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../../source/Discovery/Explorer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGpC;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACF,IAAI,CAAM;IAE3B,YAAmB,IAAU;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAqB;QACxC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS;YACtC,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;QAEhE,OAAO;YACL,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;YACxC,OAAO,EAAE,IAAI,OAAO,CAAC;gBACnB,KAAK,EAAE,KAAK;gBACZ,oEAAoE;gBACpE,eAAe,EAAE,oBAAoB,UAAU,GAAG,IAAI,EAAE;gBACxD,IAAI,EAAE,eAAe;aACtB,CAAC;SACH,CAAA;IACH,CAAC;CACF;AAED,mFAAmF;AACnF,MAAM,KAAK,GAAG,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Input, Output } from '../io.js';
|
|
2
|
+
import type { Interceptor } from '../Interception.js';
|
|
3
|
+
/**
|
|
4
|
+
* The page that reads the tree: the directory `ui` builds, and nothing else.
|
|
5
|
+
*
|
|
6
|
+
* An interceptor rather than an endpoint, for the reason the OAuth documents are one — it
|
|
7
|
+
* runs before a credential is resolved. A page is public, and one served after `auth` would
|
|
8
|
+
* refuse the client holding a stale token, who is the client most likely to have opened it.
|
|
9
|
+
* It is also what keeps `depart` off these replies: a re-issued credential sets `no-store`,
|
|
10
|
+
* which would take the build hash off every asset that carries one.
|
|
11
|
+
*
|
|
12
|
+
* It claims the whole prefix, so that nothing under it reaches the router — a crawler
|
|
13
|
+
* asking for assets that are not there would otherwise have every one of them counted as a
|
|
14
|
+
* route that has gone missing, and ping discovery about it.
|
|
15
|
+
*
|
|
16
|
+
* `OPTIONS` on the prefix itself is the exception it lets through: the tree is what answers
|
|
17
|
+
* there, and that needs the identity this stage does not have yet.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Site implements Interceptor {
|
|
20
|
+
readonly name = "discovery";
|
|
21
|
+
/** What a test points at a fixture; the build otherwise. */
|
|
22
|
+
private readonly override;
|
|
23
|
+
private root;
|
|
24
|
+
constructor(root?: string);
|
|
25
|
+
/**
|
|
26
|
+
* Resolved here rather than at construction because this is a module singleton, built
|
|
27
|
+
* when the module loads and before anything has said where the page is. Said once, too,
|
|
28
|
+
* because a page that is not built is otherwise a `503` per request and nothing else.
|
|
29
|
+
*/
|
|
30
|
+
mount(): void;
|
|
31
|
+
intercept(input: Input): Output;
|
|
32
|
+
/**
|
|
33
|
+
* The file a request lands on, or `null` when nothing does. A path that exists is served
|
|
34
|
+
* as it is; anything else that could be a route falls back to the page, because the
|
|
35
|
+
* client router — not this server — knows what routes there are.
|
|
36
|
+
*/
|
|
37
|
+
private resolve;
|
|
38
|
+
/**
|
|
39
|
+
* Always with a `content-type` of its own: a stream without one is framed as
|
|
40
|
+
* `multipart/*` and the page arrives as an envelope of JSON-encoded buffers.
|
|
41
|
+
*/
|
|
42
|
+
private send;
|
|
43
|
+
}
|