@toa.io/extensions.exposition 1.0.0-alpha.291 → 1.0.0-alpha.292
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 +7 -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/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/features/steps/Gateway.ts +1 -2
- package/package.json +6 -5
- package/source/Discovery/Explorer.ts +1 -1
- package/source/Discovery/Site.ts +1 -1
- package/source/Discovery/trunk.ts +1 -1
- package/source/Factory.ts +1 -1
- package/source/Gateway.ts +1 -1
- package/source/HTTP/Server.ts +7 -2
- package/source/MCP/Server.ts +2 -2
- package/source/MCP/discover.ts +1 -1
- package/source/Query.ts +1 -1
- package/source/RPC/Dispatcher.ts +3 -3
- package/source/RTD/Tree.ts +1 -1
- package/source/RTD/factory.ts +1 -1
- package/source/RTD/syntax/index.ts +1 -2
- package/source/Tenant.ts +1 -1
- package/source/directives/auth/Authorization.ts +1 -1
- package/source/directives/io/IO.ts +1 -1
- package/source/directives/oauth/documents.ts +1 -1
- package/source/index.ts +0 -2
- package/source/service.ts +3 -2
- package/transpiled/Discovery/Explorer.js +1 -1
- package/transpiled/Discovery/Explorer.js.map +1 -1
- package/transpiled/Discovery/Site.js +1 -1
- package/transpiled/Discovery/Site.js.map +1 -1
- package/transpiled/Discovery/trunk.js +1 -1
- package/transpiled/Discovery/trunk.js.map +1 -1
- package/transpiled/Factory.js +1 -1
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.js +1 -1
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Server.d.ts +1 -1
- package/transpiled/HTTP/Server.js +1 -1
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/MCP/Server.d.ts +1 -1
- package/transpiled/MCP/Server.js +1 -1
- package/transpiled/MCP/Server.js.map +1 -1
- package/transpiled/MCP/discover.d.ts +1 -1
- package/transpiled/Query.js +1 -1
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RPC/Dispatcher.d.ts +1 -1
- package/transpiled/RPC/Dispatcher.js +2 -2
- package/transpiled/RPC/Dispatcher.js.map +1 -1
- package/transpiled/RTD/Tree.js +1 -1
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/RTD/factory.js +1 -1
- package/transpiled/RTD/factory.js.map +1 -1
- package/transpiled/RTD/syntax/index.d.ts +1 -2
- package/transpiled/RTD/syntax/index.js +1 -2
- package/transpiled/RTD/syntax/index.js.map +1 -1
- package/transpiled/Tenant.js +1 -1
- package/transpiled/Tenant.js.map +1 -1
- package/transpiled/directives/auth/Authorization.js +1 -1
- package/transpiled/directives/auth/Authorization.js.map +1 -1
- package/transpiled/directives/io/IO.js +1 -1
- package/transpiled/directives/io/IO.js.map +1 -1
- package/transpiled/directives/oauth/documents.d.ts +1 -1
- package/transpiled/index.d.ts +0 -2
- package/transpiled/index.js +0 -2
- package/transpiled/index.js.map +1 -1
- package/transpiled/service.js +1 -1
- package/transpiled/service.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/dist/_app/immutable/chunks/BaWe3aOV.js +1 -0
- package/ui/dist/_app/immutable/chunks/{B_pK3U1C.js → GZTfV0ks.js} +2 -2
- package/ui/dist/_app/immutable/chunks/{D9tE1yyO.js → aLpTDmOc.js} +1 -1
- package/ui/dist/_app/immutable/entry/{app.DMqmL4NY.js → app.D5v4JoUx.js} +2 -2
- package/ui/dist/_app/immutable/entry/start.CWxFoIyZ.js +1 -0
- package/ui/dist/_app/immutable/nodes/{0.D9m-6cbM.js → 0.DIh5T_5-.js} +1 -1
- package/ui/dist/_app/immutable/nodes/{1.Cgi_RcSO.js → 1.CY-bFzHC.js} +1 -1
- package/ui/dist/_app/immutable/nodes/{2.D_Cbxgz4.js → 2.6Ubd1ItY.js} +1 -1
- package/ui/dist/_app/version.json +1 -1
- package/ui/dist/index.html +10 -10
- package/schemas/annotation.cos.yaml +0 -125
- package/schemas/call.cos.yaml +0 -18
- package/schemas/directive.cos.yaml +0 -7
- package/schemas/method.cos.yaml +0 -23
- package/schemas/node.cos.yaml +0 -22
- package/schemas/query.cos.yaml +0 -31
- package/schemas/querystring.cos.yaml +0 -19
- package/schemas/range.cos.yaml +0 -10
- package/schemas/route.cos.yaml +0 -6
- package/source/Annotation.ts +0 -89
- package/source/RTD/syntax/parse.test.ts +0 -196
- package/source/RTD/syntax/parse.ts +0 -171
- package/source/RTD/syntax/types.ts +0 -69
- package/source/const.ts +0 -45
- package/source/deployment.ts +0 -96
- package/source/manifest.test.ts +0 -56
- package/source/manifest.ts +0 -56
- package/source/schemas.test.ts +0 -31
- package/source/schemas.ts +0 -15
- package/source/shortcuts.ts +0 -14
- package/transpiled/Annotation.d.ts +0 -70
- package/transpiled/Annotation.js +0 -2
- package/transpiled/Annotation.js.map +0 -1
- package/transpiled/RTD/syntax/parse.d.ts +0 -4
- package/transpiled/RTD/syntax/parse.js +0 -112
- package/transpiled/RTD/syntax/parse.js.map +0 -1
- package/transpiled/RTD/syntax/types.d.ts +0 -52
- package/transpiled/RTD/syntax/types.js +0 -11
- package/transpiled/RTD/syntax/types.js.map +0 -1
- package/transpiled/const.d.ts +0 -36
- package/transpiled/const.js +0 -37
- package/transpiled/const.js.map +0 -1
- package/transpiled/deployment.d.ts +0 -6
- package/transpiled/deployment.js +0 -76
- package/transpiled/deployment.js.map +0 -1
- package/transpiled/manifest.d.ts +0 -3
- package/transpiled/manifest.js +0 -39
- package/transpiled/manifest.js.map +0 -1
- package/transpiled/schemas.d.ts +0 -9
- package/transpiled/schemas.js +0 -9
- package/transpiled/schemas.js.map +0 -1
- package/transpiled/shortcuts.d.ts +0 -3
- package/transpiled/shortcuts.js +0 -13
- package/transpiled/shortcuts.js.map +0 -1
- package/ui/dist/_app/immutable/chunks/CiKbPLyY.js +0 -1
- package/ui/dist/_app/immutable/entry/start.CRe7HWBI.js +0 -1
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
properties:
|
|
2
|
-
class:
|
|
3
|
-
type: string
|
|
4
|
-
resources:
|
|
5
|
-
# `null` deploys the service without any, which every deployment has to state one way
|
|
6
|
-
# or the other — see `migrations/262.md`.
|
|
7
|
-
type: object
|
|
8
|
-
nullable: true
|
|
9
|
-
properties:
|
|
10
|
-
cpu:
|
|
11
|
-
type: array
|
|
12
|
-
items:
|
|
13
|
-
type: string
|
|
14
|
-
minItems: 2
|
|
15
|
-
maxItems: 2
|
|
16
|
-
memory:
|
|
17
|
-
type: array
|
|
18
|
-
items:
|
|
19
|
-
type: string
|
|
20
|
-
minItems: 2
|
|
21
|
-
maxItems: 2
|
|
22
|
-
annotations:
|
|
23
|
-
type: object
|
|
24
|
-
patternProperties:
|
|
25
|
-
^.+$:
|
|
26
|
-
type: string
|
|
27
|
-
service:
|
|
28
|
-
type: object
|
|
29
|
-
properties:
|
|
30
|
-
annotations:
|
|
31
|
-
type: object
|
|
32
|
-
patternProperties:
|
|
33
|
-
^.+$:
|
|
34
|
-
type: string
|
|
35
|
-
debug:
|
|
36
|
-
type: boolean
|
|
37
|
-
ip:
|
|
38
|
-
type: string
|
|
39
|
-
minLength: 1
|
|
40
|
-
bouncer:
|
|
41
|
-
type: object
|
|
42
|
-
properties:
|
|
43
|
-
attempts:
|
|
44
|
-
type: integer
|
|
45
|
-
minimum: 1
|
|
46
|
-
interval:
|
|
47
|
-
type: integer
|
|
48
|
-
minimum: 1
|
|
49
|
-
additionalProperties: false
|
|
50
|
-
protocol:
|
|
51
|
-
type: string
|
|
52
|
-
enum: [h1, h2c]
|
|
53
|
-
oauth:
|
|
54
|
-
type: object
|
|
55
|
-
properties:
|
|
56
|
-
authorize:
|
|
57
|
-
description: The absolute URL of the consent page the application serves
|
|
58
|
-
type: string
|
|
59
|
-
pattern: ^https?://
|
|
60
|
-
resources:
|
|
61
|
-
description: Paths a token may be restricted to
|
|
62
|
-
type: array
|
|
63
|
-
items:
|
|
64
|
-
type: string
|
|
65
|
-
pattern: ^/
|
|
66
|
-
scopes:
|
|
67
|
-
type: array
|
|
68
|
-
items:
|
|
69
|
-
type: string
|
|
70
|
-
trust:
|
|
71
|
-
description: Origins whose Client ID Metadata Documents may be read
|
|
72
|
-
type: array
|
|
73
|
-
items:
|
|
74
|
-
type: string
|
|
75
|
-
pattern: ^https://
|
|
76
|
-
registration:
|
|
77
|
-
type: string
|
|
78
|
-
enum: [open, closed]
|
|
79
|
-
required:
|
|
80
|
-
- authorize
|
|
81
|
-
additionalProperties: false
|
|
82
|
-
rpc:
|
|
83
|
-
description: JSON-RPC at `/.rpc`; writing it is what turns the endpoint on
|
|
84
|
-
type: object
|
|
85
|
-
properties:
|
|
86
|
-
batch:
|
|
87
|
-
description: Calls one request may carry
|
|
88
|
-
type: integer
|
|
89
|
-
minimum: 1
|
|
90
|
-
additionalProperties: false
|
|
91
|
-
mcp:
|
|
92
|
-
description: MCP at `/.mcp`; writing it is what turns the endpoint on
|
|
93
|
-
type: object
|
|
94
|
-
properties:
|
|
95
|
-
name:
|
|
96
|
-
description: What the server calls itself
|
|
97
|
-
type: string
|
|
98
|
-
minLength: 1
|
|
99
|
-
instructions:
|
|
100
|
-
description: What a model is told before it calls anything here
|
|
101
|
-
type: string
|
|
102
|
-
origins:
|
|
103
|
-
description: Browser origins the endpoint answers; none without it
|
|
104
|
-
type: array
|
|
105
|
-
items:
|
|
106
|
-
type: string
|
|
107
|
-
pattern: ^https?://
|
|
108
|
-
anonymous:
|
|
109
|
-
description: Whether the endpoint answers without a credential
|
|
110
|
-
type: boolean
|
|
111
|
-
required:
|
|
112
|
-
- name
|
|
113
|
-
additionalProperties: false
|
|
114
|
-
/: {}
|
|
115
|
-
authorities:
|
|
116
|
-
type: object
|
|
117
|
-
patternProperties:
|
|
118
|
-
^.+$:
|
|
119
|
-
type: string
|
|
120
|
-
type: object
|
|
121
|
-
required:
|
|
122
|
-
- authorities
|
|
123
|
-
dependencies:
|
|
124
|
-
bouncer:
|
|
125
|
-
- ip
|
package/schemas/call.cos.yaml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
description: One JSON-RPC call, as the envelope carries it
|
|
2
|
-
properties:
|
|
3
|
-
jsonrpc:
|
|
4
|
-
const: '2.0'
|
|
5
|
-
method:
|
|
6
|
-
type: string
|
|
7
|
-
minLength: 1
|
|
8
|
-
params:
|
|
9
|
-
description: By name only, because `io:input` validates an object
|
|
10
|
-
type: object
|
|
11
|
-
id:
|
|
12
|
-
description: Absent makes the call a notification, which answers nothing
|
|
13
|
-
type: [string, number]
|
|
14
|
-
required:
|
|
15
|
-
- jsonrpc
|
|
16
|
-
- method
|
|
17
|
-
additionalProperties: false
|
|
18
|
-
type: object
|
package/schemas/method.cos.yaml
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
properties:
|
|
2
|
-
verb:
|
|
3
|
-
type: string
|
|
4
|
-
pattern: ^(GET|HEAD|POST|PUT|PATCH|DELETE|LOCK|UNLOCK)$
|
|
5
|
-
mapping:
|
|
6
|
-
properties:
|
|
7
|
-
namespace:
|
|
8
|
-
type: string
|
|
9
|
-
component:
|
|
10
|
-
type: string
|
|
11
|
-
endpoint:
|
|
12
|
-
type: string
|
|
13
|
-
query:
|
|
14
|
-
$ref: query
|
|
15
|
-
paged:
|
|
16
|
-
type: boolean
|
|
17
|
-
additionalProperties: false
|
|
18
|
-
type: object
|
|
19
|
-
directives:
|
|
20
|
-
type: array
|
|
21
|
-
items:
|
|
22
|
-
$ref: directive
|
|
23
|
-
type: object
|
package/schemas/node.cos.yaml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
properties:
|
|
2
|
-
protected:
|
|
3
|
-
type: boolean
|
|
4
|
-
isolated:
|
|
5
|
-
type: boolean
|
|
6
|
-
forward:
|
|
7
|
-
type: string
|
|
8
|
-
routes:
|
|
9
|
-
type: array
|
|
10
|
-
items:
|
|
11
|
-
$ref: route
|
|
12
|
-
methods:
|
|
13
|
-
type: array
|
|
14
|
-
items:
|
|
15
|
-
$ref: method
|
|
16
|
-
directives:
|
|
17
|
-
type: array
|
|
18
|
-
items:
|
|
19
|
-
$ref: directive
|
|
20
|
-
version:
|
|
21
|
-
type: string
|
|
22
|
-
type: object
|
package/schemas/query.cos.yaml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
properties:
|
|
2
|
-
id:
|
|
3
|
-
type: string
|
|
4
|
-
criteria:
|
|
5
|
-
type: string
|
|
6
|
-
sort:
|
|
7
|
-
type: string
|
|
8
|
-
search:
|
|
9
|
-
type: boolean
|
|
10
|
-
sample:
|
|
11
|
-
type: integer
|
|
12
|
-
omit:
|
|
13
|
-
$ref: range
|
|
14
|
-
limit:
|
|
15
|
-
$ref: range
|
|
16
|
-
selectors:
|
|
17
|
-
type: array
|
|
18
|
-
items:
|
|
19
|
-
type: string
|
|
20
|
-
projection:
|
|
21
|
-
type: array
|
|
22
|
-
items:
|
|
23
|
-
type: string
|
|
24
|
-
parameters:
|
|
25
|
-
type: array
|
|
26
|
-
items:
|
|
27
|
-
type: string
|
|
28
|
-
deleted:
|
|
29
|
-
type: boolean
|
|
30
|
-
nullable: true
|
|
31
|
-
type: object
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
properties:
|
|
2
|
-
id:
|
|
3
|
-
type: string
|
|
4
|
-
criteria:
|
|
5
|
-
type: string
|
|
6
|
-
search:
|
|
7
|
-
type: string
|
|
8
|
-
sample:
|
|
9
|
-
type: number
|
|
10
|
-
sort:
|
|
11
|
-
type: string
|
|
12
|
-
omit:
|
|
13
|
-
type: number
|
|
14
|
-
limit:
|
|
15
|
-
type: number
|
|
16
|
-
version:
|
|
17
|
-
type: number
|
|
18
|
-
additionalProperties: false
|
|
19
|
-
type: object
|
package/schemas/range.cos.yaml
DELETED
package/schemas/route.cos.yaml
DELETED
package/source/Annotation.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { Resources } from '@toa.io/operations'
|
|
2
|
-
import type { Protocol } from './HTTP/index.js'
|
|
3
|
-
|
|
4
|
-
export interface Annotation {
|
|
5
|
-
authorities: Record<string, string>
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* `h2c` requires an ingress controller that proxies cleartext HTTP/2 upstream.
|
|
9
|
-
* See `documentation/protocol.md`.
|
|
10
|
-
*/
|
|
11
|
-
protocol?: Protocol
|
|
12
|
-
class?: string
|
|
13
|
-
resources?: Resources
|
|
14
|
-
annotations?: Record<string, string>
|
|
15
|
-
|
|
16
|
-
/** The Service, as opposed to the Ingress that `annotations` above describes. */
|
|
17
|
-
service?: { annotations?: Record<string, string> }
|
|
18
|
-
|
|
19
|
-
debug?: boolean
|
|
20
|
-
|
|
21
|
-
/** The header the client address is read from; the connection's without one. See `ip.md`. */
|
|
22
|
-
ip?: string
|
|
23
|
-
|
|
24
|
-
/** Failed authentications an address may make; none are metered unless set. See `identity.md`. */
|
|
25
|
-
bouncer?: Bouncer
|
|
26
|
-
|
|
27
|
-
/** The authorization server this context exposes; none is exposed without it. */
|
|
28
|
-
oauth?: OAuth
|
|
29
|
-
|
|
30
|
-
/** JSON-RPC at `/.rpc`; none is served without it. See `documentation/rpc.md`. */
|
|
31
|
-
rpc?: RPC
|
|
32
|
-
|
|
33
|
-
/** MCP at `/.mcp`; none is served without it. See `documentation/mcp.md`. */
|
|
34
|
-
mcp?: MCP
|
|
35
|
-
'/'?: object // parsed and validated by RTD.syntax.parse
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface OAuth {
|
|
39
|
-
/**
|
|
40
|
-
* Where a client sends the user to consent. The one endpoint of the flow that needs a
|
|
41
|
-
* person, and so the one this extension does not serve: an application builds it.
|
|
42
|
-
*/
|
|
43
|
-
authorize: string
|
|
44
|
-
|
|
45
|
-
/** Paths a token may be restricted to, each advertised as a protected resource. */
|
|
46
|
-
resources?: string[]
|
|
47
|
-
|
|
48
|
-
/** What a client may ask for. Each is a role, or a scope within one. */
|
|
49
|
-
scopes?: string[]
|
|
50
|
-
|
|
51
|
-
/** Origins whose Client ID Metadata Documents may be read. None are without it. */
|
|
52
|
-
trust?: string[]
|
|
53
|
-
|
|
54
|
-
/** Dynamic Client Registration, off unless opened. */
|
|
55
|
-
registration?: 'open' | 'closed'
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface RPC {
|
|
59
|
-
/**
|
|
60
|
-
* Calls one request may carry, 32 by default. One request is one authentication and one
|
|
61
|
-
* reply however many calls it makes, so what a caller may ask for at once is bounded.
|
|
62
|
-
*/
|
|
63
|
-
batch?: number
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface MCP {
|
|
67
|
-
/** What the server calls itself, which a client shows a user. */
|
|
68
|
-
name: string
|
|
69
|
-
|
|
70
|
-
/** What a model is told before it calls anything here. */
|
|
71
|
-
instructions?: string
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Browser origins the endpoint answers, which the revision requires against DNS rebinding.
|
|
75
|
-
* None are admitted without it; a request carrying no `Origin` is not a browser's.
|
|
76
|
-
*/
|
|
77
|
-
origins?: string[]
|
|
78
|
-
|
|
79
|
-
/** Whether the endpoint answers without a credential. It does not unless it says so. */
|
|
80
|
-
anonymous?: boolean
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface Bouncer {
|
|
84
|
-
/** what an address may fail at once, 20 by default */
|
|
85
|
-
attempts?: number
|
|
86
|
-
|
|
87
|
-
/** seconds it takes to earn them back, 60 by default */
|
|
88
|
-
interval?: number
|
|
89
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { describe, it } from 'node:test'
|
|
2
|
-
import assert from 'node:assert/strict'
|
|
3
|
-
|
|
4
|
-
import { parse } from './parse.js'
|
|
5
|
-
|
|
6
|
-
describe('routes', () => {
|
|
7
|
-
it('should parse route', async () => {
|
|
8
|
-
const declaration = {
|
|
9
|
-
'/': {},
|
|
10
|
-
'/foo': {}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const node = parse(declaration)
|
|
14
|
-
|
|
15
|
-
assert.strictEqual(node.routes.length, 2)
|
|
16
|
-
assert.strictEqual(node.routes[0].path, '/')
|
|
17
|
-
assert.strictEqual(node.routes[1].path, '/foo')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('should parse nested routes', async () => {
|
|
21
|
-
const declaration = {
|
|
22
|
-
'/': {
|
|
23
|
-
'/foo': {},
|
|
24
|
-
'/bar': {}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const node = parse(declaration)
|
|
29
|
-
const root = node.routes[0].node
|
|
30
|
-
|
|
31
|
-
assert.strictEqual(root.routes.length, 2)
|
|
32
|
-
assert.strictEqual(root.routes[0].path, '/foo')
|
|
33
|
-
assert.strictEqual(root.routes[1].path, '/bar')
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
describe('methods', () => {
|
|
38
|
-
it('should parse methods', () => {
|
|
39
|
-
const declaration = {
|
|
40
|
-
'/': {
|
|
41
|
-
GET: {
|
|
42
|
-
endpoint: 'observe'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const node = parse(declaration)
|
|
48
|
-
const root = node.routes[0].node
|
|
49
|
-
|
|
50
|
-
assert.strictEqual(root.methods.length, 1)
|
|
51
|
-
assert.strictEqual(root.methods[0].verb, 'GET')
|
|
52
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, { endpoint: 'observe' })
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('should parse endpoint shortcut', async () => {
|
|
56
|
-
const declaration = {
|
|
57
|
-
'/': {
|
|
58
|
-
GET: 'observe'
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const node = parse(declaration)
|
|
63
|
-
const root = node.routes[0].node
|
|
64
|
-
|
|
65
|
-
assert.strictEqual(root.methods.length, 1)
|
|
66
|
-
assert.strictEqual(root.methods[0].verb, 'GET')
|
|
67
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, { endpoint: 'observe' })
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('should parse fq endpoint', async () => {
|
|
71
|
-
const declaration = {
|
|
72
|
-
'/': {
|
|
73
|
-
GET: 'dummies.dummy.observe'
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const node = parse(declaration)
|
|
78
|
-
const root = node.routes[0].node
|
|
79
|
-
|
|
80
|
-
assert.strictEqual(root.methods.length, 1)
|
|
81
|
-
assert.strictEqual(root.methods[0].verb, 'GET')
|
|
82
|
-
|
|
83
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, {
|
|
84
|
-
namespace: 'dummies',
|
|
85
|
-
component: 'dummy',
|
|
86
|
-
endpoint: 'observe'
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('should parse fq endpoint within default namespace', async () => {
|
|
91
|
-
const declaration = {
|
|
92
|
-
'/': {
|
|
93
|
-
GET: 'dummy.observe'
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const node = parse(declaration)
|
|
98
|
-
const root = node.routes[0].node
|
|
99
|
-
|
|
100
|
-
assert.strictEqual(root.methods.length, 1)
|
|
101
|
-
assert.strictEqual(root.methods[0].verb, 'GET')
|
|
102
|
-
|
|
103
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, {
|
|
104
|
-
namespace: 'default',
|
|
105
|
-
component: 'dummy',
|
|
106
|
-
endpoint: 'observe'
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
it('should parse directives', async () => {
|
|
111
|
-
const declaration = {
|
|
112
|
-
'/': {
|
|
113
|
-
GET: {
|
|
114
|
-
'auth:incept': 'id',
|
|
115
|
-
endpoint: 'observe'
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const node = parse(declaration)
|
|
121
|
-
const root = node.routes[0].node
|
|
122
|
-
|
|
123
|
-
assert.deepStrictEqual(root.methods[0].directives, [
|
|
124
|
-
{ family: 'auth', name: 'incept', value: 'id' }
|
|
125
|
-
])
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
describe('directives', () => {
|
|
130
|
-
it('should parse shortcuts', async () => {
|
|
131
|
-
const declaration = {
|
|
132
|
-
'/': {
|
|
133
|
-
foo: 'baz'
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const shortcuts = new Map<string, string>([['foo', 'dev:foo']])
|
|
138
|
-
|
|
139
|
-
const node = parse(declaration, shortcuts)
|
|
140
|
-
const root = node.routes[0].node
|
|
141
|
-
|
|
142
|
-
assert.strictEqual(root.directives.length, 1)
|
|
143
|
-
assert.strictEqual(root.directives[0].family, 'dev')
|
|
144
|
-
assert.strictEqual(root.directives[0].name, 'foo')
|
|
145
|
-
assert.strictEqual(root.directives[0].value, 'baz')
|
|
146
|
-
})
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
describe('validation', () => {
|
|
150
|
-
it('should throw on unknown key', async () => {
|
|
151
|
-
const declaration = { hello: 'world' }
|
|
152
|
-
|
|
153
|
-
assert.throws(
|
|
154
|
-
() => parse(declaration),
|
|
155
|
-
(error: any) => /RTD parse error: unknown key 'hello'/.test(error.message)
|
|
156
|
-
)
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
it('should throw on invalid mapping', async () => {
|
|
160
|
-
const declaration = {
|
|
161
|
-
'/': {
|
|
162
|
-
GET: {
|
|
163
|
-
endpoint: 'observe',
|
|
164
|
-
hello: 'world'
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
assert.throws(
|
|
170
|
-
() => parse(declaration),
|
|
171
|
-
(error: any) => /\/methods\/0\/mapping/.test(error.message)
|
|
172
|
-
)
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
it('should expand ranges', async () => {
|
|
177
|
-
const declaration = {
|
|
178
|
-
'/': {
|
|
179
|
-
GET: {
|
|
180
|
-
endpoint: 'enumerate',
|
|
181
|
-
query: {
|
|
182
|
-
omit: 3,
|
|
183
|
-
limit: 2
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const node = parse(declaration)
|
|
190
|
-
const query = node.routes[0].node.methods[0].mapping?.query
|
|
191
|
-
|
|
192
|
-
assert.partialDeepStrictEqual(query, {
|
|
193
|
-
omit: { value: 3, range: [3, 3] },
|
|
194
|
-
limit: { value: 2, range: [2, 2] }
|
|
195
|
-
})
|
|
196
|
-
})
|