@toa.io/extensions.exposition 1.0.0-alpha.267 → 1.0.0-alpha.268
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 +15 -0
- package/components/{octets.storage → exposition.octets}/manifest.toa.yaml +2 -2
- package/components/exposition.stash/manifest.toa.yaml +12 -0
- package/components/exposition.stash/operations/count.js +7 -0
- package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
- package/documentation/io.md +45 -17
- package/documentation/notes/throttling.md +6 -0
- package/features/io.throttle.feature +127 -0
- package/features/map.feature +5 -5
- package/features/octets.cloudinary.feature +12 -9
- package/features/octets.download.feature +4 -3
- package/features/octets.entries.feature +5 -3
- package/features/octets.feature +4 -4
- package/features/octets.head.feature +1 -1
- package/features/octets.location.feature +1 -1
- package/features/octets.meta.feature +2 -2
- package/features/octets.workflows.feature +7 -7
- package/package.json +8 -8
- package/schemas/io/throttle.cos.yaml +9 -2
- package/source/Directive.test.ts +72 -7
- package/source/Directive.ts +15 -5
- package/source/HTTP/messages.ts +5 -1
- package/source/Interception.ts +8 -0
- package/source/RTD/Context.ts +3 -0
- package/source/RTD/Directives.ts +1 -1
- package/source/RTD/Tree.ts +17 -0
- package/source/RTD/factory.ts +11 -1
- package/source/directives/cors/CORS.ts +26 -9
- package/source/directives/io/Directive.ts +4 -2
- package/source/directives/io/IO.ts +18 -7
- package/source/directives/io/Throttle.ts +8 -6
- package/source/directives/io/lib/throttle/Configuration.test.ts +21 -0
- package/source/directives/io/lib/throttle/Configuration.ts +11 -4
- package/source/directives/io/lib/throttle/Keys.ts +12 -11
- package/source/directives/io/lib/throttle/Quotas.test.ts +207 -46
- package/source/directives/io/lib/throttle/Quotas.ts +59 -35
- package/source/directives/io/lib/throttle/components/Component.ts +2 -1
- package/source/directives/io/lib/throttle/components/Identity.ts +19 -0
- package/source/directives/io/lib/throttle/components/Route.ts +19 -0
- package/source/directives/io/lib/throttle/components/Segment.ts +19 -0
- package/source/directives/io/lib/throttle/components/index.ts +8 -2
- package/source/directives/io/schemas.test.ts +16 -0
- package/source/directives/octets/Octets.ts +1 -1
- package/source/directives/octets/workflows/Execution.ts +4 -2
- package/transpiled/Directive.d.ts +3 -1
- package/transpiled/Directive.js +12 -3
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/HTTP/messages.js +4 -1
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Interception.d.ts +2 -0
- package/transpiled/Interception.js +4 -0
- package/transpiled/Interception.js.map +1 -1
- package/transpiled/RTD/Context.d.ts +2 -0
- package/transpiled/RTD/Directives.d.ts +1 -1
- package/transpiled/RTD/Tree.js +14 -0
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/RTD/factory.js +8 -1
- package/transpiled/RTD/factory.js.map +1 -1
- package/transpiled/directives/cors/CORS.d.ts +8 -1
- package/transpiled/directives/cors/CORS.js +23 -9
- package/transpiled/directives/cors/CORS.js.map +1 -1
- package/transpiled/directives/io/Directive.d.ts +4 -2
- package/transpiled/directives/io/IO.d.ts +6 -3
- package/transpiled/directives/io/IO.js +11 -5
- package/transpiled/directives/io/IO.js.map +1 -1
- package/transpiled/directives/io/Throttle.d.ts +5 -3
- package/transpiled/directives/io/Throttle.js +6 -6
- package/transpiled/directives/io/Throttle.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Configuration.d.ts +6 -2
- package/transpiled/directives/io/lib/throttle/Configuration.js +5 -2
- package/transpiled/directives/io/lib/throttle/Configuration.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Keys.d.ts +4 -3
- package/transpiled/directives/io/lib/throttle/Keys.js +7 -10
- package/transpiled/directives/io/lib/throttle/Keys.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.d.ts +27 -8
- package/transpiled/directives/io/lib/throttle/Quotas.js +47 -31
- package/transpiled/directives/io/lib/throttle/Quotas.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/components/Component.d.ts +2 -1
- package/transpiled/directives/io/lib/throttle/components/Identity.d.ts +11 -0
- package/transpiled/directives/io/lib/throttle/components/Identity.js +16 -0
- package/transpiled/directives/io/lib/throttle/components/Identity.js.map +1 -0
- package/transpiled/directives/io/lib/throttle/components/Route.d.ts +12 -0
- package/transpiled/directives/io/lib/throttle/components/Route.js +20 -0
- package/transpiled/directives/io/lib/throttle/components/Route.js.map +1 -0
- package/transpiled/directives/io/lib/throttle/components/Segment.d.ts +9 -0
- package/transpiled/directives/io/lib/throttle/components/Segment.js +20 -0
- package/transpiled/directives/io/lib/throttle/components/Segment.js.map +1 -0
- package/transpiled/directives/io/lib/throttle/components/index.d.ts +1 -1
- package/transpiled/directives/io/lib/throttle/components/index.js +7 -1
- package/transpiled/directives/io/lib/throttle/components/index.js.map +1 -1
- package/transpiled/directives/octets/Octets.js +1 -1
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/octets/workflows/Execution.js +3 -1
- package/transpiled/directives/octets/workflows/Execution.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
- package/features/auth.issue.feature +0 -32
- package/source/directives/io/lib/throttle/Interval.ts +0 -40
- package/source/directives/io/lib/throttle/Quota.ts +0 -22
- package/transpiled/directives/io/lib/throttle/Interval.d.ts +0 -10
- package/transpiled/directives/io/lib/throttle/Interval.js +0 -39
- package/transpiled/directives/io/lib/throttle/Interval.js.map +0 -1
- package/transpiled/directives/io/lib/throttle/Quota.d.ts +0 -8
- package/transpiled/directives/io/lib/throttle/Quota.js +0 -22
- package/transpiled/directives/io/lib/throttle/Quota.js.map +0 -1
- /package/components/{octets.storage → exposition.octets}/operations/delete.js +0 -0
- /package/components/{octets.storage → exposition.octets}/operations/get.js +0 -0
- /package/components/{octets.storage → exposition.octets}/operations/head.js +0 -0
- /package/components/{octets.storage → exposition.octets}/operations/put.js +0 -0
|
@@ -3,57 +3,73 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Quotas = void 0;
|
|
4
4
|
const openspan_1 = require("openspan");
|
|
5
5
|
const Keys_1 = require("./Keys");
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Quota usage counted across every gateway process, and blocking decided in this one.
|
|
8
|
+
*
|
|
9
|
+
* The count comes from the `exposition.stash` component, which counts through Redis
|
|
10
|
+
* and hands back a lower bound on what the whole group has reached. Blocking stays
|
|
11
|
+
* local: every process sees the same number and reaches the same conclusion on its
|
|
12
|
+
* own, and a process that cannot reach Redis still enforces what it has seen itself.
|
|
13
|
+
*/
|
|
8
14
|
class Quotas {
|
|
9
15
|
requests;
|
|
10
|
-
cooldown;
|
|
11
16
|
interval;
|
|
17
|
+
cooldown;
|
|
12
18
|
keys;
|
|
13
|
-
|
|
19
|
+
counter;
|
|
14
20
|
blocked = {};
|
|
21
|
+
timers = new Set();
|
|
22
|
+
/**
|
|
23
|
+
* The key computed at preflight, for settle to count against.
|
|
24
|
+
*
|
|
25
|
+
* `segment` reads the route parameters, which settle is not given, and `identity`
|
|
26
|
+
* can be refreshed between the two — so recomputing there would key a request
|
|
27
|
+
* differently than it was checked, and blocking would quietly stop working.
|
|
28
|
+
*/
|
|
29
|
+
keyed = new WeakMap();
|
|
30
|
+
remote = null;
|
|
15
31
|
constructor(options) {
|
|
16
32
|
this.requests = options.requests;
|
|
17
|
-
this.cooldown = options.cooldown;
|
|
18
33
|
this.interval = options.interval;
|
|
34
|
+
this.cooldown = options.cooldown;
|
|
19
35
|
this.keys = options.keys;
|
|
20
|
-
this.
|
|
36
|
+
this.counter = options.counter;
|
|
21
37
|
}
|
|
22
|
-
static create(configuration) {
|
|
23
|
-
const requests = configuration
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const interval = new Interval_1.Interval(configuration.interval);
|
|
27
|
-
return new this({ requests, cooldown, keys, interval });
|
|
38
|
+
static create(configuration, counter, route = '') {
|
|
39
|
+
const { requests, interval, cooldown } = configuration;
|
|
40
|
+
const keys = Keys_1.Keys.create(configuration.key, configuration.condition, route);
|
|
41
|
+
return new this({ requests, interval, cooldown, keys, counter });
|
|
28
42
|
}
|
|
29
|
-
ok(context) {
|
|
30
|
-
const key = this.keys.get(context);
|
|
43
|
+
ok(context, parameters) {
|
|
44
|
+
const key = this.keys.get(context, parameters);
|
|
45
|
+
this.keyed.set(context, key);
|
|
31
46
|
return this.blocked[key] !== true;
|
|
32
47
|
}
|
|
33
|
-
use(input, output) {
|
|
34
|
-
|
|
35
|
-
if (key === null)
|
|
48
|
+
async use(input, output) {
|
|
49
|
+
if (!this.keys.matches(input, output))
|
|
36
50
|
return;
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
51
|
+
// preflight always runs first, and a request it throws on never reaches settle
|
|
52
|
+
const key = this.keyed.get(input) ?? this.keys.get(input);
|
|
53
|
+
this.remote ??= await this.counter;
|
|
54
|
+
const count = await this.remote.invoke('count', { input: { name: key, interval: this.interval, amount: 1 } });
|
|
55
|
+
if (count >= this.requests)
|
|
40
56
|
this.block(key);
|
|
41
57
|
}
|
|
42
58
|
dispose() {
|
|
43
|
-
this.
|
|
59
|
+
for (const timer of this.timers)
|
|
60
|
+
clearTimeout(timer);
|
|
61
|
+
this.timers.clear();
|
|
44
62
|
}
|
|
45
|
-
reset = () => {
|
|
46
|
-
for (const key in this.quotas) {
|
|
47
|
-
const quota = this.quotas[key];
|
|
48
|
-
if (quota.idle)
|
|
49
|
-
delete this.quotas[key];
|
|
50
|
-
else
|
|
51
|
-
quota.reset();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
63
|
block(key) {
|
|
64
|
+
if (this.blocked[key] === true)
|
|
65
|
+
return;
|
|
55
66
|
this.blocked[key] = true;
|
|
56
|
-
setTimeout(() =>
|
|
67
|
+
const timer = setTimeout(() => {
|
|
68
|
+
delete this.blocked[key];
|
|
69
|
+
this.timers.delete(timer);
|
|
70
|
+
}, this.cooldown);
|
|
71
|
+
timer.unref();
|
|
72
|
+
this.timers.add(timer);
|
|
57
73
|
openspan_1.console.info('Quota exceeded, key blocked', { key, cooldown: this.cooldown });
|
|
58
74
|
}
|
|
59
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quotas.js","sourceRoot":"","sources":["../../../../../source/directives/io/lib/throttle/Quotas.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC,iCAA6B;
|
|
1
|
+
{"version":3,"file":"Quotas.js","sourceRoot":"","sources":["../../../../../source/directives/io/lib/throttle/Quotas.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC,iCAA6B;AAM7B;;;;;;;GAOG;AACH,MAAa,MAAM;IACA,QAAQ,CAAQ;IAChB,QAAQ,CAAQ;IAChB,QAAQ,CAAQ;IAChB,IAAI,CAAM;IACV,OAAO,CAAiB;IACxB,OAAO,GAAwC,EAAE,CAAA;IACjD,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IAEnD;;;;;;OAMG;IACc,KAAK,GAAG,IAAI,OAAO,EAAmB,CAAA;IAC/C,MAAM,GAAkB,IAAI,CAAA;IAEpC,YAAoB,OAAgB;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;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A;QAE/D,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ;YACxB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,CAAC;IAEM,OAAO;QACZ,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM;YAC7B,YAAY,CAAC,KAAK,CAAC,CAAA;QAErB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAEO,KAAK,CAAE,GAAW;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI;YAC5B,OAAM;QAER,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;QAExB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAExB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3B,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEjB,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAEtB,kBAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC/E,CAAC;CACF;AAnFD,wBAmFC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Input } from '../../../../../io';
|
|
2
|
+
import type { Component } from './Component';
|
|
3
|
+
/**
|
|
4
|
+
* The authenticated identity, or nothing when the request carries none.
|
|
5
|
+
*
|
|
6
|
+
* Anonymous requests therefore share one quota between them; `ip` is the component
|
|
7
|
+
* that tells them apart.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Identity implements Component {
|
|
10
|
+
get(context: Input): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Identity = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The authenticated identity, or nothing when the request carries none.
|
|
6
|
+
*
|
|
7
|
+
* Anonymous requests therefore share one quota between them; `ip` is the component
|
|
8
|
+
* that tells them apart.
|
|
9
|
+
*/
|
|
10
|
+
class Identity {
|
|
11
|
+
get(context) {
|
|
12
|
+
return context.identity?.id ?? '';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Identity = Identity;
|
|
16
|
+
//# sourceMappingURL=Identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Identity.js","sourceRoot":"","sources":["../../../../../../source/directives/io/lib/throttle/components/Identity.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,MAAa,QAAQ;IACZ,GAAG,CAAE,OAAc;QACxB,OAAQ,OAAgC,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAA;IAC7D,CAAC;CACF;AAJD,4BAIC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Component } from './Component';
|
|
2
|
+
/**
|
|
3
|
+
* The route as declared — `/users/:id` — rather than the path a request came in on.
|
|
4
|
+
*
|
|
5
|
+
* A constant per method, resolved when the tree is built, so every request to one
|
|
6
|
+
* route shares a quota however many concrete paths match it.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Route implements Component {
|
|
9
|
+
private readonly route;
|
|
10
|
+
constructor(_: unknown, route: string);
|
|
11
|
+
get(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Route = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The route as declared — `/users/:id` — rather than the path a request came in on.
|
|
6
|
+
*
|
|
7
|
+
* A constant per method, resolved when the tree is built, so every request to one
|
|
8
|
+
* route shares a quota however many concrete paths match it.
|
|
9
|
+
*/
|
|
10
|
+
class Route {
|
|
11
|
+
route;
|
|
12
|
+
constructor(_, route) {
|
|
13
|
+
this.route = route;
|
|
14
|
+
}
|
|
15
|
+
get() {
|
|
16
|
+
return this.route;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Route = Route;
|
|
20
|
+
//# sourceMappingURL=Route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Route.js","sourceRoot":"","sources":["../../../../../../source/directives/io/lib/throttle/components/Route.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,MAAa,KAAK;IACC,KAAK,CAAQ;IAE9B,YAAoB,CAAU,EAAE,KAAa;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,GAAG;QACR,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF;AAVD,sBAUC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Parameter } from '../../../../../RTD';
|
|
2
|
+
import type { Input as Context } from '../../../../../io';
|
|
3
|
+
import type { Component } from './Component';
|
|
4
|
+
/** The value a named route segment was bound to, or nothing when the route has none. */
|
|
5
|
+
export declare class Segment implements Component {
|
|
6
|
+
private readonly name;
|
|
7
|
+
constructor(name: unknown);
|
|
8
|
+
get(_: Context, parameters: Parameter[]): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.Segment = void 0;
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
|
+
/** The value a named route segment was bound to, or nothing when the route has none. */
|
|
9
|
+
class Segment {
|
|
10
|
+
name;
|
|
11
|
+
constructor(name) {
|
|
12
|
+
node_assert_1.default.ok(typeof name === 'string', 'Throttle segment must be a string');
|
|
13
|
+
this.name = name;
|
|
14
|
+
}
|
|
15
|
+
get(_, parameters) {
|
|
16
|
+
return parameters.find(({ name }) => name === this.name)?.value ?? '';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Segment = Segment;
|
|
20
|
+
//# sourceMappingURL=Segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Segment.js","sourceRoot":"","sources":["../../../../../../source/directives/io/lib/throttle/components/Segment.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAKhC,wFAAwF;AACxF,MAAa,OAAO;IACD,IAAI,CAAQ;IAE7B,YAAoB,IAAa;QAC/B,qBAAM,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,EAAE,mCAAmC,CAAC,CAAA;QAExE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEM,GAAG,CAAE,CAAU,EAAE,UAAuB;QAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;IACvE,CAAC;CACF;AAZD,0BAYC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KeyComponentMethod } from '../Configuration';
|
|
2
2
|
import type { Component } from './Component';
|
|
3
|
-
type Constructor<T> = new (options: unknown) => T;
|
|
3
|
+
type Constructor<T> = new (options: unknown, route: string) => T;
|
|
4
4
|
export declare const Components: Record<KeyComponentMethod, Constructor<Component>>;
|
|
5
5
|
export type { Component };
|
|
@@ -3,8 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Components = void 0;
|
|
4
4
|
const Path_1 = require("./Path");
|
|
5
5
|
const IP_1 = require("./IP");
|
|
6
|
+
const Route_1 = require("./Route");
|
|
7
|
+
const Identity_1 = require("./Identity");
|
|
8
|
+
const Segment_1 = require("./Segment");
|
|
6
9
|
exports.Components = {
|
|
7
10
|
ip: IP_1.IP,
|
|
8
|
-
path: Path_1.Path
|
|
11
|
+
path: Path_1.Path,
|
|
12
|
+
route: Route_1.Route,
|
|
13
|
+
identity: Identity_1.Identity,
|
|
14
|
+
segment: Segment_1.Segment
|
|
9
15
|
};
|
|
10
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../source/directives/io/lib/throttle/components/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,6BAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../source/directives/io/lib/throttle/components/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,6BAAyB;AACzB,mCAA+B;AAC/B,yCAAqC;AACrC,uCAAmC;AAMtB,QAAA,UAAU,GAAuD;IAC5E,EAAE,EAAE,OAAE;IACN,IAAI,EAAE,WAAI;IACV,KAAK,EAAE,aAAK;IACZ,QAAQ,EAAE,mBAAQ;IAClB,OAAO,EAAE,iBAAO;CACjB,CAAA"}
|
|
@@ -15,7 +15,7 @@ class Octets {
|
|
|
15
15
|
const Class = DIRECTIVES[name];
|
|
16
16
|
if (Class === undefined)
|
|
17
17
|
throw new Error(`Directive 'octets:${name}' is not implemented`);
|
|
18
|
-
this.discovery ??= remotes.discover('
|
|
18
|
+
this.discovery ??= remotes.discover('exposition', 'octets');
|
|
19
19
|
return new Class(value, this.discovery, remotes);
|
|
20
20
|
}
|
|
21
21
|
async preflight(directives, input, parameters) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Octets.js","sourceRoot":"","sources":["../../../source/directives/octets/Octets.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,uCAAmC;AACnC,+BAA2B;AAC3B,+BAA2B;AAC3B,qCAAiC;AACjC,yCAA8C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YAAY,iBAAO;gBAC9B,OAAO,KAAK,SAAS,CAAA;iBAClB,IAAI,MAAM,KAAK,IAAI;gBACtB,MAAM,GAAG,SAAS,CAAA;;gBAElB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;QAEjD,IAAI,MAAM,KAAK,IAAI;YACjB,OAAO,IAAI,CAAA;QAEb,4CAA4C;QAC5C,IAAI,OAAO,KAAK,IAAI;YAClB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;QAElD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAA;QAExE,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ;YAC9B,MAAM,IAAI,eAAQ,CAAC,qBAAqB,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAA;QAEvF,uCAAuC;QACvC,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAA;IAClG,CAAC;CACF;AA5CD,wBA4CC;AAED,MAAM,UAAU,GAAgC;IAC9C,OAAO,EAAE,iBAAO;IAChB,GAAG,EAAE,SAAG;IACR,GAAG,EAAE,SAAG;IACR,IAAI,EAAE,SAAG;IACT,MAAM,EAAE,eAAM;IACd,QAAQ,EAAE,4BAAiB;CAC5B,CAAA"}
|
|
@@ -56,7 +56,9 @@ class Execution extends node_stream_1.Readable {
|
|
|
56
56
|
if (completed)
|
|
57
57
|
report.status = 'completed';
|
|
58
58
|
if (result instanceof Error) {
|
|
59
|
-
|
|
59
|
+
// an Error cannot be serialized where it sits, and the encoders only unwrap
|
|
60
|
+
// one they are handed directly — this one travels nested inside the report
|
|
61
|
+
report.error = { ...result };
|
|
60
62
|
this.interrupted = true;
|
|
61
63
|
}
|
|
62
64
|
else if (result !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Execution.js","sourceRoot":"","sources":["../../../../source/directives/octets/workflows/Execution.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AACtC,uCAAkC;AAOlC,MAAa,SAAU,SAAQ,sBAAQ;IACpB,KAAK,CAAQ;IACb,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,UAAU,GAA8B,EAAE,CAAA;IAC1C,SAAS,GAAuC,EAAE,CAAA;IAC3D,WAAW,GAAG,KAAK,CAAA;IAE3B,YAAoB,OAAgB,EAAE,KAAa,EAAE,OAAgB;QACnE,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;QAE3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,KAAK,IAAI,CAAC,GAAG,EAAE,CAAA;IACjB,CAAC;IAEe,KAAK;IACrB,CAAC;IAEO,KAAK,CAAC,GAAG;QACf,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAExB,IAAI,IAAI,CAAC,WAAW;gBAClB,MAAK;QACT,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjB,CAAC;IAEO,KAAK,CAAC,OAAO,CAAE,IAAU;QAC/B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE;YACnE,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CA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