@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.
Files changed (115) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/components/{octets.storage → exposition.octets}/manifest.toa.yaml +2 -2
  3. package/components/exposition.stash/manifest.toa.yaml +12 -0
  4. package/components/exposition.stash/operations/count.js +7 -0
  5. package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
  6. package/components/identity.credentials/operations/tsconfig.tsbuildinfo +1 -1
  7. package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
  8. package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
  9. package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
  10. package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
  11. package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
  12. package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
  13. package/documentation/io.md +45 -17
  14. package/documentation/notes/throttling.md +6 -0
  15. package/features/io.throttle.feature +127 -0
  16. package/features/map.feature +5 -5
  17. package/features/octets.cloudinary.feature +12 -9
  18. package/features/octets.download.feature +4 -3
  19. package/features/octets.entries.feature +5 -3
  20. package/features/octets.feature +4 -4
  21. package/features/octets.head.feature +1 -1
  22. package/features/octets.location.feature +1 -1
  23. package/features/octets.meta.feature +2 -2
  24. package/features/octets.workflows.feature +7 -7
  25. package/package.json +8 -8
  26. package/schemas/io/throttle.cos.yaml +9 -2
  27. package/source/Directive.test.ts +72 -7
  28. package/source/Directive.ts +15 -5
  29. package/source/HTTP/messages.ts +5 -1
  30. package/source/Interception.ts +8 -0
  31. package/source/RTD/Context.ts +3 -0
  32. package/source/RTD/Directives.ts +1 -1
  33. package/source/RTD/Tree.ts +17 -0
  34. package/source/RTD/factory.ts +11 -1
  35. package/source/directives/cors/CORS.ts +26 -9
  36. package/source/directives/io/Directive.ts +4 -2
  37. package/source/directives/io/IO.ts +18 -7
  38. package/source/directives/io/Throttle.ts +8 -6
  39. package/source/directives/io/lib/throttle/Configuration.test.ts +21 -0
  40. package/source/directives/io/lib/throttle/Configuration.ts +11 -4
  41. package/source/directives/io/lib/throttle/Keys.ts +12 -11
  42. package/source/directives/io/lib/throttle/Quotas.test.ts +207 -46
  43. package/source/directives/io/lib/throttle/Quotas.ts +59 -35
  44. package/source/directives/io/lib/throttle/components/Component.ts +2 -1
  45. package/source/directives/io/lib/throttle/components/Identity.ts +19 -0
  46. package/source/directives/io/lib/throttle/components/Route.ts +19 -0
  47. package/source/directives/io/lib/throttle/components/Segment.ts +19 -0
  48. package/source/directives/io/lib/throttle/components/index.ts +8 -2
  49. package/source/directives/io/schemas.test.ts +16 -0
  50. package/source/directives/octets/Octets.ts +1 -1
  51. package/source/directives/octets/workflows/Execution.ts +4 -2
  52. package/transpiled/Directive.d.ts +3 -1
  53. package/transpiled/Directive.js +12 -3
  54. package/transpiled/Directive.js.map +1 -1
  55. package/transpiled/HTTP/messages.js +4 -1
  56. package/transpiled/HTTP/messages.js.map +1 -1
  57. package/transpiled/Interception.d.ts +2 -0
  58. package/transpiled/Interception.js +4 -0
  59. package/transpiled/Interception.js.map +1 -1
  60. package/transpiled/RTD/Context.d.ts +2 -0
  61. package/transpiled/RTD/Directives.d.ts +1 -1
  62. package/transpiled/RTD/Tree.js +14 -0
  63. package/transpiled/RTD/Tree.js.map +1 -1
  64. package/transpiled/RTD/factory.js +8 -1
  65. package/transpiled/RTD/factory.js.map +1 -1
  66. package/transpiled/directives/cors/CORS.d.ts +8 -1
  67. package/transpiled/directives/cors/CORS.js +23 -9
  68. package/transpiled/directives/cors/CORS.js.map +1 -1
  69. package/transpiled/directives/io/Directive.d.ts +4 -2
  70. package/transpiled/directives/io/IO.d.ts +6 -3
  71. package/transpiled/directives/io/IO.js +11 -5
  72. package/transpiled/directives/io/IO.js.map +1 -1
  73. package/transpiled/directives/io/Throttle.d.ts +5 -3
  74. package/transpiled/directives/io/Throttle.js +6 -6
  75. package/transpiled/directives/io/Throttle.js.map +1 -1
  76. package/transpiled/directives/io/lib/throttle/Configuration.d.ts +6 -2
  77. package/transpiled/directives/io/lib/throttle/Configuration.js +5 -2
  78. package/transpiled/directives/io/lib/throttle/Configuration.js.map +1 -1
  79. package/transpiled/directives/io/lib/throttle/Keys.d.ts +4 -3
  80. package/transpiled/directives/io/lib/throttle/Keys.js +7 -10
  81. package/transpiled/directives/io/lib/throttle/Keys.js.map +1 -1
  82. package/transpiled/directives/io/lib/throttle/Quotas.d.ts +27 -8
  83. package/transpiled/directives/io/lib/throttle/Quotas.js +47 -31
  84. package/transpiled/directives/io/lib/throttle/Quotas.js.map +1 -1
  85. package/transpiled/directives/io/lib/throttle/components/Component.d.ts +2 -1
  86. package/transpiled/directives/io/lib/throttle/components/Identity.d.ts +11 -0
  87. package/transpiled/directives/io/lib/throttle/components/Identity.js +16 -0
  88. package/transpiled/directives/io/lib/throttle/components/Identity.js.map +1 -0
  89. package/transpiled/directives/io/lib/throttle/components/Route.d.ts +12 -0
  90. package/transpiled/directives/io/lib/throttle/components/Route.js +20 -0
  91. package/transpiled/directives/io/lib/throttle/components/Route.js.map +1 -0
  92. package/transpiled/directives/io/lib/throttle/components/Segment.d.ts +9 -0
  93. package/transpiled/directives/io/lib/throttle/components/Segment.js +20 -0
  94. package/transpiled/directives/io/lib/throttle/components/Segment.js.map +1 -0
  95. package/transpiled/directives/io/lib/throttle/components/index.d.ts +1 -1
  96. package/transpiled/directives/io/lib/throttle/components/index.js +7 -1
  97. package/transpiled/directives/io/lib/throttle/components/index.js.map +1 -1
  98. package/transpiled/directives/octets/Octets.js +1 -1
  99. package/transpiled/directives/octets/Octets.js.map +1 -1
  100. package/transpiled/directives/octets/workflows/Execution.js +3 -1
  101. package/transpiled/directives/octets/workflows/Execution.js.map +1 -1
  102. package/transpiled/tsconfig.tsbuildinfo +1 -1
  103. package/features/auth.issue.feature +0 -32
  104. package/source/directives/io/lib/throttle/Interval.ts +0 -40
  105. package/source/directives/io/lib/throttle/Quota.ts +0 -22
  106. package/transpiled/directives/io/lib/throttle/Interval.d.ts +0 -10
  107. package/transpiled/directives/io/lib/throttle/Interval.js +0 -39
  108. package/transpiled/directives/io/lib/throttle/Interval.js.map +0 -1
  109. package/transpiled/directives/io/lib/throttle/Quota.d.ts +0 -8
  110. package/transpiled/directives/io/lib/throttle/Quota.js +0 -22
  111. package/transpiled/directives/io/lib/throttle/Quota.js.map +0 -1
  112. /package/components/{octets.storage → exposition.octets}/operations/delete.js +0 -0
  113. /package/components/{octets.storage → exposition.octets}/operations/get.js +0 -0
  114. /package/components/{octets.storage → exposition.octets}/operations/head.js +0 -0
  115. /package/components/{octets.storage → exposition.octets}/operations/put.js +0 -0
@@ -1,32 +0,0 @@
1
- Feature: Issue authentication token for a response
2
-
3
- Scenario: Issue token
4
- Given the `echo` is running with the following manifest:
5
- """yaml
6
- exposition:
7
- /:
8
- POST:
9
- auth:issue: id
10
- io:output: true
11
- query: ~
12
- endpoint: echo
13
- """
14
- And transient identity
15
- When the following request is received:
16
- """
17
- POST /echo/ HTTP/1.1
18
- host: nex.toa.io
19
- accept: application/yaml
20
- content-type: application/yaml
21
-
22
- id: ${{ identity.id }}
23
- foo: bar
24
- """
25
- Then the following reply is sent:
26
- """
27
- 201 Created
28
- authorization: Token ${{ token }}
29
-
30
- id: ${{ identity.id }}
31
- foo: bar
32
- """
@@ -1,40 +0,0 @@
1
- import assert from 'node:assert'
2
- import { EventEmitter } from 'node:events'
3
-
4
- export class Interval extends EventEmitter {
5
- public number: number = 0
6
- private timeout: ReturnType<typeof setTimeout> | null = null
7
- private interval: ReturnType<typeof setInterval> | null = null
8
-
9
- public constructor (interval: number) {
10
- super()
11
-
12
- const number = Math.ceil(Date.now() / interval)
13
- const shift = number * interval - Date.now()
14
-
15
- assert.ok(shift >= 0, 'shift must be positive')
16
-
17
- this.timeout = setTimeout(() => this.start(interval), shift)
18
- this.timeout.unref()
19
- }
20
-
21
- public start (interval: number): void {
22
- this.timeout = null
23
- this.interval = setInterval(() => this.emit('tick'), interval)
24
- this.interval.unref()
25
- }
26
-
27
- public dispose (): void {
28
- if (this.timeout !== null) {
29
- clearTimeout(this.timeout)
30
- this.timeout = null
31
- }
32
-
33
- if (this.interval !== null) {
34
- clearInterval(this.interval)
35
- this.interval = null
36
- }
37
-
38
- this.removeAllListeners()
39
- }
40
- }
@@ -1,22 +0,0 @@
1
- export class Quota {
2
- private readonly limit: number = 0
3
- private used: number = 0
4
-
5
- public constructor (limit: number) {
6
- this.limit = limit
7
- }
8
-
9
- public get idle (): boolean {
10
- return this.used === 0
11
- }
12
-
13
- public use (count = 1): boolean {
14
- this.used += count
15
-
16
- return this.used < this.limit
17
- }
18
-
19
- public reset (): void {
20
- this.used = 0
21
- }
22
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'node:events';
3
- export declare class Interval extends EventEmitter {
4
- number: number;
5
- private timeout;
6
- private interval;
7
- constructor(interval: number);
8
- start(interval: number): void;
9
- dispose(): void;
10
- }
@@ -1,39 +0,0 @@
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.Interval = void 0;
7
- const node_assert_1 = __importDefault(require("node:assert"));
8
- const node_events_1 = require("node:events");
9
- class Interval extends node_events_1.EventEmitter {
10
- number = 0;
11
- timeout = null;
12
- interval = null;
13
- constructor(interval) {
14
- super();
15
- const number = Math.ceil(Date.now() / interval);
16
- const shift = number * interval - Date.now();
17
- node_assert_1.default.ok(shift >= 0, 'shift must be positive');
18
- this.timeout = setTimeout(() => this.start(interval), shift);
19
- this.timeout.unref();
20
- }
21
- start(interval) {
22
- this.timeout = null;
23
- this.interval = setInterval(() => this.emit('tick'), interval);
24
- this.interval.unref();
25
- }
26
- dispose() {
27
- if (this.timeout !== null) {
28
- clearTimeout(this.timeout);
29
- this.timeout = null;
30
- }
31
- if (this.interval !== null) {
32
- clearInterval(this.interval);
33
- this.interval = null;
34
- }
35
- this.removeAllListeners();
36
- }
37
- }
38
- exports.Interval = Interval;
39
- //# sourceMappingURL=Interval.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Interval.js","sourceRoot":"","sources":["../../../../../source/directives/io/lib/throttle/Interval.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAChC,6CAA0C;AAE1C,MAAa,QAAS,SAAQ,0BAAY;IACjC,MAAM,GAAW,CAAC,CAAA;IACjB,OAAO,GAAyC,IAAI,CAAA;IACpD,QAAQ,GAA0C,IAAI,CAAA;IAE9D,YAAoB,QAAgB;QAClC,KAAK,EAAE,CAAA;QAEP,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAA;QAC/C,MAAM,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAE5C,qBAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,EAAE,wBAAwB,CAAC,CAAA;QAE/C,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAA;QAC5D,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;IAEM,KAAK,CAAE,QAAgB;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAA;QAC9D,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;IAEM,OAAO;QACZ,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC1B,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACrB,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3B,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACtB,CAAC;QAED,IAAI,CAAC,kBAAkB,EAAE,CAAA;IAC3B,CAAC;CACF;AApCD,4BAoCC"}
@@ -1,8 +0,0 @@
1
- export declare class Quota {
2
- private readonly limit;
3
- private used;
4
- constructor(limit: number);
5
- get idle(): boolean;
6
- use(count?: number): boolean;
7
- reset(): void;
8
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Quota = void 0;
4
- class Quota {
5
- limit = 0;
6
- used = 0;
7
- constructor(limit) {
8
- this.limit = limit;
9
- }
10
- get idle() {
11
- return this.used === 0;
12
- }
13
- use(count = 1) {
14
- this.used += count;
15
- return this.used < this.limit;
16
- }
17
- reset() {
18
- this.used = 0;
19
- }
20
- }
21
- exports.Quota = Quota;
22
- //# sourceMappingURL=Quota.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Quota.js","sourceRoot":"","sources":["../../../../../source/directives/io/lib/throttle/Quota.ts"],"names":[],"mappings":";;;AAAA,MAAa,KAAK;IACC,KAAK,GAAW,CAAC,CAAA;IAC1B,IAAI,GAAW,CAAC,CAAA;IAExB,YAAoB,KAAa;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,KAAK,CAAC,CAAA;IACxB,CAAC;IAEM,GAAG,CAAE,KAAK,GAAG,CAAC;QACnB,IAAI,CAAC,IAAI,IAAI,KAAK,CAAA;QAElB,OAAO,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;IAC/B,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;IACf,CAAC;CACF;AArBD,sBAqBC"}