@toa.io/extensions.realtime 1.0.0-alpha.274 → 1.0.0-alpha.277

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 (61) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/components/realtime.streams/operations/create.d.ts +1 -2
  3. package/components/realtime.streams/operations/create.js +4 -8
  4. package/components/realtime.streams/operations/create.js.map +1 -1
  5. package/components/realtime.streams/operations/lib/Stash.js +1 -5
  6. package/components/realtime.streams/operations/lib/Stash.js.map +1 -1
  7. package/components/realtime.streams/operations/lib/Stream.d.ts +3 -4
  8. package/components/realtime.streams/operations/lib/Stream.js +4 -7
  9. package/components/realtime.streams/operations/lib/Stream.js.map +1 -1
  10. package/components/realtime.streams/operations/lib/index.d.ts +2 -2
  11. package/components/realtime.streams/operations/lib/index.js +2 -7
  12. package/components/realtime.streams/operations/lib/index.js.map +1 -1
  13. package/components/realtime.streams/operations/lib/types.d.ts +2 -2
  14. package/components/realtime.streams/operations/lib/types.js +1 -2
  15. package/components/realtime.streams/operations/push.d.ts +1 -1
  16. package/components/realtime.streams/operations/push.js +1 -5
  17. package/components/realtime.streams/operations/push.js.map +1 -1
  18. package/components/realtime.streams/source/create.ts +2 -2
  19. package/components/realtime.streams/source/lib/Stream.ts +2 -1
  20. package/components/realtime.streams/source/lib/index.ts +2 -2
  21. package/components/realtime.streams/source/lib/types.ts +2 -2
  22. package/components/realtime.streams/source/push.ts +1 -1
  23. package/components/realtime.streams/tsconfig.json +1 -0
  24. package/components/realtime.streams/tsconfig.tsbuildinfo +1 -0
  25. package/cucumber.mjs +5 -0
  26. package/features/steps/Components.ts +7 -4
  27. package/features/steps/Realtime.ts +10 -9
  28. package/features/steps/Streams.ts +5 -2
  29. package/package.json +6 -9
  30. package/source/Composition.ts +2 -2
  31. package/source/Factory.ts +3 -3
  32. package/source/Realtime.ts +2 -2
  33. package/source/Routes.ts +3 -3
  34. package/source/extension.ts +4 -3
  35. package/source/index.ts +2 -2
  36. package/transpiled/Composition.d.ts +1 -1
  37. package/transpiled/Composition.js +10 -16
  38. package/transpiled/Composition.js.map +1 -1
  39. package/transpiled/Factory.d.ts +1 -1
  40. package/transpiled/Factory.js +9 -13
  41. package/transpiled/Factory.js.map +1 -1
  42. package/transpiled/Realtime.d.ts +1 -1
  43. package/transpiled/Realtime.js +8 -12
  44. package/transpiled/Realtime.js.map +1 -1
  45. package/transpiled/Receiver.d.ts +0 -1
  46. package/transpiled/Receiver.js +8 -12
  47. package/transpiled/Receiver.js.map +1 -1
  48. package/transpiled/Routes.d.ts +2 -3
  49. package/transpiled/Routes.js +9 -13
  50. package/transpiled/Routes.js.map +1 -1
  51. package/transpiled/extension.d.ts +1 -1
  52. package/transpiled/extension.js +8 -13
  53. package/transpiled/extension.js.map +1 -1
  54. package/transpiled/index.d.ts +2 -2
  55. package/transpiled/index.js +2 -20
  56. package/transpiled/index.js.map +1 -1
  57. package/tsconfig.json +2 -1
  58. package/tsconfig.tsbuildinfo +1 -0
  59. package/components/realtime.streams/operations/tsconfig.tsbuildinfo +0 -1
  60. package/cucumber.js +0 -8
  61. package/transpiled/tsconfig.tsbuildinfo +0 -1
@@ -1,7 +1,7 @@
1
1
  import { readdirSync, type Dirent } from 'node:fs'
2
2
  import { resolve } from 'node:path'
3
3
  import { Connector } from '@toa.io/core'
4
- import { type Bootloader } from './Factory'
4
+ import { type Bootloader } from './Factory.js'
5
5
 
6
6
  export class Composition extends Connector {
7
7
  private readonly boot: Bootloader
@@ -48,4 +48,4 @@ interface Components {
48
48
  paths: string[]
49
49
  }
50
50
 
51
- const ROOT = resolve(__dirname, '../components/')
51
+ const ROOT = resolve(import.meta.dirname, '../components/')
package/source/Factory.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type Component, type extensions, Locator } from '@toa.io/core'
2
- import { Realtime } from './Realtime'
3
- import { Composition } from './Composition'
4
- import { Routes } from './Routes'
2
+ import { Realtime } from './Realtime.js'
3
+ import { Composition } from './Composition.js'
4
+ import { Routes } from './Routes.js'
5
5
 
6
6
  export class Factory implements extensions.Factory {
7
7
  private readonly boot: Bootloader
@@ -1,7 +1,7 @@
1
1
  import { console, run } from 'openspan'
2
2
  import { type Component, Connector } from '@toa.io/core'
3
- import { type Routes } from './Routes'
4
- import type { Push } from './Receiver'
3
+ import { type Routes } from './Routes.js'
4
+ import type { Push } from './Receiver.js'
5
5
 
6
6
  export class Realtime extends Connector {
7
7
  private readonly discovery: () => Promise<Component>
package/source/Routes.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Readable } from 'node:stream'
2
2
  import { console } from 'openspan'
3
3
  import { Connector } from '@toa.io/core'
4
- import { Receiver } from './Receiver'
5
- import type { Route } from './extension'
6
- import type { Bootloader } from './Factory'
4
+ import { Receiver } from './Receiver.js'
5
+ import type { Route } from './extension.js'
6
+ import type { Bootloader } from './Factory.js'
7
7
 
8
8
  export class Routes extends Connector {
9
9
  public events = new Events()
@@ -1,8 +1,9 @@
1
- import { components } from './Composition'
1
+ import { readFileSync } from 'node:fs'
2
+ import { components } from './Composition.js'
2
3
  import type { Dependency, Instances, Resources, Service } from '@toa.io/operations'
3
4
 
4
5
  export const standalone = true
5
- export { components } from './Composition'
6
+ export { components } from './Composition.js'
6
7
 
7
8
  export function deployment (instances: Instances<Declaration>, annotation?: Declaration & Annotation): Dependency {
8
9
  const routes = []
@@ -28,7 +29,7 @@ export function deployment (instances: Instances<Declaration>, annotation?: Decl
28
29
  group: 'realtime',
29
30
  name: 'streams',
30
31
 
31
- version: require('../package.json').version,
32
+ version: JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version,
32
33
  components: labels,
33
34
  resources,
34
35
  variables: [{
package/source/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { Factory } from './Factory'
2
- export * from './extension'
1
+ export { Factory } from './Factory.js'
2
+ export * from './extension.js'
@@ -1,5 +1,5 @@
1
1
  import { Connector } from '@toa.io/core';
2
- import { type Bootloader } from './Factory';
2
+ import { type Bootloader } from './Factory.js';
3
3
  export declare class Composition extends Connector {
4
4
  private readonly boot;
5
5
  constructor(boot: Bootloader);
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.components = exports.find = 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 {
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 {
8
5
  boot;
9
6
  constructor(boot) {
10
7
  super();
@@ -17,24 +14,21 @@ class Composition extends core_1.Connector {
17
14
  this.depends(composition);
18
15
  }
19
16
  }
20
- exports.Composition = Composition;
21
- function find() {
22
- 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));
23
19
  }
24
- exports.find = find;
25
20
  function entries() {
26
- const entries = (0, node_fs_1.readdirSync)(ROOT, { withFileTypes: true });
21
+ const entries = readdirSync(ROOT, { withFileTypes: true });
27
22
  return entries.filter((entry) => entry.isDirectory());
28
23
  }
29
- function components() {
24
+ export function components() {
30
25
  const labels = [];
31
26
  const paths = [];
32
27
  for (const entry of entries()) {
33
28
  labels.push(entry.name.replace('.', '-'));
34
- paths.push((0, node_path_1.resolve)(ROOT, entry.name));
29
+ paths.push(resolve(ROOT, entry.name));
35
30
  }
36
31
  return { labels, paths };
37
32
  }
38
- exports.components = components;
39
- const ROOT = (0, node_path_1.resolve)(__dirname, '../components/');
33
+ const ROOT = resolve(import.meta.dirname, '../components/');
40
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;IACv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AAO,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,5 +1,5 @@
1
1
  import { type extensions } from '@toa.io/core';
2
- import { Realtime } from './Realtime';
2
+ import { Realtime } from './Realtime.js';
3
3
  export declare class Factory implements extensions.Factory {
4
4
  private readonly boot;
5
5
  constructor(boot: Bootloader);
@@ -1,27 +1,23 @@
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 {
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 {
9
6
  boot;
10
7
  constructor(boot) {
11
8
  this.boot = boot;
12
9
  }
13
10
  service() {
14
- const routes = new Routes_1.Routes(this.boot);
15
- const composition = new Composition_1.Composition(this.boot);
16
- const realtime = new Realtime_1.Realtime(routes, async () => await this.discovery());
11
+ const routes = new Routes(this.boot);
12
+ const composition = new Composition(this.boot);
13
+ const realtime = new Realtime(routes, async () => await this.discovery());
17
14
  realtime.depends(routes);
18
15
  realtime.depends(composition);
19
16
  return realtime;
20
17
  }
21
18
  async discovery() {
22
- const locator = new core_1.Locator('streams', 'realtime');
19
+ const locator = new Locator('streams', 'realtime');
23
20
  return await this.boot.remote(locator, { service: 'realtime' });
24
21
  }
25
22
  }
26
- exports.Factory = Factory;
27
23
  //# 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,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpC,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9C,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAEzE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACxB,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAE7B,OAAO,QAAQ,CAAA;IACjB,CAAC;IAEO,KAAK,CAAC,SAAS;QACrB,MAAM,OAAO,GAAG,IAAI,cAAO,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;AAvBD,0BAuBC"}
1
+ {"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,OAAO,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,OAAO,OAAO;IACD,IAAI,CAAY;IAEjC,YAAoB,IAAgB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEM,OAAO;QACZ,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9C,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAEzE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACxB,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAE7B,OAAO,QAAQ,CAAA;IACjB,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,5 +1,5 @@
1
1
  import { type Component, Connector } from '@toa.io/core';
2
- import { type Routes } from './Routes';
2
+ import { type Routes } from './Routes.js';
3
3
  export declare class Realtime extends Connector {
4
4
  private readonly discovery;
5
5
  private streams;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Realtime = void 0;
4
- const openspan_1 = require("openspan");
5
- const core_1 = require("@toa.io/core");
6
- class Realtime extends core_1.Connector {
1
+ import { console, run } from 'openspan';
2
+ import { Connector } from '@toa.io/core';
3
+ export class Realtime extends Connector {
7
4
  discovery;
8
5
  streams = null;
9
6
  constructor(routes, discovery) {
@@ -18,16 +15,16 @@ class Realtime extends core_1.Connector {
18
15
  this.streams = await this.discovery();
19
16
  this.depends(this.streams);
20
17
  await this.streams.connect();
21
- openspan_1.console.info('Realtime service started');
18
+ console.info('Realtime service started');
22
19
  }
23
20
  dispose() {
24
- openspan_1.console.info('Realtime service shutdown complete');
21
+ console.info('Realtime service shutdown complete');
25
22
  }
26
23
  push({ telemetry, ...event }) {
27
24
  const processing = telemetry === null
28
25
  ? this.deliver(event)
29
- : (0, openspan_1.run)(telemetry, async () => await this.deliver(event));
30
- void processing.catch((error) => openspan_1.console.error('Realtime push failed', error));
26
+ : run(telemetry, async () => await this.deliver(event));
27
+ void processing.catch((error) => console.error('Realtime push failed', error));
31
28
  }
32
29
  async deliver(event) {
33
30
  /*
@@ -47,10 +44,9 @@ class Realtime extends core_1.Connector {
47
44
  service: 'realtime',
48
45
  attributes: { 'messaging.destination.name': event.event }
49
46
  };
50
- await openspan_1.console.span(delivery, async () => await openspan_1.console.span(options, async () => {
47
+ await console.span(delivery, async () => await console.span(options, async () => {
51
48
  await this.streams?.invoke('push', { input: event });
52
49
  }));
53
50
  }
54
51
  }
55
- exports.Realtime = Realtime;
56
52
  //# sourceMappingURL=Realtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Realtime.js","sourceRoot":"","sources":["../source/Realtime.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,uCAAwD;AAIxD,MAAa,QAAS,SAAQ,gBAAS;IACpB,SAAS,CAA0B;IAC5C,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,MAAc,EAAE,SAAmC;QACrE,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,+EAA+E;QAC/E,kFAAkF;QAClF,wEAAwE;QACxE,IAAI,CAAC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AAK,IAAI;YACnC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACrB,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;QAEzD,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC,CAAA;IAChF,CAAC;IAEO,KAAK,CAAC,OAAO,CAAE,KAA8B;QACnD;;;;WAIG;QACH,MAAM,QAAQ,GAAG;YACf,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,UAAU;YAC9B,IAAI,EAAE,UAAmB;YACzB,OAAO,EAAE,KAAK,CAAC,KAAK;YACpB,UAAU,EAAE,EAAE,4BAA4B,EAAE,KAAK,CAAC,KAAK,EAAE;SAC1D,CAAA;QAED,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,OAAO;YAC3B,IAAI,EAAE,UAAmB;YACzB,OAAO,EAAE,UAAU;YACnB,UAAU,EAAE,EAAE,4BAA4B,EAAE,KAAK,CAAC,KAAK,EAAE;SAC1D,CAAA;QAED,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;YAC9E,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;QACtD,CAAC,CAAC,CAAC,CAAA;IACL,CAAC;CACF"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Connector, type Message } from '@toa.io/core';
3
2
  import type { SpanContext } from 'openspan';
4
3
  import type { Readable } from 'node:stream';
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Receiver = void 0;
4
- const openspan_1 = require("openspan");
5
- const core_1 = require("@toa.io/core");
6
- class Receiver extends core_1.Connector {
1
+ import { console, decode, run } from 'openspan';
2
+ import { Connector } from '@toa.io/core';
3
+ export class Receiver extends Connector {
7
4
  event;
8
5
  properties;
9
6
  expose;
@@ -17,18 +14,18 @@ class Receiver extends core_1.Connector {
17
14
  }
18
15
  receive(message) {
19
16
  // the push continues the trace from the producer
20
- const telemetry = message.telemetry === undefined ? null : (0, openspan_1.decode)(message.telemetry);
17
+ const telemetry = message.telemetry === undefined ? null : decode(message.telemetry);
21
18
  if (telemetry === null)
22
19
  this.process(message, telemetry);
23
20
  else
24
- (0, openspan_1.run)(telemetry, () => this.process(message, telemetry));
21
+ run(telemetry, () => this.process(message, telemetry));
25
22
  }
26
23
  process(message, telemetry) {
27
24
  const data = this.fit(message.payload);
28
25
  for (const property of this.properties) {
29
26
  const key = message.payload[property];
30
27
  if (key === undefined) {
31
- openspan_1.console.debug('Event does not contain key property', { property, event: this.event });
28
+ console.debug('Event does not contain key property', { property, event: this.event });
32
29
  continue;
33
30
  }
34
31
  if (Array.isArray(key))
@@ -48,12 +45,11 @@ class Receiver extends core_1.Connector {
48
45
  }
49
46
  push(key, data, telemetry) {
50
47
  if (key === null || typeof key === 'undefined') {
51
- openspan_1.console.debug('Key is null or undefined, skipping', { key, event: this.event });
48
+ console.debug('Key is null or undefined, skipping', { key, event: this.event });
52
49
  return;
53
50
  }
54
- openspan_1.console.debug('Pushing event to stream', { key, event: this.event, data });
51
+ console.debug('Pushing event to stream', { key, event: this.event, data });
55
52
  this.stream.push({ key, event: this.event, data, telemetry });
56
53
  }
57
54
  }
58
- exports.Receiver = Receiver;
59
55
  //# sourceMappingURL=Receiver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Receiver.js","sourceRoot":"","sources":["../source/Receiver.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAC/C,uCAAsD;AAItD,MAAa,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-1,8 +1,7 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'node:stream';
3
2
  import { Connector } from '@toa.io/core';
4
- import type { Route } from './extension';
5
- import type { Bootloader } from './Factory';
3
+ import type { Route } from './extension.js';
4
+ import type { Bootloader } from './Factory.js';
6
5
  export declare class Routes extends Connector {
7
6
  events: Events;
8
7
  private readonly boot;
@@ -1,11 +1,8 @@
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 openspan_1 = require("openspan");
6
- const core_1 = require("@toa.io/core");
7
- const Receiver_1 = require("./Receiver");
8
- 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
+ export class Routes extends Connector {
9
6
  events = new Events();
10
7
  boot;
11
8
  constructor(boot) {
@@ -21,7 +18,7 @@ class Routes extends core_1.Connector {
21
18
  const routes = Routes.read();
22
19
  const creating = [];
23
20
  for (const { event, properties, expose } of routes) {
24
- const consumer = this.boot.receive(event, new Receiver_1.Receiver({ event, properties, stream: this.events, expose }));
21
+ const consumer = this.boot.receive(event, new Receiver({ event, properties, stream: this.events, expose }));
25
22
  creating.push(consumer);
26
23
  }
27
24
  const consumers = await Promise.all(creating);
@@ -29,14 +26,13 @@ class Routes extends core_1.Connector {
29
26
  const connecting = consumers.map((consumer) => consumer.connect());
30
27
  await Promise.all(connecting);
31
28
  this.depends(consumers);
32
- openspan_1.console.info('Event sources connected', { count: creating.length });
29
+ console.info('Event sources connected', { count: creating.length });
33
30
  }
34
31
  async close() {
35
- openspan_1.console.info('Event sources disconnected');
32
+ console.info('Event sources disconnected');
36
33
  }
37
34
  }
38
- exports.Routes = Routes;
39
- class Events extends node_stream_1.Readable {
35
+ class Events extends Readable {
40
36
  constructor() {
41
37
  super({ objectMode: true });
42
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Routes.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AM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;YAE3G,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACzB,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAE7C,qEAAqE;QACrE,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;QAElE,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAEvB,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IACrE,CAAC;IAEe,KAAK,CAAC,KAAK;QACzB,OAAO,CAAC,IAAI,CAAC,4BAA4B,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;IACrB,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
1
  import type { Dependency, Instances, Resources } from '@toa.io/operations';
2
2
  export declare const standalone = true;
3
- export { components } from './Composition';
3
+ export { components } from './Composition.js';
4
4
  export declare function deployment(instances: Instances<Declaration>, annotation?: Declaration & Annotation): Dependency;
5
5
  export declare function parse(declaration: Declaration): Route[];
6
6
  export type Entry = string | string[] | RouteDeclaration;
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parse = exports.deployment = exports.components = exports.standalone = void 0;
4
- const Composition_1 = require("./Composition");
5
- exports.standalone = true;
6
- var Composition_2 = require("./Composition");
7
- Object.defineProperty(exports, "components", { enumerable: true, get: function () { return Composition_2.components; } });
8
- function deployment(instances, annotation) {
1
+ import { readFileSync } from 'node:fs';
2
+ import { components } from './Composition.js';
3
+ export const standalone = true;
4
+ export { components } from './Composition.js';
5
+ export function deployment(instances, annotation) {
9
6
  const routes = [];
10
7
  const { resources, ...annotatedRoutes } = annotation ?? {};
11
- const labels = (0, Composition_1.components)().labels;
8
+ const labels = components().labels;
12
9
  if (annotatedRoutes !== undefined)
13
10
  routes.push(...parse(annotatedRoutes));
14
11
  for (const instance of instances) {
@@ -22,7 +19,7 @@ function deployment(instances, annotation) {
22
19
  const service = {
23
20
  group: 'realtime',
24
21
  name: 'streams',
25
- version: require('../package.json').version,
22
+ version: JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version,
26
23
  components: labels,
27
24
  resources,
28
25
  variables: [{
@@ -32,8 +29,7 @@ function deployment(instances, annotation) {
32
29
  };
33
30
  return { services: [service], events: routes.map((route) => route.event) };
34
31
  }
35
- exports.deployment = deployment;
36
- function parse(declaration) {
32
+ export function parse(declaration) {
37
33
  const routes = [];
38
34
  for (const [event, value] of Object.entries(declaration))
39
35
  if (isObject(value)) {
@@ -46,7 +42,6 @@ function parse(declaration) {
46
42
  }
47
43
  return routes;
48
44
  }
49
- exports.parse = parse;
50
45
  function isObject(value) {
51
46
  return typeof value === 'object' && !Array.isArray(value);
52
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"","sources":["../source/extension.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAG7B,QAAA,UAAU,GAAG,IAAI,CAAA;AAC9B,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AAEnB,SAAgB,UAAU,CAAE,SAAiC,EAAE,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UAAU,KAAK,CAAE,WAAwB;IAC7C,MAAM,MAAM,GAAY,EAAE,CAAA;IAE1B,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;QACtD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACpB,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAErE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;QAC1D,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;YAEzD,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;QACpC,CAAC;IAEH,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,QAAQ,CAAE,KAAY;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC3D,CAAC"}
@@ -1,2 +1,2 @@
1
- export { Factory } from './Factory';
2
- export * from './extension';
1
+ export { Factory } from './Factory.js';
2
+ export * from './extension.js';
@@ -1,21 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Factory = void 0;
18
- var Factory_1 = require("./Factory");
19
- Object.defineProperty(exports, "Factory", { enumerable: true, get: function () { return Factory_1.Factory; } });
20
- __exportStar(require("./extension"), exports);
1
+ export { Factory } from './Factory.js';
2
+ export * from './extension.js';
21
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;AAChB,8CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,cAAc,gBAAgB,CAAA"}
package/tsconfig.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
- "outDir": "./transpiled"
4
+ "outDir": "./transpiled",
5
+ "rootDir": "./source"
5
6
  },
6
7
  "include": [
7
8
  "source"