@toa.io/extensions.realtime 1.0.0-alpha.272 → 1.0.0-alpha.274
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 +209 -0
- package/components/realtime.streams/manifest.toa.yaml +17 -5
- package/components/realtime.streams/operations/create.js +4 -1
- package/components/realtime.streams/operations/create.js.map +1 -1
- package/components/realtime.streams/operations/lib/Stash.js +16 -2
- package/components/realtime.streams/operations/lib/Stash.js.map +1 -1
- package/components/realtime.streams/operations/lib/Stream.d.ts +3 -0
- package/components/realtime.streams/operations/lib/Stream.js +12 -0
- package/components/realtime.streams/operations/lib/Stream.js.map +1 -1
- package/components/realtime.streams/operations/tsconfig.tsbuildinfo +1 -1
- package/components/realtime.streams/source/create.ts +4 -1
- package/components/realtime.streams/source/lib/Stash.ts +23 -2
- package/components/realtime.streams/source/lib/Stream.ts +15 -0
- package/features/steps/Components.ts +3 -3
- package/features/steps/Realtime.ts +1 -2
- package/features/steps/Streams.ts +2 -2
- package/features/steps/components/messages/manifest.toa.yaml +37 -8
- package/features/steps/config.ts +4 -0
- package/package.json +3 -3
- package/source/Factory.ts +1 -2
- package/source/Realtime.ts +6 -3
- package/source/Routes.ts +1 -2
- package/source/extension.ts +1 -2
- package/transpiled/Factory.js +1 -2
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Realtime.d.ts +1 -1
- package/transpiled/Realtime.js +4 -1
- package/transpiled/Realtime.js.map +1 -1
- package/transpiled/Routes.js +1 -2
- package/transpiled/Routes.js.map +1 -1
- package/transpiled/extension.js +1 -2
- package/transpiled/extension.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
|
@@ -19,8 +19,11 @@ export class Effect implements Operation {
|
|
|
19
19
|
public unmount (): void {
|
|
20
20
|
this.logs.info('Destroying streams', { count: this.streams.size })
|
|
21
21
|
|
|
22
|
+
// closed, not destroyed: destroying a stream that is still piped to a response
|
|
23
|
+
// makes end-of-stream report a premature close, which reaches no one and takes
|
|
24
|
+
// the process down.
|
|
22
25
|
for (const stream of this.streams.values())
|
|
23
|
-
stream.
|
|
26
|
+
stream.close()
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
public async execute (input: Input): Promise<Readable> {
|
|
@@ -32,10 +32,11 @@ export class Stash {
|
|
|
32
32
|
if (results instanceof Error)
|
|
33
33
|
return results
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const items = entries(results)
|
|
36
|
+
|
|
37
|
+
if (items === null)
|
|
36
38
|
return null
|
|
37
39
|
|
|
38
|
-
const [, items] = results[0]
|
|
39
40
|
const events: Event[] = []
|
|
40
41
|
|
|
41
42
|
let lastStamp: string | null = null
|
|
@@ -95,6 +96,26 @@ export class Stash {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
/**
|
|
100
|
+
* `xread` answers with an array of `[stream, entries]` pairs over RESP2 and with an
|
|
101
|
+
* object keyed by stream name over RESP3. One stream is read, so either way it is the
|
|
102
|
+
* first, and an empty answer means nothing has been added since the token.
|
|
103
|
+
*/
|
|
104
|
+
function entries (results: unknown): Entry[] | null {
|
|
105
|
+
if (Array.isArray(results))
|
|
106
|
+
return results.length === 0 ? null : (results[0] as [string, Entry[]])[1]
|
|
107
|
+
|
|
108
|
+
if (typeof results === 'object' && results !== null) {
|
|
109
|
+
const streams = Object.values(results as Record<string, Entry[]>)
|
|
110
|
+
|
|
111
|
+
return streams.length === 0 ? null : streams[0]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return null
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type Entry = [stamp: string, fields: string[]]
|
|
118
|
+
|
|
98
119
|
interface Configuration {
|
|
99
120
|
maxlen: number
|
|
100
121
|
expire: number
|
|
@@ -4,6 +4,7 @@ export class Stream extends Readable {
|
|
|
4
4
|
public events = new EventEmitter()
|
|
5
5
|
|
|
6
6
|
private interval: NodeJS.Timeout | null = null
|
|
7
|
+
private ended = false
|
|
7
8
|
|
|
8
9
|
public constructor () {
|
|
9
10
|
super(objectMode)
|
|
@@ -24,7 +25,21 @@ export class Stream extends Readable {
|
|
|
24
25
|
super._destroy(error, callback)
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
/** Ends the stream: whoever reads it gets EOF rather than a broken pipe. */
|
|
29
|
+
public close (): void {
|
|
30
|
+
this.ended = true
|
|
31
|
+
|
|
32
|
+
if (this.interval !== null) {
|
|
33
|
+
clearInterval(this.interval)
|
|
34
|
+
this.interval = null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.push(null)
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
public heartbeat (stream: Readable = this): boolean {
|
|
41
|
+
if (this.ended) return false
|
|
42
|
+
|
|
28
43
|
const resume = stream.push('heartbeat ' + Date.now())
|
|
29
44
|
|
|
30
45
|
if (!resume && this.interval !== null) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'node:path'
|
|
2
2
|
import { readdirSync } from 'node:fs'
|
|
3
3
|
import { after, before, binding, given, when } from 'cucumber-tsflow'
|
|
4
|
-
import { parse } from '
|
|
4
|
+
import { load as parse } from 'js-yaml'
|
|
5
5
|
import * as stage from '@toa.io/userland/stage'
|
|
6
6
|
import { type Component, type Request } from '@toa.io/core'
|
|
7
7
|
import { timeout } from '@toa.io/generic'
|
|
@@ -19,7 +19,7 @@ export class Components {
|
|
|
19
19
|
|
|
20
20
|
@given('the `{word}` component is running with routes:')
|
|
21
21
|
public async run (component: string, yaml: string): Promise<void> {
|
|
22
|
-
const declaration = parse
|
|
22
|
+
const declaration = parse(yaml) as Declaration
|
|
23
23
|
const [name, namespace = 'default'] = component.split('.').reverse()
|
|
24
24
|
const routes = parseRoutes(declaration)
|
|
25
25
|
|
|
@@ -32,7 +32,7 @@ export class Components {
|
|
|
32
32
|
|
|
33
33
|
@when('the `{word}` is called with:')
|
|
34
34
|
public async call (endpoint: string, yaml: string): Promise<void> {
|
|
35
|
-
const request = parse
|
|
35
|
+
const request = parse(yaml) as Request
|
|
36
36
|
const [operation, component, namespace = 'default'] = endpoint.split('.').reverse()
|
|
37
37
|
const id = `${namespace}.${component}`
|
|
38
38
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as boot from '@toa.io/boot'
|
|
2
|
-
import { encode } from '@toa.io/generic'
|
|
3
2
|
import { type Connector } from '@toa.io/core'
|
|
4
3
|
import { after, binding } from 'cucumber-tsflow'
|
|
5
4
|
import { Factory } from '../../source'
|
|
@@ -30,7 +29,7 @@ export class Realtime {
|
|
|
30
29
|
if (this.connected)
|
|
31
30
|
return
|
|
32
31
|
|
|
33
|
-
process.env.TOA_REALTIME =
|
|
32
|
+
process.env.TOA_REALTIME = JSON.stringify(this.routes)
|
|
34
33
|
|
|
35
34
|
this.connected = true
|
|
36
35
|
|
|
@@ -2,7 +2,7 @@ import * as assert from 'node:assert'
|
|
|
2
2
|
import { setTimeout } from 'node:timers/promises'
|
|
3
3
|
import { after, binding, given, then } from 'cucumber-tsflow'
|
|
4
4
|
import { match } from '@toa.io/generic'
|
|
5
|
-
import { parse } from '
|
|
5
|
+
import { load as parse } from 'js-yaml'
|
|
6
6
|
import * as stage from '@toa.io/userland/stage'
|
|
7
7
|
import { Realtime } from './Realtime'
|
|
8
8
|
import type { Readable } from 'node:stream'
|
|
@@ -33,7 +33,7 @@ export class Streams {
|
|
|
33
33
|
public async received (key: string, yaml: string): Promise<void> {
|
|
34
34
|
await setTimeout(100)
|
|
35
35
|
|
|
36
|
-
const expected = parse
|
|
36
|
+
const expected = parse(yaml) as object
|
|
37
37
|
|
|
38
38
|
for (const event of this.events[key])
|
|
39
39
|
if (match(event, expected))
|
|
@@ -2,17 +2,46 @@ name: messages
|
|
|
2
2
|
|
|
3
3
|
entity:
|
|
4
4
|
schema:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
properties:
|
|
6
|
+
watchers:
|
|
7
|
+
type: array
|
|
8
|
+
items:
|
|
9
|
+
type: string
|
|
10
|
+
maxLength: 32
|
|
11
|
+
sender:
|
|
12
|
+
type: string
|
|
13
|
+
maxLength: 32
|
|
14
|
+
recipient:
|
|
15
|
+
type: string
|
|
16
|
+
maxLength: 32
|
|
17
|
+
text:
|
|
18
|
+
type: string
|
|
19
|
+
type: object
|
|
20
|
+
required:
|
|
21
|
+
- sender
|
|
22
|
+
- recipient
|
|
23
|
+
- text
|
|
9
24
|
|
|
10
25
|
operations:
|
|
11
26
|
create:
|
|
12
27
|
query: false
|
|
13
28
|
forward: transit
|
|
14
29
|
input:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
properties:
|
|
31
|
+
watchers:
|
|
32
|
+
type: string
|
|
33
|
+
default: .
|
|
34
|
+
sender:
|
|
35
|
+
type: string
|
|
36
|
+
default: .
|
|
37
|
+
recipient:
|
|
38
|
+
type: string
|
|
39
|
+
default: .
|
|
40
|
+
text:
|
|
41
|
+
type: string
|
|
42
|
+
default: .
|
|
43
|
+
type: object
|
|
44
|
+
required:
|
|
45
|
+
- sender
|
|
46
|
+
- recipient
|
|
47
|
+
- text
|
package/features/steps/config.ts
CHANGED
|
@@ -2,4 +2,8 @@ import { setDefaultTimeout } from '@cucumber/cucumber'
|
|
|
2
2
|
|
|
3
3
|
process.env.TOA_DEV = '1'
|
|
4
4
|
|
|
5
|
+
// the streams component boots inside the service, and without a variable it would wait
|
|
6
|
+
// for the values service, which these features do not run
|
|
7
|
+
process.env.TOA_CONFIGURATION_REALTIME_STREAMS ??= '{}'
|
|
8
|
+
|
|
5
9
|
setDefaultTimeout(60 * 1000)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.realtime",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.274",
|
|
4
4
|
"description": "Toa Realtime",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
20
|
+
"@toa.io/core": "1.0.0-alpha.273",
|
|
21
21
|
"openspan": "1.0.0-alpha.272"
|
|
22
22
|
},
|
|
23
23
|
"jest": {
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"transpile": "npx tsc && npx tsc -p ./components/realtime.streams",
|
|
29
29
|
"features": "npx cucumber-js"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "7df32eb2872155c45681c299036b1efbeefd6518"
|
|
32
32
|
}
|
package/source/Factory.ts
CHANGED
|
@@ -11,10 +11,9 @@ export class Factory implements extensions.Factory {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
public service (): Realtime {
|
|
14
|
-
const discovery = this.discovery()
|
|
15
14
|
const routes = new Routes(this.boot)
|
|
16
15
|
const composition = new Composition(this.boot)
|
|
17
|
-
const realtime = new Realtime(routes, discovery)
|
|
16
|
+
const realtime = new Realtime(routes, async () => await this.discovery())
|
|
18
17
|
|
|
19
18
|
realtime.depends(routes)
|
|
20
19
|
realtime.depends(composition)
|
package/source/Realtime.ts
CHANGED
|
@@ -4,10 +4,10 @@ import { type Routes } from './Routes'
|
|
|
4
4
|
import type { Push } from './Receiver'
|
|
5
5
|
|
|
6
6
|
export class Realtime extends Connector {
|
|
7
|
-
private readonly discovery: Promise<Component>
|
|
7
|
+
private readonly discovery: () => Promise<Component>
|
|
8
8
|
private streams: Component | null = null
|
|
9
9
|
|
|
10
|
-
public constructor (routes: Routes, discovery: Promise<Component>) {
|
|
10
|
+
public constructor (routes: Routes, discovery: () => Promise<Component>) {
|
|
11
11
|
super()
|
|
12
12
|
|
|
13
13
|
this.discovery = discovery
|
|
@@ -16,7 +16,10 @@ export class Realtime extends Connector {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
protected override async open (): Promise<void> {
|
|
19
|
-
|
|
19
|
+
// the lookup belongs here, not in the constructor: dependencies connect before
|
|
20
|
+
// open, so the composition that serves realtime.streams is up to answer it. Asked
|
|
21
|
+
// any earlier the lookup goes unanswered, and it waits without a bound.
|
|
22
|
+
this.streams = await this.discovery()
|
|
20
23
|
this.depends(this.streams)
|
|
21
24
|
|
|
22
25
|
await this.streams.connect()
|
package/source/Routes.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'node:stream'
|
|
2
2
|
import { console } from 'openspan'
|
|
3
3
|
import { Connector } from '@toa.io/core'
|
|
4
|
-
import { decode } from '@toa.io/generic'
|
|
5
4
|
import { Receiver } from './Receiver'
|
|
6
5
|
import type { Route } from './extension'
|
|
7
6
|
import type { Bootloader } from './Factory'
|
|
@@ -21,7 +20,7 @@ export class Routes extends Connector {
|
|
|
21
20
|
if (process.env.TOA_REALTIME === undefined)
|
|
22
21
|
throw new Error('TOA_REALTIME is not defined')
|
|
23
22
|
|
|
24
|
-
return
|
|
23
|
+
return JSON.parse(process.env.TOA_REALTIME) as Route[]
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
public override async open (): Promise<void> {
|
package/source/extension.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { encode } from '@toa.io/generic'
|
|
2
1
|
import { components } from './Composition'
|
|
3
2
|
import type { Dependency, Instances, Resources, Service } from '@toa.io/operations'
|
|
4
3
|
|
|
@@ -34,7 +33,7 @@ export function deployment (instances: Instances<Declaration>, annotation?: Decl
|
|
|
34
33
|
resources,
|
|
35
34
|
variables: [{
|
|
36
35
|
name: 'TOA_REALTIME',
|
|
37
|
-
value:
|
|
36
|
+
value: JSON.stringify(routes)
|
|
38
37
|
}]
|
|
39
38
|
}
|
|
40
39
|
|
package/transpiled/Factory.js
CHANGED
|
@@ -11,10 +11,9 @@ class Factory {
|
|
|
11
11
|
this.boot = boot;
|
|
12
12
|
}
|
|
13
13
|
service() {
|
|
14
|
-
const discovery = this.discovery();
|
|
15
14
|
const routes = new Routes_1.Routes(this.boot);
|
|
16
15
|
const composition = new Composition_1.Composition(this.boot);
|
|
17
|
-
const realtime = new Realtime_1.Realtime(routes, discovery);
|
|
16
|
+
const realtime = new Realtime_1.Realtime(routes, async () => await this.discovery());
|
|
18
17
|
realtime.depends(routes);
|
|
19
18
|
realtime.depends(composition);
|
|
20
19
|
return realtime;
|
|
@@ -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,
|
|
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"}
|
package/transpiled/Realtime.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Routes } from './Routes';
|
|
|
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;
|
package/transpiled/Realtime.js
CHANGED
|
@@ -12,7 +12,10 @@ class Realtime extends core_1.Connector {
|
|
|
12
12
|
routes.events.on('data', this.push.bind(this));
|
|
13
13
|
}
|
|
14
14
|
async open() {
|
|
15
|
-
|
|
15
|
+
// the lookup belongs here, not in the constructor: dependencies connect before
|
|
16
|
+
// open, so the composition that serves realtime.streams is up to answer it. Asked
|
|
17
|
+
// any earlier the lookup goes unanswered, and it waits without a bound.
|
|
18
|
+
this.streams = await this.discovery();
|
|
16
19
|
this.depends(this.streams);
|
|
17
20
|
await this.streams.connect();
|
|
18
21
|
openspan_1.console.info('Realtime service started');
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"Realtime.js","sourceRoot":"","sources":["../source/Realtime.ts"],"names":[],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AAQ,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,kBAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,kBAAO,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;AA5DD,4BA4DC"}
|
package/transpiled/Routes.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.Routes = void 0;
|
|
|
4
4
|
const node_stream_1 = require("node:stream");
|
|
5
5
|
const openspan_1 = require("openspan");
|
|
6
6
|
const core_1 = require("@toa.io/core");
|
|
7
|
-
const generic_1 = require("@toa.io/generic");
|
|
8
7
|
const Receiver_1 = require("./Receiver");
|
|
9
8
|
class Routes extends core_1.Connector {
|
|
10
9
|
events = new Events();
|
|
@@ -16,7 +15,7 @@ class Routes extends core_1.Connector {
|
|
|
16
15
|
static read() {
|
|
17
16
|
if (process.env.TOA_REALTIME === undefined)
|
|
18
17
|
throw new Error('TOA_REALTIME is not defined');
|
|
19
|
-
return
|
|
18
|
+
return JSON.parse(process.env.TOA_REALTIME);
|
|
20
19
|
}
|
|
21
20
|
async open() {
|
|
22
21
|
const routes = Routes.read();
|
package/transpiled/Routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Routes.js","sourceRoot":"","sources":["../source/Routes.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AACtC,uCAAkC;AAClC,uCAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"Routes.js","sourceRoot":"","sources":["../source/Routes.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AACtC,uCAAkC;AAClC,uCAAwC;AACxC,yCAAqC;AAIrC,MAAa,MAAO,SAAQ,gBAAS;IAC5B,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;IAEX,IAAI,CAAY;IAEjC,YAAoB,IAAgB;QAClC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEO,MAAM,CAAC,IAAI;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,SAAS;YACxC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAEhD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAY,CAAA;IACxD,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;QAC5B,MAAM,QAAQ,GAAG,EAAE,CAAA;QAEnB,KAAK,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,mBAAQ,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,kBAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IACrE,CAAC;IAEe,KAAK,CAAC,KAAK;QACzB,kBAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;IAC5C,CAAC;CACF;AA1CD,wBA0CC;AAED,MAAM,MAAO,SAAQ,sBAAQ;IAC3B;QACE,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAC7B,CAAC;IAEe,KAAK;IACrB,CAAC;CACF"}
|
package/transpiled/extension.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parse = exports.deployment = exports.components = exports.standalone = void 0;
|
|
4
|
-
const generic_1 = require("@toa.io/generic");
|
|
5
4
|
const Composition_1 = require("./Composition");
|
|
6
5
|
exports.standalone = true;
|
|
7
6
|
var Composition_2 = require("./Composition");
|
|
@@ -28,7 +27,7 @@ function deployment(instances, annotation) {
|
|
|
28
27
|
resources,
|
|
29
28
|
variables: [{
|
|
30
29
|
name: 'TOA_REALTIME',
|
|
31
|
-
value:
|
|
30
|
+
value: JSON.stringify(routes)
|
|
32
31
|
}]
|
|
33
32
|
};
|
|
34
33
|
return { services: [service], events: routes.map((route) => route.event) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../source/extension.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3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