@toa.io/extensions.realtime 1.0.0-alpha.31 → 1.0.0-alpha.310

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 (74) hide show
  1. package/components/realtime.streams/manifest.toa.yaml +52 -0
  2. package/components/realtime.streams/operations/create.js +77 -0
  3. package/components/realtime.streams/operations/lib/Stash.js +86 -0
  4. package/components/realtime.streams/operations/lib/Stream.js +43 -0
  5. package/components/realtime.streams/operations/lib/index.js +3 -0
  6. package/components/realtime.streams/operations/push.js +18 -0
  7. package/components/realtime.streams/source/create.ts +107 -0
  8. package/components/realtime.streams/source/lib/Stash.ts +131 -0
  9. package/components/realtime.streams/source/lib/Stream.ts +58 -0
  10. package/components/realtime.streams/source/lib/index.ts +2 -0
  11. package/components/realtime.streams/source/push.ts +23 -0
  12. package/components/{streams → realtime.streams}/tsconfig.json +2 -1
  13. package/components/realtime.streams/types/index.d.ts +20 -0
  14. package/components/realtime.streams/types/toa.d.ts +30 -0
  15. package/package.json +18 -7
  16. package/readme.md +41 -7
  17. package/transpiled/Composition.d.ts +10 -4
  18. package/transpiled/Composition.js +21 -20
  19. package/transpiled/Composition.js.map +1 -1
  20. package/transpiled/Factory.d.ts +6 -6
  21. package/transpiled/Factory.js +19 -21
  22. package/transpiled/Factory.js.map +1 -1
  23. package/transpiled/Realtime.d.ts +3 -2
  24. package/transpiled/Realtime.js +41 -11
  25. package/transpiled/Realtime.js.map +1 -1
  26. package/transpiled/Receiver.d.ts +26 -0
  27. package/transpiled/Receiver.js +57 -0
  28. package/transpiled/Receiver.js.map +1 -0
  29. package/transpiled/Routes.d.ts +4 -10
  30. package/transpiled/Routes.js +18 -34
  31. package/transpiled/Routes.js.map +1 -1
  32. package/transpiled/index.d.ts +2 -1
  33. package/transpiled/index.js +2 -5
  34. package/transpiled/index.js.map +1 -1
  35. package/transpiled/measurements.d.ts +2 -0
  36. package/transpiled/measurements.js +18 -0
  37. package/transpiled/measurements.js.map +1 -0
  38. package/.readme/overview-dark.jpg +0 -0
  39. package/.readme/overview-light.jpg +0 -0
  40. package/components/context.toa.yaml +0 -11
  41. package/components/streams/manifest.toa.yaml +0 -21
  42. package/components/streams/operations/create.d.ts +0 -14
  43. package/components/streams/operations/create.js +0 -29
  44. package/components/streams/operations/create.js.map +0 -1
  45. package/components/streams/operations/lib/stream.d.ts +0 -10
  46. package/components/streams/operations/lib/stream.js +0 -31
  47. package/components/streams/operations/lib/stream.js.map +0 -1
  48. package/components/streams/operations/push.d.ts +0 -2
  49. package/components/streams/operations/push.js +0 -8
  50. package/components/streams/operations/push.js.map +0 -1
  51. package/components/streams/operations/tsconfig.tsbuildinfo +0 -1
  52. package/components/streams/operations/types.d.ts +0 -11
  53. package/components/streams/operations/types.js +0 -3
  54. package/components/streams/operations/types.js.map +0 -1
  55. package/components/streams/source/create.ts +0 -38
  56. package/components/streams/source/lib/stream.ts +0 -37
  57. package/components/streams/source/push.ts +0 -5
  58. package/components/streams/source/types.ts +0 -13
  59. package/cucumber.js +0 -8
  60. package/features/static.feature +0 -32
  61. package/features/steps/Components.ts +0 -71
  62. package/features/steps/Realtime.ts +0 -43
  63. package/features/steps/Streams.ts +0 -50
  64. package/features/steps/components/messages/manifest.toa.yaml +0 -16
  65. package/features/steps/config.ts +0 -1
  66. package/features/steps/tsconfig.json +0 -9
  67. package/source/Composition.ts +0 -40
  68. package/source/Factory.ts +0 -33
  69. package/source/Realtime.ts +0 -38
  70. package/source/Routes.ts +0 -84
  71. package/source/index.ts +0 -1
  72. package/stage/streams.test.ts +0 -128
  73. package/transpiled/tsconfig.tsbuildinfo +0 -1
  74. package/tsconfig.json +0 -12
@@ -0,0 +1,30 @@
1
+ // Written by `toa types`. Every run rewrites it.
2
+ // What a manifest does not state belongs in a file of your own.
3
+
4
+ import type { Options } from '@toa.io/core/types'
5
+ import type { FetchInit } from '@toa.io/extensions.fetch'
6
+ import type { Stash } from '@toa.io/extensions.stash'
7
+ import type { Logs, Metrics, Span } from '@toa.io/extensions.telemetry'
8
+
9
+ export type CreateInput = {
10
+ key?: string
11
+ token?: string
12
+ }
13
+
14
+ export type PushInput = {
15
+ data?: unknown
16
+ key: string
17
+ event: string
18
+ }
19
+
20
+ export type PushOutput = null
21
+
22
+ export interface Component {
23
+ create: (request: { input: CreateInput, task?: boolean }, options?: Options) => Promise<unknown>
24
+ push: (request: { input: PushInput, task?: boolean }, options?: Options) => Promise<PushOutput>
25
+ }
26
+
27
+ export interface Configuration {
28
+ maxlen: number
29
+ expire: number
30
+ }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@toa.io/extensions.realtime",
3
- "version": "1.0.0-alpha.31",
3
+ "version": "1.0.0-alpha.310",
4
+ "type": "module",
4
5
  "description": "Toa Realtime",
5
6
  "author": "temich <tema.gurtovoy@gmail.com>",
6
7
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -16,13 +17,23 @@
16
17
  "publishConfig": {
17
18
  "access": "public"
18
19
  },
19
- "jest": {
20
- "preset": "ts-jest",
21
- "testEnvironment": "node"
20
+ "files": [
21
+ "transpiled",
22
+ "components",
23
+ "readme.md",
24
+ "!**/tsconfig.tsbuildinfo",
25
+ "!**/*.test.*",
26
+ "!**/.env*"
27
+ ],
28
+ "dependencies": {
29
+ "@toa.io/core": "1.0.0-alpha.310",
30
+ "@toa.io/definitions": "1.0.0-alpha.310",
31
+ "@toa.io/generic": "1.0.0-alpha.310",
32
+ "openspan": "1.0.0-alpha.305"
22
33
  },
23
34
  "scripts": {
24
- "transpile": "npx tsc && npx tsc -p ./components/streams",
25
- "features": "npx cucumber-js"
35
+ "transpile": "npx tsc && npx tsc -p ./components/realtime.streams",
36
+ "features": "TSX_TSCONFIG_PATH=features/steps/tsconfig.json NODE_OPTIONS=--import=tsx cucumber-js"
26
37
  },
27
- "gitHead": "91839a488176853a0731f49abc70dc7103ed7cca"
38
+ "gitHead": "d952c57f77279729e26d52d50c6df47138ad0a4f"
28
39
  }
package/readme.md CHANGED
@@ -10,17 +10,20 @@
10
10
  </a>
11
11
 
12
12
  Realtime extension combines application events into streams according to defined routes.
13
- Clients may consume these streams [via Exposition](#exposition).
13
+ Clients may consume these streams [via Exposition](/extensions/exposition).
14
+
15
+ If stream is idle for 16 seconds, a `heartbeat` message is sent.
14
16
 
15
17
  ## Static routes
16
18
 
17
19
  Static route specifies an event that should be combined into a stream using specified property of
18
- event's payload as a stream key.
20
+ event's payload as a stream key or an array of stream keys.
19
21
 
20
22
  Static routes may be defined in Component manifest or the Context annotation.
21
23
 
22
24
  ```yaml
23
25
  # manifest.toa.yaml
26
+
24
27
  name: users
25
28
 
26
29
  realtime:
@@ -29,13 +32,24 @@ realtime:
29
32
 
30
33
  ```yaml
31
34
  # context.toa.yaml
35
+
32
36
  realtime:
33
37
  users.updated: id
34
- orders.created: custromer_id
38
+ orders.created: customer_id
35
39
  ```
36
40
 
37
41
  In case of conflict, the Context annotation takes precedence.
38
42
 
43
+ Multiple stream keys may be defined for a single event.
44
+
45
+ ```yaml
46
+ # manifest.toa.yaml
47
+ name: messages
48
+
49
+ realtime:
50
+ updated: [sender_id, recipient_id]
51
+ ```
52
+
39
53
  ### Static route examples
40
54
 
41
55
  Given two rules: `users.updated: id` and `orders.created: customer_id`,
@@ -87,13 +101,33 @@ Dynamic routes are managed by the `realtime.routes` component, running in the Re
87
101
 
88
102
  ## Exposition
89
103
 
90
- Streams are exposed by the [`realtime.streams`](components/streams) component, running in the
104
+ Streams are exposed by the [`realtime.streams`](components/realtime.streams) component, running in the
91
105
  Realtime extension, and are
92
106
  accessible via the `/realtime/streams/:key/` resource with
93
107
  the [`auth:id: key`](/extensions/exposition/documentation/access.md#id) authorization rule.
94
108
 
95
- Refer to the [Exposition extension](/extensions/exposition) for more
96
- details:
109
+ Opening a stream is not a read, and `GET` is the method a client opens one with, so the route
110
+ declares [`io:readonly: false`](/extensions/exposition/documentation/io.md#readonly).
97
111
 
98
- - [Streams](/extensions/exposition/documentation/protocol.md#streams)
112
+ A key may be consumed by several clients at once — the same user on two devices, or in two
113
+ tabs. Each of them receives every event routed to the key, and one of them disconnecting leaves
114
+ the others connected.
115
+
116
+ Refer to the [Exposition extension](/extensions/exposition) for more details:
117
+
118
+ - [Multipart responses](/extensions/exposition/documentation/protocol.md#multipart-types)
99
119
  - [Access authorization](/extensions/exposition/documentation/access.md)
120
+ - [Readonly chains](/documentation/readonly.md)
121
+
122
+ ## Resources management
123
+
124
+ Resource requests and limits can be specified by `resources` annotation:
125
+
126
+ ```yaml
127
+ # context.toa.yaml
128
+
129
+ realtime:
130
+ resources:
131
+ cpu: [100m, 500m]
132
+ memory: [100Mi, 200Mi]
133
+ ```
@@ -1,8 +1,14 @@
1
1
  import { Connector } from '@toa.io/core';
2
- import { type Bootloader } from './Factory';
2
+ import { type Host } from './Factory.ts';
3
3
  export declare class Composition extends Connector {
4
- private readonly boot;
5
- constructor(boot: Bootloader);
4
+ private readonly host;
5
+ constructor(host: Host);
6
6
  protected open(): Promise<void>;
7
- protected dispose(): void;
8
7
  }
8
+ export declare function find(): string[];
9
+ export declare function components(): Components;
10
+ interface Components {
11
+ labels: string[];
12
+ paths: string[];
13
+ }
14
+ export {};
@@ -1,33 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Composition = void 0;
4
- const node_fs_1 = require("node:fs");
5
- const node_path_1 = require("node:path");
6
- const core_1 = require("@toa.io/core");
7
- class Composition extends core_1.Connector {
8
- boot;
9
- constructor(boot) {
1
+ import { readdirSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { Connector } from '@toa.io/core';
4
+ export class Composition extends Connector {
5
+ host;
6
+ constructor(host) {
10
7
  super();
11
- this.boot = boot;
8
+ this.host = host;
12
9
  }
13
10
  async open() {
14
11
  const paths = find();
15
- const composition = await this.boot.composition(paths);
12
+ const composition = await this.host.composition(paths);
16
13
  await composition.connect();
17
14
  this.depends(composition);
18
- console.info('Composition complete.');
19
- }
20
- dispose() {
21
- console.info('Composition shutdown complete.');
22
15
  }
23
16
  }
24
- exports.Composition = Composition;
25
- function find() {
26
- return entries().map((entry) => (0, node_path_1.resolve)(ROOT, entry.name));
17
+ export function find() {
18
+ return entries().map((entry) => resolve(ROOT, entry.name));
27
19
  }
28
20
  function entries() {
29
- const entries = (0, node_fs_1.readdirSync)(ROOT, { withFileTypes: true });
21
+ const entries = readdirSync(ROOT, { withFileTypes: true });
30
22
  return entries.filter((entry) => entry.isDirectory());
31
23
  }
32
- const ROOT = (0, node_path_1.resolve)(__dirname, '../components/');
24
+ export function components() {
25
+ const labels = [];
26
+ const paths = [];
27
+ for (const entry of entries()) {
28
+ labels.push(entry.name.replace('.', '-'));
29
+ paths.push(resolve(ROOT, entry.name));
30
+ }
31
+ return { labels, paths };
32
+ }
33
+ const ROOT = resolve(import.meta.dirname, '../components/');
33
34
  //# sourceMappingURL=Composition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Composition.js","sourceRoot":"","sources":["../source/Composition.ts"],"names":[],"mappings":";;;AAAA,qCAAkD;AAClD,yCAAmC;AACnC,uCAAwC;AAGxC,MAAa,WAAY,SAAQ,gBAAS;IACvB,IAAI,CAAY;IAEjC,YAAoB,IAAgB;QAClC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEkB,KAAK,CAAC,IAAI;QAC3B,MAAM,KAAK,GAAG,IAAI,EAAE,CAAA;QACpB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QAEtD,MAAM,WAAW,CAAC,OAAO,EAAE,CAAA;QAE3B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAEzB,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;IACvC,CAAC;IAEkB,OAAO;QACxB,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;IAChD,CAAC;CACF;AAtBD,kCAs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CAAC,IAAI,CAAC,CAAC,CAAA;AAC5D,CAAC;AAED,SAAS,OAAO;IACd,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;IAE1D,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;AACvD,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;QACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC;AAOD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA"}
@@ -1,9 +1,9 @@
1
- import { type extensions } from '@toa.io/core';
2
- import { Realtime } from './Realtime';
1
+ import { type Connector } from '@toa.io/core';
2
+ import type { extensions } from '@toa.io/core/types';
3
3
  export declare class Factory implements extensions.Factory {
4
- private readonly boot;
5
- constructor(boot: Bootloader);
6
- service(): Realtime;
4
+ private readonly host;
5
+ constructor(host: Host);
6
+ service(): Connector;
7
7
  private discovery;
8
8
  }
9
- export type Bootloader = typeof import('@toa.io/boot');
9
+ export type Host = extensions.Host;
@@ -1,28 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Factory = void 0;
4
- const core_1 = require("@toa.io/core");
5
- const Realtime_1 = require("./Realtime");
6
- const Composition_1 = require("./Composition");
7
- const Routes_1 = require("./Routes");
8
- class Factory {
9
- boot;
10
- constructor(boot) {
11
- this.boot = boot;
1
+ import { Locator } from '@toa.io/core';
2
+ import { Realtime } from './Realtime.js';
3
+ import { Composition } from './Composition.js';
4
+ import { Routes } from './Routes.js';
5
+ export class Factory {
6
+ host;
7
+ constructor(host) {
8
+ this.host = host;
12
9
  }
10
+ // a halt takes the whole of it: a stream it would keep open has nothing to carry
13
11
  service() {
14
- const discovery = this.discovery();
15
- const routes = new Routes_1.Routes(this.boot);
16
- const composition = new Composition_1.Composition(this.boot);
17
- const realtime = new Realtime_1.Realtime(routes, discovery);
18
- realtime.depends(routes);
19
- realtime.depends(composition);
20
- return realtime;
12
+ return this.host.gate(async () => {
13
+ const routes = new Routes(this.host);
14
+ const composition = new Composition(this.host);
15
+ const realtime = new Realtime(routes, async () => await this.discovery());
16
+ realtime.depends(routes);
17
+ realtime.depends(composition);
18
+ return realtime;
19
+ });
21
20
  }
22
21
  async discovery() {
23
- const locator = new core_1.Locator('streams', 'realtime');
24
- return await this.boot.remote(locator);
22
+ const locator = new Locator('streams', 'realtime');
23
+ return await this.host.remote(locator, { service: 'realtime' });
25
24
  }
26
25
  }
27
- exports.Factory = Factory;
28
26
  //# sourceMappingURL=Factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":";;;AAAA,uCAAuE;AACvE,yCAAqC;AACrC,+CAA2C;AAC3C,qCAAiC;AAEjC,MAAa,OAAO;IACD,IAAI,CAAY;IAEjC,YAAoB,IAAgB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEM,OAAO;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAClC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpC,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CA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AAA;YACxB,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;YAE7B,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,KAAK,CAAC,SAAS;QACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;QAElD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;IACjE,CAAC;CACF"}
@@ -1,10 +1,11 @@
1
1
  import { type Component, Connector } from '@toa.io/core';
2
- import { type Routes } from './Routes';
2
+ import { type Routes } from './Routes.ts';
3
3
  export declare class Realtime extends Connector {
4
4
  private readonly discovery;
5
5
  private streams;
6
- constructor(routes: Routes, discovery: Promise<Component>);
6
+ constructor(routes: Routes, discovery: () => Promise<Component>);
7
7
  protected open(): Promise<void>;
8
8
  protected dispose(): void;
9
9
  private push;
10
+ private deliver;
10
11
  }
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Realtime = void 0;
4
- const core_1 = require("@toa.io/core");
5
- class Realtime extends core_1.Connector {
1
+ import { console, run } from 'openspan';
2
+ import { Connector } from '@toa.io/core';
3
+ import * as measure from './measurements.js';
4
+ export class Realtime extends Connector {
6
5
  discovery;
7
6
  streams = null;
8
7
  constructor(routes, discovery) {
@@ -11,17 +10,48 @@ class Realtime extends core_1.Connector {
11
10
  routes.events.on('data', this.push.bind(this));
12
11
  }
13
12
  async open() {
14
- this.streams = await this.discovery;
13
+ // the lookup belongs here, not in the constructor: dependencies connect before
14
+ // open, so the composition that serves realtime.streams is up to answer it. Asked
15
+ // any earlier the lookup goes unanswered, and it waits without a bound.
16
+ this.streams = await this.discovery();
15
17
  this.depends(this.streams);
16
18
  await this.streams.connect();
17
- console.log('Realtime has started.');
19
+ console.info('Realtime service started');
18
20
  }
19
21
  dispose() {
20
- console.log('Realtime shutdown complete.');
22
+ console.info('Realtime service shutdown complete');
21
23
  }
22
- push(event) {
23
- void this.streams?.invoke('push', { input: event });
24
+ push({ telemetry, ...event }) {
25
+ const processing = telemetry === null
26
+ ? this.deliver(event)
27
+ : run(telemetry, async () => await this.deliver(event));
28
+ void processing.catch((error) => {
29
+ measure.failed(event.event);
30
+ console.error('Realtime push failed', error);
31
+ });
32
+ }
33
+ async deliver(event) {
34
+ /*
35
+ * The delivery span is created on behalf of the messaging destination
36
+ * (same as the core Receiver), so that service graphs display the fan-out:
37
+ * producer -> destination -> realtime
38
+ */
39
+ const delivery = {
40
+ name: `${event.event} deliver`,
41
+ kind: 'producer',
42
+ service: event.event,
43
+ attributes: { 'messaging.destination.name': event.event }
44
+ };
45
+ const options = {
46
+ name: `${event.event} push`,
47
+ kind: 'consumer',
48
+ service: 'realtime',
49
+ attributes: { 'messaging.destination.name': event.event }
50
+ };
51
+ await console.span(delivery, async () => await console.span(options, async () => {
52
+ await this.streams?.invoke('push', { input: event });
53
+ measure.delivered(event.event);
54
+ }));
24
55
  }
25
56
  }
26
- exports.Realtime = Realtime;
27
57
  //# sourceMappingURL=Realtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Realtime.js","sourceRoot":"","sources":["../source/Realtime.ts"],"names":[],"mappings":";;;AAAA,uCAAwD;AAGxD,MAAa,QAAS,SAAQ,gBAAS;IACpB,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,MAAc,EAAE,SAA6B;QAC/D,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAE1B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAChD,CAAC;IAEkB,KAAK,CAAC,IAAI;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAA;QACnC,IA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AM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAEpD,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC,CAAC,CACL,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,26 @@
1
+ import { Connector } from '@toa.io/core';
2
+ import type { Message } from '@toa.io/core/types';
3
+ import type { SpanContext } from 'openspan';
4
+ import type { Readable } from 'node:stream';
5
+ export declare class Receiver extends Connector {
6
+ private readonly event;
7
+ private readonly properties;
8
+ private readonly expose?;
9
+ private readonly stream;
10
+ constructor({ event, properties, stream, expose }: {
11
+ event: string;
12
+ properties: string[];
13
+ stream: Readable;
14
+ expose?: string[];
15
+ });
16
+ receive(message: Message<Record<string, string>>): Promise<void>;
17
+ private process;
18
+ private fit;
19
+ private push;
20
+ }
21
+ export interface Push {
22
+ key: string;
23
+ event: string;
24
+ data: Record<string, string>;
25
+ telemetry: SpanContext | null;
26
+ }
@@ -0,0 +1,57 @@
1
+ import { console, decode, run } from 'openspan';
2
+ import { Connector } from '@toa.io/core';
3
+ export class Receiver extends Connector {
4
+ event;
5
+ properties;
6
+ expose;
7
+ stream;
8
+ constructor({ event, properties, stream, expose }) {
9
+ super();
10
+ this.event = event;
11
+ this.properties = properties;
12
+ this.expose = expose;
13
+ this.stream = stream;
14
+ }
15
+ async receive(message) {
16
+ // the push continues the trace from the producer
17
+ const telemetry = message.telemetry === undefined ? null : decode(message.telemetry);
18
+ if (telemetry === null)
19
+ this.process(message, telemetry);
20
+ else
21
+ run(telemetry, () => this.process(message, telemetry));
22
+ }
23
+ process(message, telemetry) {
24
+ const data = this.fit(message.payload);
25
+ for (const property of this.properties) {
26
+ const key = message.payload[property];
27
+ if (key === undefined) {
28
+ console.debug('Event does not contain key property', {
29
+ property,
30
+ event: this.event
31
+ });
32
+ continue;
33
+ }
34
+ if (Array.isArray(key))
35
+ // eslint-disable-next-line max-depth
36
+ for (const k of key)
37
+ this.push(k, data, telemetry);
38
+ else
39
+ this.push(key, data, telemetry);
40
+ }
41
+ }
42
+ fit(payload) {
43
+ if (this.expose === undefined)
44
+ return payload;
45
+ const entries = Object.entries(payload).filter(([key]) => this.expose.includes(key));
46
+ return Object.fromEntries(entries);
47
+ }
48
+ push(key, data, telemetry) {
49
+ if (key === null || typeof key === 'undefined') {
50
+ console.debug('Key is null or undefined, skipping', { key, event: this.event });
51
+ return;
52
+ }
53
+ console.debug('Pushing event to stream', { key, event: this.event, data });
54
+ this.stream.push({ key, event: this.event, data, telemetry });
55
+ }
56
+ }
57
+ //# sourceMappingURL=Receiver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Receiver.js","sourceRoot":"","sources":["../source/Receiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC,MAAM,OAAO,QAAS,SAAQ,SAAS;IACpB,KAAK,CAAQ;IACb,UAAU,CAAU;IACpB,MAAM,CAAW;IACjB,MAAM,CAAU;IAEjC,YAAmB,EACjB,KAAK,EACL,UAAU,EACV,MAAM,EACN,MAAM,EAMP;QACC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAwC;QAC3D,iDAAiD;QACjD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAEpF,IAAI,SAAS,KAAK,IAAI;YAAE,IAAI,CAAC,OAAO,CAAC,OA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C5B,SAA6B;QAE7B,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;YAE/E,OAAM;QACR,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAE1E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAiB,CAAC,CAAA;IAC9E,CAAC;CACF"}
@@ -1,22 +1,16 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'node:stream';
3
2
  import { Connector } from '@toa.io/core';
4
- import { type Bootloader } from './Factory';
3
+ export type { Route } from '@toa.io/definitions/extensions.realtime';
4
+ import type { Host } from './Factory.ts';
5
5
  export declare class Routes extends Connector {
6
6
  events: Events;
7
- private readonly boot;
8
- constructor(boot: Bootloader);
7
+ private readonly host;
8
+ constructor(host: Host);
9
9
  private static read;
10
10
  open(): Promise<void>;
11
11
  close(): Promise<void>;
12
- private getReceiver;
13
12
  }
14
13
  declare class Events extends Readable {
15
14
  constructor();
16
15
  _read(): void;
17
16
  }
18
- export interface Route {
19
- event: string;
20
- properties: string[];
21
- }
22
- export {};
@@ -1,26 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Routes = void 0;
4
- const node_stream_1 = require("node:stream");
5
- const core_1 = require("@toa.io/core");
6
- const generic_1 = require("@toa.io/generic");
7
- class Routes extends core_1.Connector {
1
+ import { Readable } from 'node:stream';
2
+ import { console } from 'openspan';
3
+ import { Connector } from '@toa.io/core';
4
+ import { Receiver } from './Receiver.js';
5
+ import { environment } from '@toa.io/generic';
6
+ export class Routes extends Connector {
8
7
  events = new Events();
9
- boot;
10
- constructor(boot) {
8
+ host;
9
+ constructor(host) {
11
10
  super();
12
- this.boot = boot;
11
+ this.host = host;
13
12
  }
14
13
  static read() {
15
- if (process.env.TOA_REALTIME === undefined)
14
+ const value = environment.get('TOA_REALTIME');
15
+ if (value === undefined)
16
16
  throw new Error('TOA_REALTIME is not defined');
17
- return (0, generic_1.decode)(process.env.TOA_REALTIME);
17
+ return JSON.parse(value);
18
18
  }
19
19
  async open() {
20
20
  const routes = Routes.read();
21
21
  const creating = [];
22
- for (const { event, properties } of routes) {
23
- const consumer = this.boot.receive(event, this.getReceiver(event, properties));
22
+ for (const { event, properties, expose } of routes) {
23
+ const consumer = this.host.receive(event, new Receiver({ event, properties, stream: this.events, expose }));
24
24
  creating.push(consumer);
25
25
  }
26
26
  const consumers = await Promise.all(creating);
@@ -28,32 +28,16 @@ class Routes extends core_1.Connector {
28
28
  const connecting = consumers.map((consumer) => consumer.connect());
29
29
  await Promise.all(connecting);
30
30
  this.depends(consumers);
31
- console.log(`Event sources (${creating.length}) connected.`);
31
+ console.info('Event sources connected', { count: creating.length });
32
32
  }
33
33
  async close() {
34
- console.log('Event sources disconnected.');
35
- }
36
- getReceiver(event, properties) {
37
- return {
38
- receive: (message) => {
39
- for (const property of properties) {
40
- const key = message.payload[property];
41
- if (key === undefined) {
42
- console.error(`Event '${event}' does not contain the '${property}' property.`);
43
- return;
44
- }
45
- this.events.push({ key, event, data: message.payload });
46
- }
47
- }
48
- };
34
+ console.info('Event sources disconnected');
49
35
  }
50
36
  }
51
- exports.Routes = Routes;
52
- class Events extends node_stream_1.Readable {
37
+ class Events extends Readable {
53
38
  constructor() {
54
39
  super({ objectMode: true });
55
40
  }
56
- _read() {
57
- }
41
+ _read() { }
58
42
  }
59
43
  //# sourceMappingURL=Routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Routes.js","sourceRoot":"","sources":["../source/Routes.ts"],"names":[],"mappings":";;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AA4B,CAAC,CAAA;IAC5C,CAAC;CACF;AAED,MAAM,MAAO,SAAQ,QAAQ;IAC3B;QACE,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAC7B,CAAC;IAEe,KAAK,KAAU,CAAC;CACjC"}
@@ -1 +1,2 @@
1
- export { Factory } from './Factory';
1
+ export { Factory } from './Factory.ts';
2
+ export { components } from './Composition.ts';
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Factory = void 0;
4
- var Factory_1 = require("./Factory");
5
- Object.defineProperty(exports, "Factory", { enumerable: true, get: function () { return Factory_1.Factory; } });
1
+ export { Factory } from './Factory.js';
2
+ export { components } from './Composition.js';
6
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AAA1B,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function delivered(event: string): void;
2
+ export declare function failed(event: string): void;