@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.
Files changed (33) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/components/realtime.streams/manifest.toa.yaml +17 -5
  3. package/components/realtime.streams/operations/create.js +4 -1
  4. package/components/realtime.streams/operations/create.js.map +1 -1
  5. package/components/realtime.streams/operations/lib/Stash.js +16 -2
  6. package/components/realtime.streams/operations/lib/Stash.js.map +1 -1
  7. package/components/realtime.streams/operations/lib/Stream.d.ts +3 -0
  8. package/components/realtime.streams/operations/lib/Stream.js +12 -0
  9. package/components/realtime.streams/operations/lib/Stream.js.map +1 -1
  10. package/components/realtime.streams/operations/tsconfig.tsbuildinfo +1 -1
  11. package/components/realtime.streams/source/create.ts +4 -1
  12. package/components/realtime.streams/source/lib/Stash.ts +23 -2
  13. package/components/realtime.streams/source/lib/Stream.ts +15 -0
  14. package/features/steps/Components.ts +3 -3
  15. package/features/steps/Realtime.ts +1 -2
  16. package/features/steps/Streams.ts +2 -2
  17. package/features/steps/components/messages/manifest.toa.yaml +37 -8
  18. package/features/steps/config.ts +4 -0
  19. package/package.json +3 -3
  20. package/source/Factory.ts +1 -2
  21. package/source/Realtime.ts +6 -3
  22. package/source/Routes.ts +1 -2
  23. package/source/extension.ts +1 -2
  24. package/transpiled/Factory.js +1 -2
  25. package/transpiled/Factory.js.map +1 -1
  26. package/transpiled/Realtime.d.ts +1 -1
  27. package/transpiled/Realtime.js +4 -1
  28. package/transpiled/Realtime.js.map +1 -1
  29. package/transpiled/Routes.js +1 -2
  30. package/transpiled/Routes.js.map +1 -1
  31. package/transpiled/extension.js +1 -2
  32. package/transpiled/extension.js.map +1 -1
  33. 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.destroy()
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
- if (results.length === 0)
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 '@toa.io/yaml'
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<Declaration>(yaml)
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<Request>(yaml)
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 = encode(this.routes)
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 '@toa.io/yaml'
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<object>(yaml)
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
- sender*: string(32)
6
- recipient*: string(32)
7
- text*: string
8
- watchers: [string(32)]
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
- sender*: .
16
- recipient*: .
17
- text*: .
18
- watchers: .
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
@@ -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.272",
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.272",
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": "1a451755445935c04cf5b373bcc73942cac0bb10"
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)
@@ -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
- this.streams = await this.discovery
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 decode<Route[]>(process.env.TOA_REALTIME)
23
+ return JSON.parse(process.env.TOA_REALTIME) as Route[]
25
24
  }
26
25
 
27
26
  public override async open (): Promise<void> {
@@ -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: encode(routes)
36
+ value: JSON.stringify(routes)
38
37
  }]
39
38
  }
40
39
 
@@ -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;IA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AAA;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"}
@@ -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;
@@ -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
- this.streams = await this.discovery;
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,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,IA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;YACnC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACrB,CAAC,CAAC,IAAA,cAAG,EAAC,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,kBAAO,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,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"}
@@ -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 (0, generic_1.decode)(process.env.TOA_REALTIME);
18
+ return JSON.parse(process.env.TOA_REALTIME);
20
19
  }
21
20
  async open() {
22
21
  const routes = Routes.read();
@@ -1 +1 @@
1
- {"version":3,"file":"Routes.js","sourceRoot":"","sources":["../source/Routes.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AACtC,uCAAkC;AAClC,uCAAwC;AACxC,6CAAwC;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,IAAA,gBAAM,EAAU,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IAClD,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,CAA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ports, "__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: (0, generic_1.encode)(routes)
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,6CAAwC;AACxC,+CAA0C;AAG7B,QAAA,UAAU,GAAG,IAAI,CAAA;AAC9B,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AAEnB,SAAgB,UAAU,CAAE,SAAiC,EAAE,UAAqC;IAClG,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,GAAG,UAAU,IAAI,EAAE,CAAA;IAC1D,MAAM,MAAM,GAAG,IAAA,wBAAU,GAAE,CAAC,MAAM,CAAA;IAElC,IAAI,eAAe,KAAK,SAAS;QAC/B,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;IAExC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,SAAS,GAAgB,EAAE,CAAA;QAEjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,CAAA;YAE7C,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,CAAA;QAC1B,CAAC;QAED,MAAM,CAAC,IAAI,CAA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