@toa.io/extensions.exposition 1.0.0-alpha.47 → 1.0.0-alpha.49
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/documentation/flow.md +31 -0
- package/documentation/octets.md +0 -7
- package/features/{octets.redirect.feature → flow.feature} +3 -4
- package/features/routes.feature +22 -0
- package/features/steps/components/echo/manifest.toa.yaml +7 -0
- package/features/steps/components/echo/operations/parameters.js +7 -0
- package/features/steps/components/octets.tester/manifest.toa.yaml +12 -1
- package/features/steps/components/octets.tester/operations/redirect.js +2 -2
- package/package.json +7 -7
- package/schemas/octets/fetch.cos.yaml +0 -1
- package/source/RTD/Node.ts +2 -1
- package/source/RTD/Route.ts +4 -3
- package/source/directives/auth/Incept.ts +1 -1
- package/source/directives/flow/Fetch.ts +88 -0
- package/source/directives/flow/Flow.ts +34 -0
- package/source/directives/flow/index.ts +3 -0
- package/source/directives/flow/types.ts +6 -0
- package/source/directives/index.ts +2 -1
- package/source/directives/octets/Fetch.ts +4 -57
- package/transpiled/RTD/Node.js +2 -1
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Route.js +0 -1
- package/transpiled/RTD/Route.js.map +1 -1
- package/transpiled/directives/auth/Incept.js +1 -1
- package/transpiled/directives/auth/Incept.js.map +1 -1
- package/transpiled/directives/flow/Fetch.d.ts +13 -0
- package/transpiled/directives/flow/Fetch.js +59 -0
- package/transpiled/directives/flow/Fetch.js.map +1 -0
- package/transpiled/directives/flow/Flow.d.ts +10 -0
- package/transpiled/directives/flow/Flow.js +27 -0
- package/transpiled/directives/flow/Flow.js.map +1 -0
- package/transpiled/directives/flow/index.d.ts +2 -0
- package/transpiled/directives/flow/index.js +6 -0
- package/transpiled/directives/flow/index.js.map +1 -0
- package/transpiled/directives/flow/types.d.ts +5 -0
- package/transpiled/directives/flow/types.js +3 -0
- package/transpiled/directives/flow/types.js.map +1 -0
- package/transpiled/directives/index.js +2 -1
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/octets/Fetch.d.ts +2 -9
- package/transpiled/directives/octets/Fetch.js +3 -41
- package/transpiled/directives/octets/Fetch.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Request flow
|
|
2
|
+
|
|
3
|
+
## `flow:fetch`
|
|
4
|
+
|
|
5
|
+
Fetches the content from the resource returned by the specified endpoint.
|
|
6
|
+
|
|
7
|
+
The value of the directive is a `string` specifying endpoint to be called for the redirection
|
|
8
|
+
request.
|
|
9
|
+
|
|
10
|
+
Request `authority`, `path` and `parameters` are passed as input to the redirection endpoint,
|
|
11
|
+
and it must return a URL `string`, an `Error` or an object with the following properties:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
url: string
|
|
15
|
+
options?:
|
|
16
|
+
method?: string
|
|
17
|
+
headers?: Record<string, string>
|
|
18
|
+
body?: string
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If it returns a URL or Request, then the response to the specified request is returned as the
|
|
22
|
+
response to the original request, along with the `content-type`, `content-length`, and `etag`
|
|
23
|
+
headers.
|
|
24
|
+
|
|
25
|
+
> Shortcut `redirect` is available.
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
/:
|
|
29
|
+
GET:
|
|
30
|
+
flow:redirect: urls.resolve
|
|
31
|
+
```
|
package/documentation/octets.md
CHANGED
|
@@ -134,13 +134,6 @@ The value of the directive is an object with the following properties:
|
|
|
134
134
|
[BLOB variant](/extensions/storages/readme.md#async-fetchpath-string-maybereadable) must be
|
|
135
135
|
specified in the path otherwise.
|
|
136
136
|
Defaults to `true`.
|
|
137
|
-
- `redirect`: `string` specifying endpoint to be called for the redirection url.
|
|
138
|
-
|
|
139
|
-
Request `authority`, `path` and `parameters` are passed as input to redirection endpoint,
|
|
140
|
-
and it must return a `string` or an `Error`.
|
|
141
|
-
If it returns a `string` then the response of the `GET` request to this URL is returned as the
|
|
142
|
-
response of the original request,
|
|
143
|
-
among with the `content-type`, `content-length`, and `etag` headers.
|
|
144
137
|
|
|
145
138
|
```yaml
|
|
146
139
|
/images:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: Request flow
|
|
2
2
|
|
|
3
|
-
Scenario:
|
|
3
|
+
Scenario: Fetching url
|
|
4
4
|
Given the `octets.tester` is running
|
|
5
5
|
And the annotation:
|
|
6
6
|
"""yaml
|
|
@@ -10,8 +10,7 @@ Feature: Octets redirection
|
|
|
10
10
|
GET:
|
|
11
11
|
anonymous: true
|
|
12
12
|
io:output: true
|
|
13
|
-
|
|
14
|
-
redirect: octets.tester.redirect
|
|
13
|
+
flow:fetch: octets.tester.redirect
|
|
15
14
|
"""
|
|
16
15
|
When the following request is received:
|
|
17
16
|
"""
|
package/features/routes.feature
CHANGED
|
@@ -137,3 +137,25 @@ Feature: Routes
|
|
|
137
137
|
"""
|
|
138
138
|
201 Created
|
|
139
139
|
"""
|
|
140
|
+
|
|
141
|
+
Scenario: Routes with parameters
|
|
142
|
+
Given the `echo` is running with the following manifest:
|
|
143
|
+
"""yaml
|
|
144
|
+
exposition:
|
|
145
|
+
/:a/:b:
|
|
146
|
+
io:output: true
|
|
147
|
+
GET: parameters
|
|
148
|
+
"""
|
|
149
|
+
When the following request is received:
|
|
150
|
+
"""
|
|
151
|
+
GET /echo/foo/bar/ HTTP/1.1
|
|
152
|
+
host: nex.toa.io
|
|
153
|
+
accept: application/yaml
|
|
154
|
+
"""
|
|
155
|
+
Then the following reply is sent:
|
|
156
|
+
"""
|
|
157
|
+
200 OK
|
|
158
|
+
|
|
159
|
+
a: foo
|
|
160
|
+
b: bar
|
|
161
|
+
"""
|
|
@@ -26,4 +26,15 @@ operations:
|
|
|
26
26
|
authority*: string
|
|
27
27
|
path*: string
|
|
28
28
|
parameters: <string>
|
|
29
|
-
output:
|
|
29
|
+
output:
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
url: string
|
|
33
|
+
options:
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
method: string
|
|
37
|
+
headers: object
|
|
38
|
+
body: string
|
|
39
|
+
required:
|
|
40
|
+
- url
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.exposition",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.49",
|
|
4
4
|
"description": "Toa Exposition",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
21
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
22
|
-
"@toa.io/schemas": "1.0.0-alpha.
|
|
20
|
+
"@toa.io/core": "1.0.0-alpha.49",
|
|
21
|
+
"@toa.io/generic": "1.0.0-alpha.49",
|
|
22
|
+
"@toa.io/schemas": "1.0.0-alpha.49",
|
|
23
23
|
"bcryptjs": "2.4.3",
|
|
24
24
|
"error-value": "0.3.0",
|
|
25
25
|
"js-yaml": "4.1.0",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"features:security": "cucumber-js --tags @security"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@toa.io/agent": "1.0.0-alpha.
|
|
48
|
-
"@toa.io/extensions.storages": "1.0.0-alpha.
|
|
47
|
+
"@toa.io/agent": "1.0.0-alpha.49",
|
|
48
|
+
"@toa.io/extensions.storages": "1.0.0-alpha.49",
|
|
49
49
|
"@types/bcryptjs": "2.4.3",
|
|
50
50
|
"@types/cors": "2.8.13",
|
|
51
51
|
"@types/negotiator": "0.6.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "fb382cfd086bf867209a95046e25b92e43e5b2bb"
|
|
54
54
|
}
|
package/source/RTD/Node.ts
CHANGED
|
@@ -20,7 +20,8 @@ export class Node {
|
|
|
20
20
|
|
|
21
21
|
public match (fragments: string[], parameters: Parameter[] = []): Match | null {
|
|
22
22
|
for (const route of this.routes) {
|
|
23
|
-
const
|
|
23
|
+
const params = parameters.slice()
|
|
24
|
+
const match = route.match(fragments, params)
|
|
24
25
|
|
|
25
26
|
if (match !== null)
|
|
26
27
|
return match
|
package/source/RTD/Route.ts
CHANGED
|
@@ -31,8 +31,10 @@ export class Route {
|
|
|
31
31
|
|
|
32
32
|
const exact = this.segments.length === fragments.length
|
|
33
33
|
|
|
34
|
-
if (exact && !this.node.intermediate)
|
|
35
|
-
|
|
34
|
+
if (exact && !this.node.intermediate)
|
|
35
|
+
return { node: this.node, parameters }
|
|
36
|
+
else
|
|
37
|
+
return this.matchNested(fragments, parameters)
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
public equals (route: Route): boolean {
|
|
@@ -52,7 +54,6 @@ export class Route {
|
|
|
52
54
|
|
|
53
55
|
private matchNested (fragments: string[], parameters: Parameter[]): Match | null {
|
|
54
56
|
fragments = fragments.slice(this.segments.length)
|
|
55
|
-
parameters = parameters.slice()
|
|
56
57
|
|
|
57
58
|
return this.node.match(fragments, parameters)
|
|
58
59
|
}
|
|
@@ -23,7 +23,7 @@ export class Incept implements Directive {
|
|
|
23
23
|
|
|
24
24
|
if (id === undefined)
|
|
25
25
|
throw new http.Conflict('Identity inception has failed as the response body ' +
|
|
26
|
-
`
|
|
26
|
+
`does not contain the '${this.property}' property.`)
|
|
27
27
|
|
|
28
28
|
const [scheme, credentials] = split(input.request.headers.authorization!)
|
|
29
29
|
const provider = PROVIDERS[scheme]
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Readable } from 'node:stream'
|
|
2
|
+
import assert from 'node:assert'
|
|
3
|
+
import { match } from 'matchacho'
|
|
4
|
+
import { NotFound } from '../../HTTP'
|
|
5
|
+
import type { Directive } from './types'
|
|
6
|
+
import type { ReadableStream } from 'node:stream/web'
|
|
7
|
+
import type { Remotes } from '../../Remotes'
|
|
8
|
+
import type { Maybe } from '@toa.io/types'
|
|
9
|
+
import type { Component } from '@toa.io/core'
|
|
10
|
+
import type { Output } from '../../io'
|
|
11
|
+
import type { Input } from '../octets/types'
|
|
12
|
+
import type { Parameter } from '../../RTD'
|
|
13
|
+
|
|
14
|
+
export class Fetch implements Directive {
|
|
15
|
+
public readonly targeted = true
|
|
16
|
+
|
|
17
|
+
private readonly connecting: Promise<Component>
|
|
18
|
+
private remote: Component | null = null
|
|
19
|
+
private readonly operation: string
|
|
20
|
+
|
|
21
|
+
public constructor (endpoint: string, discovery: Remotes) {
|
|
22
|
+
assert.equal(typeof endpoint, 'string', '`flow:redirect` must be a string')
|
|
23
|
+
|
|
24
|
+
const [operation, name, namespace = 'default'] = endpoint.split('.').reverse()
|
|
25
|
+
|
|
26
|
+
this.operation = operation
|
|
27
|
+
this.connecting = discovery.discover(namespace, name)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async apply (input: Input, parameters: Parameter[]): Promise<Output> {
|
|
31
|
+
if ('if-none-match' in input.request.headers)
|
|
32
|
+
return { status: 304 }
|
|
33
|
+
|
|
34
|
+
this.remote ??= await this.connecting
|
|
35
|
+
|
|
36
|
+
const request = await this.remote.invoke<Maybe<Request | string>>(this.operation, {
|
|
37
|
+
input: {
|
|
38
|
+
authority: input.authority,
|
|
39
|
+
path: input.request.url,
|
|
40
|
+
parameters: Object.fromEntries(parameters.map(({ name, value }) => [name, value]))
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
if (request instanceof Error)
|
|
45
|
+
throw new NotFound(request)
|
|
46
|
+
|
|
47
|
+
const { url, options } = match<Request>(request,
|
|
48
|
+
String, { url: request },
|
|
49
|
+
(request: Request): Request => ({
|
|
50
|
+
url: request.url,
|
|
51
|
+
options: {
|
|
52
|
+
method: request.options?.method ?? 'GET',
|
|
53
|
+
body: request.options?.body,
|
|
54
|
+
headers: request.options?.headers
|
|
55
|
+
}
|
|
56
|
+
}))
|
|
57
|
+
|
|
58
|
+
const response = await fetch(url, options)
|
|
59
|
+
|
|
60
|
+
if (!response.ok)
|
|
61
|
+
throw new NotFound()
|
|
62
|
+
|
|
63
|
+
const headers = new Headers()
|
|
64
|
+
|
|
65
|
+
for (const header of ['content-type', 'content-length', 'etag']) {
|
|
66
|
+
const value = response.headers.get(header)
|
|
67
|
+
|
|
68
|
+
if (value !== null)
|
|
69
|
+
headers.set(header, value)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
headers,
|
|
74
|
+
body: response.body === null ? null : Readable.fromWeb(response.body as ReadableStream)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface Request {
|
|
80
|
+
url: string
|
|
81
|
+
options?: RequestOptions
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface RequestOptions {
|
|
85
|
+
method?: string
|
|
86
|
+
body?: string
|
|
87
|
+
headers?: Record<string, string>
|
|
88
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Fetch } from './Fetch'
|
|
2
|
+
import type { Directive } from './types'
|
|
3
|
+
import type { Input, Output } from '../../io'
|
|
4
|
+
import type { DirectiveFamily, Parameter } from '../../RTD'
|
|
5
|
+
import type { Remotes } from '../../Remotes'
|
|
6
|
+
|
|
7
|
+
export class Flow implements DirectiveFamily<Directive> {
|
|
8
|
+
public readonly name: string = 'flow'
|
|
9
|
+
public readonly mandatory: boolean = false
|
|
10
|
+
|
|
11
|
+
public create (name: string, value: unknown, remotes: Remotes): Directive {
|
|
12
|
+
const Class = constructors[name]
|
|
13
|
+
|
|
14
|
+
if (Class === undefined)
|
|
15
|
+
throw new Error(`Directive '${this.name}:${name}' is not implemented.`)
|
|
16
|
+
|
|
17
|
+
return new Class(value, remotes)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async preflight (directives: Directive[], input: Input, parameters: Parameter[]): Promise<Output> {
|
|
21
|
+
for (const directive of directives) {
|
|
22
|
+
const output = await directive.apply(input, parameters)
|
|
23
|
+
|
|
24
|
+
if (output !== null)
|
|
25
|
+
return output
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const constructors: Record<string, new (value: any, discovery: Remotes) => Directive> = {
|
|
33
|
+
fetch: Fetch
|
|
34
|
+
}
|
|
@@ -6,8 +6,9 @@ import { octets } from './octets'
|
|
|
6
6
|
import { io } from './io'
|
|
7
7
|
import { vary } from './vary'
|
|
8
8
|
import { req } from './require'
|
|
9
|
+
import { flow } from './flow'
|
|
9
10
|
import type { DirectiveFamily } from '../RTD'
|
|
10
11
|
import type { Interceptor } from '../Interception'
|
|
11
12
|
|
|
12
|
-
export const families: DirectiveFamily[] = [authorization, io, cache, vary, req, octets, dev]
|
|
13
|
+
export const families: DirectiveFamily[] = [authorization, io, cache, vary, req, flow, octets, dev]
|
|
13
14
|
export const interceptors: Interceptor[] = [cors]
|
|
@@ -1,45 +1,35 @@
|
|
|
1
1
|
import { posix } from 'node:path'
|
|
2
|
-
import { Readable } from 'node:stream'
|
|
3
2
|
import { Forbidden, NotFound } from '../../HTTP'
|
|
4
3
|
import * as schemas from './schemas'
|
|
5
4
|
import { Directive } from './Directive'
|
|
6
|
-
import type {
|
|
5
|
+
import type { Readable } from 'node:stream'
|
|
7
6
|
import type { Maybe } from '@toa.io/types'
|
|
8
7
|
import type { Entry } from '@toa.io/extensions.storages'
|
|
9
8
|
import type { Component } from '@toa.io/core'
|
|
10
9
|
import type { Output } from '../../io'
|
|
11
10
|
import type { Input } from './types'
|
|
12
|
-
import type { Parameter } from '../../RTD'
|
|
13
11
|
|
|
14
12
|
export class Fetch extends Directive {
|
|
15
13
|
public readonly targeted = true
|
|
16
14
|
|
|
17
15
|
private readonly options: Required<Options> = {
|
|
18
16
|
blob: true,
|
|
19
|
-
meta: false
|
|
20
|
-
redirect: null
|
|
17
|
+
meta: false
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
private readonly discovery: Promise<Component>
|
|
24
21
|
private storage!: Component
|
|
25
|
-
private readonly remotes: Remotes
|
|
26
|
-
private connecting: Promise<Component> | null = null
|
|
27
|
-
private remote!: Component
|
|
28
22
|
|
|
29
|
-
public constructor (options: Options | null, discovery: Promise<Component
|
|
23
|
+
public constructor (options: Options | null, discovery: Promise<Component>) {
|
|
30
24
|
super()
|
|
31
25
|
|
|
32
26
|
schemas.fetch.validate(options)
|
|
33
27
|
Object.assign(this.options, options)
|
|
34
28
|
|
|
35
29
|
this.discovery = discovery
|
|
36
|
-
this.remotes = remotes
|
|
37
30
|
}
|
|
38
31
|
|
|
39
|
-
public async apply (storage: string, input: Input
|
|
40
|
-
if (this.options.redirect !== null)
|
|
41
|
-
return this.redirect(input, parameters)
|
|
42
|
-
|
|
32
|
+
public async apply (storage: string, input: Input): Promise<Output> {
|
|
43
33
|
this.storage ??= await this.discovery
|
|
44
34
|
|
|
45
35
|
const variant = posix.basename(input.request.url).includes('.')
|
|
@@ -83,48 +73,6 @@ export class Fetch extends Directive {
|
|
|
83
73
|
}
|
|
84
74
|
}
|
|
85
75
|
|
|
86
|
-
private async redirect (input: Input, parameters: Parameter[]): Promise<Output> {
|
|
87
|
-
if ('if-none-match' in input.request.headers)
|
|
88
|
-
return { status: 304 }
|
|
89
|
-
|
|
90
|
-
const [operation, name, namespace = 'default'] = this.options.redirect!.split('.').reverse()
|
|
91
|
-
|
|
92
|
-
if (this.connecting === null)
|
|
93
|
-
this.connecting = this.remotes.discover(namespace, name)
|
|
94
|
-
|
|
95
|
-
this.remote ??= await this.connecting
|
|
96
|
-
|
|
97
|
-
const url = await this.remote.invoke<Maybe<string>>(operation, {
|
|
98
|
-
input: {
|
|
99
|
-
authority: input.authority,
|
|
100
|
-
path: input.request.url,
|
|
101
|
-
parameters: Object.fromEntries(parameters.map(({ name, value }) => [name, value]))
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
if (url instanceof Error)
|
|
106
|
-
throw new NotFound(url)
|
|
107
|
-
|
|
108
|
-
const response = await fetch(url)
|
|
109
|
-
|
|
110
|
-
if (!response.ok)
|
|
111
|
-
throw new NotFound()
|
|
112
|
-
|
|
113
|
-
const headers = new Headers()
|
|
114
|
-
|
|
115
|
-
for (const header of ['content-type', 'content-length', 'etag']) {
|
|
116
|
-
const value = response.headers.get(header)
|
|
117
|
-
|
|
118
|
-
if (value !== null)
|
|
119
|
-
headers.set(header, value)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
headers,
|
|
124
|
-
body: response.body === null ? null : Readable.fromWeb(response.body as any)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
76
|
private async get (storage: string, input: Input): Promise<Output> {
|
|
129
77
|
const entry = await this.storage.invoke<Maybe<Entry>>('get', {
|
|
130
78
|
input: {
|
|
@@ -143,7 +91,6 @@ export class Fetch extends Directive {
|
|
|
143
91
|
export interface Options {
|
|
144
92
|
blob?: boolean
|
|
145
93
|
meta?: boolean
|
|
146
|
-
redirect?: string | null
|
|
147
94
|
}
|
|
148
95
|
|
|
149
96
|
interface FetchResult {
|
package/transpiled/RTD/Node.js
CHANGED
|
@@ -15,7 +15,8 @@ class Node {
|
|
|
15
15
|
}
|
|
16
16
|
match(fragments, parameters = []) {
|
|
17
17
|
for (const route of this.routes) {
|
|
18
|
-
const
|
|
18
|
+
const params = parameters.slice();
|
|
19
|
+
const match = route.match(fragments, params);
|
|
19
20
|
if (match !== null)
|
|
20
21
|
return match;
|
|
21
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Node.js","sourceRoot":"","sources":["../../source/RTD/Node.ts"],"names":[],"mappings":";;;AAIA,MAAa,IAAI;IACR,YAAY,CAA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AAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAEjD,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IAC/C,CAAC;CACF;AAvDD,sBAuDC"}
|
|
@@ -42,7 +42,7 @@ class Incept {
|
|
|
42
42
|
const id = response.body?.[this.property];
|
|
43
43
|
if (id === undefined)
|
|
44
44
|
throw new http.Conflict('Identity inception has failed as the response body ' +
|
|
45
|
-
`
|
|
45
|
+
`does not contain the '${this.property}' property.`);
|
|
46
46
|
const [scheme, credentials] = (0, split_1.split)(input.request.headers.authorization);
|
|
47
47
|
const provider = schemes_1.PROVIDERS[scheme];
|
|
48
48
|
this.schemes[scheme] ??= await this.discovery[provider];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Incept.js","sourceRoot":"","sources":["../../../source/directives/auth/Incept.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAkC;AAElC,mCAA+B;AAC/B,uCAAqC;AAErC,MAAa,MAAM;IACA,QAAQ,CAAQ;IAChB,SAAS,CAAW;IACpB,OAAO,GAAY,EAAwB,CAAA;IAE5D,YAAoB,QAAgB,EAAE,SAAoB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEM,SAAS,CAAE,QAAyB,EAAE,KAAY;QACvD,OAAO,QAAQ,KAAK,IAAI,IAAI,eAAe,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAA;IACtE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAE,KAAY,EAAE,QAA8B;QAC/D,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEzC,IAAI,EAAE,KAAK,SAAS;YAClB,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,q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;gBAC1B,EAAE;gBACF,WAAW;aACZ;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,YAAY,KAAK;YAC3B,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAE9C,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACzB,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAA;IAChC,CAAC;CACF;AAzCD,wBAyCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Directive } from './types';
|
|
2
|
+
import type { Remotes } from '../../Remotes';
|
|
3
|
+
import type { Output } from '../../io';
|
|
4
|
+
import type { Input } from '../octets/types';
|
|
5
|
+
import type { Parameter } from '../../RTD';
|
|
6
|
+
export declare class Fetch implements Directive {
|
|
7
|
+
readonly targeted = true;
|
|
8
|
+
private readonly connecting;
|
|
9
|
+
private remote;
|
|
10
|
+
private readonly operation;
|
|
11
|
+
constructor(endpoint: string, discovery: Remotes);
|
|
12
|
+
apply(input: Input, parameters: Parameter[]): Promise<Output>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Fetch = void 0;
|
|
7
|
+
const node_stream_1 = require("node:stream");
|
|
8
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
9
|
+
const matchacho_1 = require("matchacho");
|
|
10
|
+
const HTTP_1 = require("../../HTTP");
|
|
11
|
+
class Fetch {
|
|
12
|
+
targeted = true;
|
|
13
|
+
connecting;
|
|
14
|
+
remote = null;
|
|
15
|
+
operation;
|
|
16
|
+
constructor(endpoint, discovery) {
|
|
17
|
+
node_assert_1.default.equal(typeof endpoint, 'string', '`flow:redirect` must be a string');
|
|
18
|
+
const [operation, name, namespace = 'default'] = endpoint.split('.').reverse();
|
|
19
|
+
this.operation = operation;
|
|
20
|
+
this.connecting = discovery.discover(namespace, name);
|
|
21
|
+
}
|
|
22
|
+
async apply(input, parameters) {
|
|
23
|
+
if ('if-none-match' in input.request.headers)
|
|
24
|
+
return { status: 304 };
|
|
25
|
+
this.remote ??= await this.connecting;
|
|
26
|
+
const request = await this.remote.invoke(this.operation, {
|
|
27
|
+
input: {
|
|
28
|
+
authority: input.authority,
|
|
29
|
+
path: input.request.url,
|
|
30
|
+
parameters: Object.fromEntries(parameters.map(({ name, value }) => [name, value]))
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (request instanceof Error)
|
|
34
|
+
throw new HTTP_1.NotFound(request);
|
|
35
|
+
const { url, options } = (0, matchacho_1.match)(request, String, { url: request }, (request) => ({
|
|
36
|
+
url: request.url,
|
|
37
|
+
options: {
|
|
38
|
+
method: request.options?.method ?? 'GET',
|
|
39
|
+
body: request.options?.body,
|
|
40
|
+
headers: request.options?.headers
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
const response = await fetch(url, options);
|
|
44
|
+
if (!response.ok)
|
|
45
|
+
throw new HTTP_1.NotFound();
|
|
46
|
+
const headers = new Headers();
|
|
47
|
+
for (const header of ['content-type', 'content-length', 'etag']) {
|
|
48
|
+
const value = response.headers.get(header);
|
|
49
|
+
if (value !== null)
|
|
50
|
+
headers.set(header, value);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
headers,
|
|
54
|
+
body: response.body === null ? null : node_stream_1.Readable.fromWeb(response.body)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Fetch = Fetch;
|
|
59
|
+
//# sourceMappingURL=Fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fetch.js","sourceRoot":"","sources":["../../../source/directives/flow/Fetch.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsC;AACtC,8DAA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AM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAA,iBAAK,EAAU,OAAO,EAC7C,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,EACxB,CAAC,OAAgB,EAAW,EAAE,CAAC,CAAC;YAC9B,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE;gBACP,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK;gBACxC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI;gBAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO;aAClC;SACF,CAAC,CAAC,CAAA;QAEL,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAE1C,IAAI,CAAC,QAAQ,CAAC,EAAE;YACd,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;QAE7B,KAAK,MAAM,MAAM,IAAI,CAAC,cAAc,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,CAAC;YAChE,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YAE1C,IAAI,KAAK,KAAK,IAAI;gBAChB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAC9B,CAAC;QAED,OAAO;YACL,OAAO;YACP,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAsB,CAAC;SACxF,CAAA;IACH,CAAC;CACF;AA/DD,sBA+DC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Directive } from './types';
|
|
2
|
+
import type { Input, Output } from '../../io';
|
|
3
|
+
import type { DirectiveFamily, Parameter } from '../../RTD';
|
|
4
|
+
import type { Remotes } from '../../Remotes';
|
|
5
|
+
export declare class Flow implements DirectiveFamily<Directive> {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly mandatory: boolean;
|
|
8
|
+
create(name: string, value: unknown, remotes: Remotes): Directive;
|
|
9
|
+
preflight(directives: Directive[], input: Input, parameters: Parameter[]): Promise<Output>;
|
|
10
|
+
}
|