@replit/river 0.8.1 → 0.9.1
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/dist/__tests__/e2e.test.js +64 -1
- package/dist/__tests__/fixtures/cleanup.js +1 -1
- package/dist/__tests__/fixtures/services.d.ts +69 -0
- package/dist/__tests__/fixtures/services.d.ts.map +1 -1
- package/dist/__tests__/fixtures/services.js +51 -0
- package/dist/__tests__/handler.test.js +35 -2
- package/dist/__tests__/invariants.test.js +12 -12
- package/dist/__tests__/serialize.test.js +39 -0
- package/dist/__tests__/typescript-stress.test.d.ts +392 -196
- package/dist/__tests__/typescript-stress.test.d.ts.map +1 -1
- package/dist/__tests__/typescript-stress.test.js +13 -3
- package/dist/router/builder.d.ts +49 -11
- package/dist/router/builder.d.ts.map +1 -1
- package/dist/router/builder.js +14 -3
- package/dist/router/client.d.ts +18 -2
- package/dist/router/client.d.ts.map +1 -1
- package/dist/router/client.js +37 -5
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/server.d.ts +3 -3
- package/dist/router/server.d.ts.map +1 -1
- package/dist/router/server.js +48 -6
- package/dist/transport/events.d.ts +19 -0
- package/dist/transport/events.d.ts.map +1 -0
- package/dist/transport/events.js +26 -0
- package/dist/transport/index.js +2 -2
- package/dist/transport/transport.d.ts +11 -8
- package/dist/transport/transport.d.ts.map +1 -1
- package/dist/transport/transport.js +23 -14
- package/dist/util/testHelpers.d.ts +58 -7
- package/dist/util/testHelpers.d.ts.map +1 -1
- package/dist/util/testHelpers.js +133 -3
- package/package.json +12 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-stress.test.d.ts","sourceRoot":"","sources":["../../__tests__/typescript-stress.test.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAS,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,w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
|
|
9
9
|
import { Ok } from '../router/result';
|
|
10
|
-
const input = Type.
|
|
11
|
-
|
|
10
|
+
const input = Type.Union([
|
|
11
|
+
Type.Object({ a: Type.Number() }),
|
|
12
|
+
Type.Object({ c: Type.String() }),
|
|
13
|
+
]);
|
|
14
|
+
const output = Type.Object({ b: Type.Union([Type.Number(), Type.String()]) });
|
|
12
15
|
const errors = Type.Union([
|
|
13
16
|
Type.Object({
|
|
14
17
|
code: Type.Literal('ERROR1'),
|
|
@@ -25,7 +28,12 @@ const fnBody = {
|
|
|
25
28
|
output,
|
|
26
29
|
errors,
|
|
27
30
|
async handler(_state, msg) {
|
|
28
|
-
|
|
31
|
+
if ('c' in msg.payload) {
|
|
32
|
+
return reply(msg, Ok({ b: msg.payload.c }));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return reply(msg, Ok({ b: msg.payload.a }));
|
|
36
|
+
}
|
|
29
37
|
},
|
|
30
38
|
};
|
|
31
39
|
// typescript is limited to max 50 constraints
|
|
@@ -107,6 +115,8 @@ describe("ensure typescript doesn't give up trying to infer the types for large
|
|
|
107
115
|
};
|
|
108
116
|
const server = await createServer(new MockTransport('SERVER'), listing);
|
|
109
117
|
const client = createClient(new MockTransport('client'));
|
|
118
|
+
expect(client.d.f48.rpc({ a: 0 })).toBeTruthy();
|
|
119
|
+
expect(client.a.f2.rpc({ c: 'abc' })).toBeTruthy();
|
|
110
120
|
expect(server).toBeTruthy();
|
|
111
121
|
expect(client).toBeTruthy();
|
|
112
122
|
});
|
package/dist/router/builder.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import { TransportMessage } from '../transport/message';
|
|
|
4
4
|
import { ServiceContextWithState } from './context';
|
|
5
5
|
import { Result, RiverError, RiverUncaughtSchema } from './result';
|
|
6
6
|
/**
|
|
7
|
-
* The valid {@link Procedure} types.
|
|
7
|
+
* The valid {@link Procedure} types. The `stream` and `upload` types can optionally have a
|
|
8
|
+
* different type for the very first initialization message. The suffixless types correspond to
|
|
9
|
+
* gRPC's four combinations of stream / non-stream in each direction.
|
|
8
10
|
*/
|
|
9
|
-
export type ValidProcType = 'rpc' | '
|
|
11
|
+
export type ValidProcType = 'rpc' | 'upload' | 'subscription' | 'stream';
|
|
10
12
|
/**
|
|
11
13
|
* A generic procedure listing where the keys are the names of the procedures
|
|
12
14
|
* and the values are the {@link Procedure} definitions. This is not meant to
|
|
@@ -38,6 +40,20 @@ export declare function serializeService(s: AnyService): object;
|
|
|
38
40
|
* @template ProcName - The name of the procedure.
|
|
39
41
|
*/
|
|
40
42
|
export type ProcHandler<S extends AnyService, ProcName extends keyof S['procedures']> = S['procedures'][ProcName]['handler'];
|
|
43
|
+
/**
|
|
44
|
+
* Helper to get whether the type definition for the procedure contains an init type.
|
|
45
|
+
* @template S - The service.
|
|
46
|
+
* @template ProcName - The name of the procedure.
|
|
47
|
+
*/
|
|
48
|
+
export type ProcHasInit<S extends AnyService, ProcName extends keyof S['procedures']> = S['procedures'][ProcName] extends {
|
|
49
|
+
init: any;
|
|
50
|
+
} ? true : false;
|
|
51
|
+
/**
|
|
52
|
+
* Helper to get the type definition for the procedure init type of a service.
|
|
53
|
+
* @template S - The service.
|
|
54
|
+
* @template ProcName - The name of the procedure.
|
|
55
|
+
*/
|
|
56
|
+
export type ProcInit<S extends AnyService, ProcName extends keyof S['procedures']> = S['procedures'][ProcName]['init'];
|
|
41
57
|
/**
|
|
42
58
|
* Helper to get the type definition for the procedure input of a service.
|
|
43
59
|
* @template S - The service.
|
|
@@ -62,33 +78,55 @@ export type ProcErrors<S extends AnyService, ProcName extends keyof S['procedure
|
|
|
62
78
|
* @template ProcName - The name of the procedure.
|
|
63
79
|
*/
|
|
64
80
|
export type ProcType<S extends AnyService, ProcName extends keyof S['procedures']> = S['procedures'][ProcName]['type'];
|
|
81
|
+
export type PayloadType = TObject | TUnion<TObject[]>;
|
|
65
82
|
/**
|
|
66
83
|
* Defines a Procedure type that can be either an RPC or a stream procedure.
|
|
67
84
|
* @template State - The TypeBox schema of the state object.
|
|
68
85
|
* @template Ty - The type of the procedure.
|
|
69
86
|
* @template I - The TypeBox schema of the input object.
|
|
70
87
|
* @template O - The TypeBox schema of the output object.
|
|
88
|
+
* @template Init - The TypeBox schema of the input initialization object.
|
|
71
89
|
*/
|
|
72
|
-
export type Procedure<State extends object | unknown, Ty extends ValidProcType, I extends
|
|
90
|
+
export type Procedure<State extends object | unknown, Ty extends ValidProcType, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null> = Ty extends 'rpc' ? Init extends null ? {
|
|
73
91
|
input: I;
|
|
74
92
|
output: O;
|
|
75
93
|
errors: E;
|
|
76
94
|
handler: (context: ServiceContextWithState<State>, input: TransportMessage<Static<I>>) => Promise<TransportMessage<Result<Static<O>, Static<E>>>>;
|
|
77
95
|
type: Ty;
|
|
78
|
-
} : Ty extends '
|
|
96
|
+
} : never : Ty extends 'upload' ? Init extends PayloadType ? {
|
|
97
|
+
init: Init;
|
|
79
98
|
input: I;
|
|
80
99
|
output: O;
|
|
81
100
|
errors: E;
|
|
82
|
-
handler: (context: ServiceContextWithState<State>, input: AsyncIterable<TransportMessage<Static<I
|
|
101
|
+
handler: (context: ServiceContextWithState<State>, init: TransportMessage<Static<Init>>, input: AsyncIterable<TransportMessage<Static<I>>>) => Promise<TransportMessage<Result<Static<O>, Static<E>>>>;
|
|
102
|
+
type: Ty;
|
|
103
|
+
} : {
|
|
104
|
+
input: I;
|
|
105
|
+
output: O;
|
|
106
|
+
errors: E;
|
|
107
|
+
handler: (context: ServiceContextWithState<State>, input: AsyncIterable<TransportMessage<Static<I>>>) => Promise<TransportMessage<Result<Static<O>, Static<E>>>>;
|
|
83
108
|
type: Ty;
|
|
84
|
-
} : Ty extends 'subscription' ? {
|
|
109
|
+
} : Ty extends 'subscription' ? Init extends null ? {
|
|
85
110
|
input: I;
|
|
86
111
|
output: O;
|
|
87
112
|
errors: E;
|
|
88
113
|
handler: (context: ServiceContextWithState<State>, input: TransportMessage<Static<I>>, output: Pushable<TransportMessage<Result<Static<O>, Static<E>>>>) => Promise<void>;
|
|
89
114
|
type: Ty;
|
|
115
|
+
} : never : Ty extends 'stream' ? Init extends PayloadType ? {
|
|
116
|
+
init: Init;
|
|
117
|
+
input: I;
|
|
118
|
+
output: O;
|
|
119
|
+
errors: E;
|
|
120
|
+
handler: (context: ServiceContextWithState<State>, init: TransportMessage<Static<Init>>, input: AsyncIterable<TransportMessage<Static<I>>>, output: Pushable<TransportMessage<Result<Static<O>, Static<E>>>>) => Promise<void>;
|
|
121
|
+
type: Ty;
|
|
122
|
+
} : {
|
|
123
|
+
input: I;
|
|
124
|
+
output: O;
|
|
125
|
+
errors: E;
|
|
126
|
+
handler: (context: ServiceContextWithState<State>, input: AsyncIterable<TransportMessage<Static<I>>>, output: Pushable<TransportMessage<Result<Static<O>, Static<E>>>>) => Promise<void>;
|
|
127
|
+
type: Ty;
|
|
90
128
|
} : never;
|
|
91
|
-
export type AnyProcedure = Procedure<object, ValidProcType,
|
|
129
|
+
export type AnyProcedure = Procedure<object, ValidProcType, PayloadType, PayloadType, RiverError, PayloadType | null>;
|
|
92
130
|
/**
|
|
93
131
|
* A builder class for creating River Services.
|
|
94
132
|
* You must call the finalize method to get the finalized schema for use in a service router.
|
|
@@ -116,14 +154,14 @@ export declare class ServiceBuilder<T extends Service<string, object, ProcListin
|
|
|
116
154
|
/**
|
|
117
155
|
* Defines a new procedure for the service.
|
|
118
156
|
* @param {ProcName} procName The name of the procedure.
|
|
119
|
-
* @param {Procedure<T['state'], Ty, I, O>} procDef The definition of the procedure.
|
|
120
|
-
* @returns {ServiceBuilder<{ name: T['name']; state: T['state']; procedures: T['procedures'] & { [k in ProcName]: Procedure<T['state'], Ty, I, O>; }; }>} A new ServiceBuilder instance with the updated schema.
|
|
157
|
+
* @param {Procedure<T['state'], Ty, I, O, E, Init>} procDef The definition of the procedure.
|
|
158
|
+
* @returns {ServiceBuilder<{ name: T['name']; state: T['state']; procedures: T['procedures'] & { [k in ProcName]: Procedure<T['state'], Ty, I, O, E, Init>; }; }>} A new ServiceBuilder instance with the updated schema.
|
|
121
159
|
*/
|
|
122
|
-
defineProcedure<ProcName extends string, Ty extends ValidProcType, I extends
|
|
160
|
+
defineProcedure<ProcName extends string, Ty extends ValidProcType, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(procName: ProcName, procDef: Procedure<T['state'], Ty, I, O, E, Init>): ServiceBuilder<{
|
|
123
161
|
name: T['name'];
|
|
124
162
|
state: T['state'];
|
|
125
163
|
procedures: T['procedures'] & {
|
|
126
|
-
[k in ProcName]: Procedure<T['state'], Ty, I, O, E>;
|
|
164
|
+
[k in ProcName]: Procedure<T['state'], Ty, I, O, E, Init>;
|
|
127
165
|
};
|
|
128
166
|
}>;
|
|
129
167
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../router/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAQ,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEnE
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../router/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAQ,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,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AM,CAAC,CAAC;QAChB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;QAClB,UAAU,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG;aAC3B,CAAC,IAAI,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC;SAC1D,CAAC;KACH,CAAC;IAkBF;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,SAAS,MAAM,EAC/B,IAAI,EAAE,IAAI,GACT,cAAc,CAAC;QAChB,IAAI,EAAE,IAAI,CAAC;QACX,KAAK,EAAE,EAAE,CAAC;QACV,UAAU,EAAE,EAAE,CAAC;KAChB,CAAC;CAOH"}
|
package/dist/router/builder.js
CHANGED
|
@@ -13,8 +13,19 @@ export function serializeService(s) {
|
|
|
13
13
|
{
|
|
14
14
|
input: Type.Strict(procDef.input),
|
|
15
15
|
output: Type.Strict(procDef.output),
|
|
16
|
-
errors
|
|
16
|
+
// Only add the `errors` field if it is non-never.
|
|
17
|
+
...('errors' in procDef
|
|
18
|
+
? {
|
|
19
|
+
errors: Type.Strict(procDef.errors),
|
|
20
|
+
}
|
|
21
|
+
: {}),
|
|
17
22
|
type: procDef.type,
|
|
23
|
+
// Only add the `init` field if the type declares it.
|
|
24
|
+
...('init' in procDef
|
|
25
|
+
? {
|
|
26
|
+
init: Type.Strict(procDef.init),
|
|
27
|
+
}
|
|
28
|
+
: {}),
|
|
18
29
|
},
|
|
19
30
|
])),
|
|
20
31
|
};
|
|
@@ -51,8 +62,8 @@ export class ServiceBuilder {
|
|
|
51
62
|
/**
|
|
52
63
|
* Defines a new procedure for the service.
|
|
53
64
|
* @param {ProcName} procName The name of the procedure.
|
|
54
|
-
* @param {Procedure<T['state'], Ty, I, O>} procDef The definition of the procedure.
|
|
55
|
-
* @returns {ServiceBuilder<{ name: T['name']; state: T['state']; procedures: T['procedures'] & { [k in ProcName]: Procedure<T['state'], Ty, I, O>; }; }>} A new ServiceBuilder instance with the updated schema.
|
|
65
|
+
* @param {Procedure<T['state'], Ty, I, O, E, Init>} procDef The definition of the procedure.
|
|
66
|
+
* @returns {ServiceBuilder<{ name: T['name']; state: T['state']; procedures: T['procedures'] & { [k in ProcName]: Procedure<T['state'], Ty, I, O, E, Init>; }; }>} A new ServiceBuilder instance with the updated schema.
|
|
56
67
|
*/
|
|
57
68
|
defineProcedure(procName, procDef) {
|
|
58
69
|
const newProcedure = { [procName]: procDef };
|
package/dist/router/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Connection, Transport } from '../transport/transport';
|
|
2
|
-
import { AnyService, ProcErrors, ProcInput, ProcOutput, ProcType } from './builder';
|
|
2
|
+
import { AnyService, ProcErrors, ProcHasInit, ProcInit, ProcInput, ProcOutput, ProcType } from './builder';
|
|
3
3
|
import type { Pushable } from 'it-pushable';
|
|
4
4
|
import { Server } from './server';
|
|
5
5
|
import { TransportClientId } from '../transport/message';
|
|
@@ -14,7 +14,23 @@ type AsyncIter<T> = AsyncGenerator<T, T, unknown>;
|
|
|
14
14
|
type ServiceClient<Router extends AnyService> = {
|
|
15
15
|
[ProcName in keyof Router['procedures']]: ProcType<Router, ProcName> extends 'rpc' ? {
|
|
16
16
|
rpc: (input: Static<ProcInput<Router, ProcName>>) => Promise<Result<Static<ProcOutput<Router, ProcName>>, Static<ProcErrors<Router, ProcName>>>>;
|
|
17
|
-
} : ProcType<Router, ProcName> extends '
|
|
17
|
+
} : ProcType<Router, ProcName> extends 'upload' ? ProcHasInit<Router, ProcName> extends true ? {
|
|
18
|
+
upload: (init: Static<ProcInit<Router, ProcName>>) => Promise<[
|
|
19
|
+
Pushable<Static<ProcInput<Router, ProcName>>>,
|
|
20
|
+
Promise<Result<Static<ProcOutput<Router, ProcName>>, Static<ProcErrors<Router, ProcName>>>>
|
|
21
|
+
]>;
|
|
22
|
+
} : {
|
|
23
|
+
upload: () => Promise<[
|
|
24
|
+
Pushable<Static<ProcInput<Router, ProcName>>>,
|
|
25
|
+
Promise<Result<Static<ProcOutput<Router, ProcName>>, Static<ProcErrors<Router, ProcName>>>>
|
|
26
|
+
]>;
|
|
27
|
+
} : ProcType<Router, ProcName> extends 'stream' ? ProcHasInit<Router, ProcName> extends true ? {
|
|
28
|
+
stream: (init: Static<ProcInit<Router, ProcName>>) => Promise<[
|
|
29
|
+
Pushable<Static<ProcInput<Router, ProcName>>>,
|
|
30
|
+
AsyncIter<Result<Static<ProcOutput<Router, ProcName>>, Static<ProcErrors<Router, ProcName>>>>,
|
|
31
|
+
() => void
|
|
32
|
+
]>;
|
|
33
|
+
} : {
|
|
18
34
|
stream: () => Promise<[
|
|
19
35
|
Pushable<Static<ProcInput<Router, ProcName>>>,
|
|
20
36
|
AsyncIter<Result<Static<ProcOutput<Router, ProcName>>, Static<ProcErrors<Router, ProcName>>>>,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../router/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACT,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAIL,iBAAiB,EAGlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,KAAK,SAAS,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;AAElD;;;;GAIG;AACH,KAAK,aAAa,CAAC,MAAM,SAAS,UAAU,IAAI;KA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AM,EAAE,QAAQ,CAAC,CAAC,CACrC,CACF;YACD,MAAM,IAAI;SACX,CACF,CAAC;KACH,GACD;QACE,MAAM,EAAE,MAAM,OAAO,CACnB;YACE,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC7C,SAAS,CACP,MAAM,CACJ,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,EACpC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CACrC,CACF;YACD,MAAM,IAAI;SACX,CACF,CAAC;KACH,GACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,cAAc,GACjD;QACE,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,KAAK,OAAO,CAChE;YACE,SAAS,CACP,MAAM,CACJ,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,EACpC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CACrC,CACF;YACD,MAAM,IAAI;SACX,CACF,CAAC;KACH,GACD,KAAK;CACV,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,IAAI;KACxE,OAAO,IAAI,MAAM,GAAG,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;CAC5E,CAAC;AAgCF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,8DACZ,UAAU,UAAU,CAAC,aACtB,iBAAiB,sBAyMA,CAAC"}
|
package/dist/router/client.js
CHANGED
|
@@ -50,8 +50,15 @@ export const createClient = (transport, serverId = 'SERVER') => _createRecursive
|
|
|
50
50
|
const inputStream = pushable({ objectMode: true });
|
|
51
51
|
const outputStream = pushable({ objectMode: true });
|
|
52
52
|
let firstMessage = true;
|
|
53
|
+
if (input) {
|
|
54
|
+
const m = msg(transport.clientId, serverId, serviceName, procName, streamId, input);
|
|
55
|
+
// first message needs the open bit.
|
|
56
|
+
m.controlFlags = 2 /* ControlFlags.StreamOpenBit */;
|
|
57
|
+
transport.send(m);
|
|
58
|
+
firstMessage = false;
|
|
59
|
+
}
|
|
53
60
|
// input -> transport
|
|
54
|
-
// this gets cleaned up on
|
|
61
|
+
// this gets cleaned up on inputStream.end() which is called by closeHandler
|
|
55
62
|
(async () => {
|
|
56
63
|
for await (const rawIn of inputStream) {
|
|
57
64
|
const m = msg(transport.clientId, serverId, serviceName, procName, streamId, rawIn);
|
|
@@ -71,12 +78,12 @@ export const createClient = (transport, serverId = 'SERVER') => _createRecursive
|
|
|
71
78
|
outputStream.push(msg.payload);
|
|
72
79
|
}
|
|
73
80
|
};
|
|
74
|
-
transport.
|
|
81
|
+
transport.addEventListener('message', listener);
|
|
75
82
|
const closeHandler = () => {
|
|
76
83
|
inputStream.end();
|
|
77
84
|
outputStream.end();
|
|
78
85
|
transport.send(closeStream(transport.clientId, serverId, serviceName, procName, streamId));
|
|
79
|
-
transport.
|
|
86
|
+
transport.removeEventListener('message', listener);
|
|
80
87
|
};
|
|
81
88
|
return [inputStream, outputStream, closeHandler];
|
|
82
89
|
}
|
|
@@ -102,14 +109,39 @@ export const createClient = (transport, serverId = 'SERVER') => _createRecursive
|
|
|
102
109
|
outputStream.end();
|
|
103
110
|
}
|
|
104
111
|
};
|
|
105
|
-
transport.
|
|
112
|
+
transport.addEventListener('message', listener);
|
|
106
113
|
const closeHandler = () => {
|
|
107
114
|
outputStream.end();
|
|
108
115
|
transport.send(closeStream(transport.clientId, serverId, serviceName, procName, streamId));
|
|
109
|
-
transport.
|
|
116
|
+
transport.removeEventListener('message', listener);
|
|
110
117
|
};
|
|
111
118
|
return [outputStream, closeHandler];
|
|
112
119
|
}
|
|
120
|
+
else if (procType === 'upload') {
|
|
121
|
+
const inputStream = pushable({ objectMode: true });
|
|
122
|
+
let firstMessage = true;
|
|
123
|
+
if (input) {
|
|
124
|
+
const m = msg(transport.clientId, serverId, serviceName, procName, streamId, input);
|
|
125
|
+
// first message needs the open bit.
|
|
126
|
+
m.controlFlags = 2 /* ControlFlags.StreamOpenBit */;
|
|
127
|
+
transport.send(m);
|
|
128
|
+
firstMessage = false;
|
|
129
|
+
}
|
|
130
|
+
// input -> transport
|
|
131
|
+
// this gets cleaned up on inputStream.end(), which the caller should call.
|
|
132
|
+
(async () => {
|
|
133
|
+
for await (const rawIn of inputStream) {
|
|
134
|
+
const m = msg(transport.clientId, serverId, serviceName, procName, streamId, rawIn);
|
|
135
|
+
if (firstMessage) {
|
|
136
|
+
m.controlFlags |= 2 /* ControlFlags.StreamOpenBit */;
|
|
137
|
+
firstMessage = false;
|
|
138
|
+
}
|
|
139
|
+
transport.send(m);
|
|
140
|
+
}
|
|
141
|
+
transport.send(closeStream(transport.clientId, serverId, serviceName, procName, streamId));
|
|
142
|
+
})();
|
|
143
|
+
return [inputStream, waitForMessage(transport, belongsToSameStream)];
|
|
144
|
+
}
|
|
113
145
|
else {
|
|
114
146
|
throw new Error(`invalid river call, unknown procedure type ${procType}`);
|
|
115
147
|
}
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { serializeService, ServiceBuilder } from './builder';
|
|
2
|
-
export type { ValidProcType, ProcListing, Service, ProcHandler, ProcInput, ProcOutput, ProcType, Procedure, } from './builder';
|
|
2
|
+
export type { ValidProcType, ProcListing, Service, ProcHandler, ProcInput, ProcOutput, ProcType, Procedure, PayloadType, } from './builder';
|
|
3
3
|
export { createClient } from './client';
|
|
4
4
|
export type { ServerClient } from './client';
|
|
5
5
|
export { createServer } from './server';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,YAAY,EACV,aAAa,EACb,WAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,YAAY,EACV,aAAa,EACb,WAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/router/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Static
|
|
1
|
+
import { Static } from '@sinclair/typebox';
|
|
2
2
|
import { Connection, Transport } from '../transport/transport';
|
|
3
|
-
import { AnyService } from './builder';
|
|
3
|
+
import { AnyService, PayloadType } from './builder';
|
|
4
4
|
import type { Pushable } from 'it-pushable';
|
|
5
5
|
import { TransportMessage } from '../transport/message';
|
|
6
6
|
import { ServiceContext } from './context';
|
|
@@ -16,7 +16,7 @@ export interface Server<Services> {
|
|
|
16
16
|
}
|
|
17
17
|
interface ProcStream {
|
|
18
18
|
incoming: Pushable<TransportMessage>;
|
|
19
|
-
outgoing: Pushable<TransportMessage<Result<Static<
|
|
19
|
+
outgoing: Pushable<TransportMessage<Result<Static<PayloadType>, Static<RiverError>>>>;
|
|
20
20
|
promises: {
|
|
21
21
|
outputHandler: Promise<unknown>;
|
|
22
22
|
inputHandler: Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../router/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../router/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAgB,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAGL,gBAAgB,EAKjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAA2B,MAAM,WAAW,CAAC;AAGpE,OAAO,EAEL,MAAM,EACN,UAAU,EAGX,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,MAAM,WAAW,MAAM,CAAC,QAAQ;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,UAAU,UAAU;IAClB,QAAQ,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IACrC,QAAQ,EAAE,QAAQ,CAChB,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAClE,CAAC;IACF,QAAQ,EAAE;QACR,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;KAChC,CAAC;CACH;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAC5E,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAChC,QAAQ,EAAE,QAAQ,EAClB,eAAe,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAuP3B"}
|
package/dist/router/server.js
CHANGED
|
@@ -83,9 +83,22 @@ export async function createServer(transport, services, extendedContext) {
|
|
|
83
83
|
// pump incoming message stream -> handler -> outgoing message stream
|
|
84
84
|
let inputHandler;
|
|
85
85
|
if (procedure.type === 'stream') {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
if ('init' in procedure) {
|
|
87
|
+
inputHandler = (async () => {
|
|
88
|
+
const initMessage = await incoming.next();
|
|
89
|
+
if (initMessage.done) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
return procedure
|
|
93
|
+
.handler(serviceContext, initMessage.value, incoming, outgoing)
|
|
94
|
+
.catch(errorHandler);
|
|
95
|
+
})();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
inputHandler = procedure
|
|
99
|
+
.handler(serviceContext, incoming, outgoing)
|
|
100
|
+
.catch(errorHandler);
|
|
101
|
+
}
|
|
89
102
|
}
|
|
90
103
|
else if (procedure.type === 'rpc') {
|
|
91
104
|
inputHandler = (async () => {
|
|
@@ -116,6 +129,34 @@ export async function createServer(transport, services, extendedContext) {
|
|
|
116
129
|
}
|
|
117
130
|
})();
|
|
118
131
|
}
|
|
132
|
+
else if (procedure.type === 'upload') {
|
|
133
|
+
if ('init' in procedure) {
|
|
134
|
+
inputHandler = (async () => {
|
|
135
|
+
const initMessage = await incoming.next();
|
|
136
|
+
if (initMessage.done) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const outputMessage = await procedure.handler(serviceContext, initMessage.value, incoming);
|
|
141
|
+
outgoing.push(outputMessage);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
errorHandler(err);
|
|
145
|
+
}
|
|
146
|
+
})();
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
inputHandler = (async () => {
|
|
150
|
+
try {
|
|
151
|
+
const outputMessage = await procedure.handler(serviceContext, incoming);
|
|
152
|
+
outgoing.push(outputMessage);
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
errorHandler(err);
|
|
156
|
+
}
|
|
157
|
+
})();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
119
160
|
else {
|
|
120
161
|
// procedure is inferred to be never here as this is not a valid procedure type
|
|
121
162
|
// we cast just to log
|
|
@@ -133,7 +174,8 @@ export async function createServer(transport, services, extendedContext) {
|
|
|
133
174
|
log?.warn(`${transport.clientId} -- couldn't find a matching procedure stream for ${message.serviceName}.${message.procedureName}:${message.streamId}`);
|
|
134
175
|
return;
|
|
135
176
|
}
|
|
136
|
-
if (Value.Check(procedure.input, message.payload)
|
|
177
|
+
if (Value.Check(procedure.input, message.payload) ||
|
|
178
|
+
('init' in procedure && Value.Check(procedure.init, message.payload))) {
|
|
137
179
|
procStream.incoming.push(message);
|
|
138
180
|
}
|
|
139
181
|
else if (!Value.Check(ControlMessagePayloadSchema, message.payload)) {
|
|
@@ -143,12 +185,12 @@ export async function createServer(transport, services, extendedContext) {
|
|
|
143
185
|
await cleanupStream(streamIdx);
|
|
144
186
|
}
|
|
145
187
|
};
|
|
146
|
-
transport.
|
|
188
|
+
transport.addEventListener('message', handler);
|
|
147
189
|
return {
|
|
148
190
|
services,
|
|
149
191
|
streams: streamMap,
|
|
150
192
|
async close() {
|
|
151
|
-
transport.
|
|
193
|
+
transport.removeEventListener('message', handler);
|
|
152
194
|
for (const streamIdx of streamMap.keys()) {
|
|
153
195
|
await cleanupStream(streamIdx);
|
|
154
196
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpaqueTransportMessage } from './message';
|
|
2
|
+
import { Connection } from './transport';
|
|
3
|
+
export interface EventMap {
|
|
4
|
+
message: OpaqueTransportMessage;
|
|
5
|
+
connectionStatus: {
|
|
6
|
+
status: 'connect' | 'disconnect';
|
|
7
|
+
conn: Connection;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export type EventTypes = keyof EventMap;
|
|
11
|
+
export type EventHandler<K extends EventTypes> = (event: EventMap[K]) => void;
|
|
12
|
+
export declare class EventDispatcher<T extends EventTypes> {
|
|
13
|
+
private eventListeners;
|
|
14
|
+
numberOfListeners<K extends T>(eventType: K): number;
|
|
15
|
+
addEventListener<K extends T>(eventType: K, handler: EventHandler<K>): void;
|
|
16
|
+
removeEventListener<K extends T>(eventType: K, handler: EventHandler<K>): void;
|
|
17
|
+
dispatchEvent<K extends T>(eventType: K, event: EventMap[K]): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../transport/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,sBAAsB,CAAC;IAChC,gBAAgB,EAAE;QAChB,MAAM,EAAE,SAAS,GAAG,YAAY,CAAC;QACjC,IAAI,EAAE,UAAU,CAAC;KAClB,CAAC;CACH;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC;AACxC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAE9E,qBAAa,eAAe,CAAC,CAAC,SAAS,UAAU;IAC/C,OAAO,CAAC,cAAc,CAA2C;IAEjE,iBAAiB,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IAI3C,gBAAgB,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAQpE,mBAAmB,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAOvE,aAAa,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;CAQ5D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class EventDispatcher {
|
|
2
|
+
eventListeners = {};
|
|
3
|
+
numberOfListeners(eventType) {
|
|
4
|
+
return this.eventListeners[eventType]?.size ?? 0;
|
|
5
|
+
}
|
|
6
|
+
addEventListener(eventType, handler) {
|
|
7
|
+
if (!this.eventListeners[eventType]) {
|
|
8
|
+
this.eventListeners[eventType] = new Set();
|
|
9
|
+
}
|
|
10
|
+
this.eventListeners[eventType]?.add(handler);
|
|
11
|
+
}
|
|
12
|
+
removeEventListener(eventType, handler) {
|
|
13
|
+
const handlers = this.eventListeners[eventType];
|
|
14
|
+
if (handlers) {
|
|
15
|
+
this.eventListeners[eventType]?.delete(handler);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
dispatchEvent(eventType, event) {
|
|
19
|
+
const handlers = this.eventListeners[eventType];
|
|
20
|
+
if (handlers) {
|
|
21
|
+
for (const handler of handlers) {
|
|
22
|
+
handler(event);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
package/dist/transport/index.js
CHANGED
|
@@ -12,12 +12,12 @@ export async function waitForMessage(t, filter, rejectMismatch) {
|
|
|
12
12
|
function onMessage(msg) {
|
|
13
13
|
if (!filter || filter?.(msg)) {
|
|
14
14
|
resolve(msg.payload);
|
|
15
|
-
t.
|
|
15
|
+
t.removeEventListener('message', onMessage);
|
|
16
16
|
}
|
|
17
17
|
else if (rejectMismatch) {
|
|
18
18
|
reject(new Error('message didnt match the filter'));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
t.
|
|
21
|
+
t.addEventListener('message', onMessage);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Codec } from '../codec/types';
|
|
2
2
|
import { MessageId, OpaqueTransportMessage, TransportClientId } from './message';
|
|
3
|
+
import { EventDispatcher, EventHandler, EventTypes } from './events';
|
|
3
4
|
/**
|
|
4
5
|
* A 1:1 connection between two transports. Once this is created,
|
|
5
6
|
* the {@link Connection} is expected to take over responsibility for
|
|
@@ -63,10 +64,6 @@ export declare abstract class Transport<ConnType extends Connection> {
|
|
|
63
64
|
* The client ID of this transport.
|
|
64
65
|
*/
|
|
65
66
|
clientId: TransportClientId;
|
|
66
|
-
/**
|
|
67
|
-
* The set of message handlers registered with this transport.
|
|
68
|
-
*/
|
|
69
|
-
messageHandlers: Set<(msg: OpaqueTransportMessage) => void>;
|
|
70
67
|
/**
|
|
71
68
|
* An array of message IDs that are waiting to be sent over the WebSocket connection.
|
|
72
69
|
* This builds up if the WebSocket is down for a period of time.
|
|
@@ -80,6 +77,10 @@ export declare abstract class Transport<ConnType extends Connection> {
|
|
|
80
77
|
* The map of {@link Connection}s managed by this transport.
|
|
81
78
|
*/
|
|
82
79
|
connections: Map<TransportClientId, ConnType>;
|
|
80
|
+
/**
|
|
81
|
+
* The event dispatcher for handling events of type EventTypes.
|
|
82
|
+
*/
|
|
83
|
+
eventDispatcher: EventDispatcher<EventTypes>;
|
|
83
84
|
/**
|
|
84
85
|
* Creates a new Transport instance.
|
|
85
86
|
* @param codec The codec used to encode and decode messages.
|
|
@@ -126,15 +127,17 @@ export declare abstract class Transport<ConnType extends Connection> {
|
|
|
126
127
|
*/
|
|
127
128
|
protected handleMsg(msg: OpaqueTransportMessage | null): void;
|
|
128
129
|
/**
|
|
129
|
-
* Adds a
|
|
130
|
+
* Adds a listener to this transport.
|
|
131
|
+
* @param the type of event to listen for
|
|
130
132
|
* @param handler The message handler to add.
|
|
131
133
|
*/
|
|
132
|
-
|
|
134
|
+
addEventListener<K extends EventTypes, T extends EventHandler<K>>(type: K, handler: T): void;
|
|
133
135
|
/**
|
|
134
|
-
* Removes a
|
|
136
|
+
* Removes a listener from this transport.
|
|
137
|
+
* @param the type of event to unlisten on
|
|
135
138
|
* @param handler The message handler to remove.
|
|
136
139
|
*/
|
|
137
|
-
|
|
140
|
+
removeEventListener<K extends EventTypes, T extends EventHandler<K>>(type: K, handler: T): void;
|
|
138
141
|
/**
|
|
139
142
|
* Sends a message over this transport, delegating to the appropriate connection to actually
|
|
140
143
|
* send the message.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAEL,SAAS,EACT,sBAAsB,EAGtB,iBAAiB,EAGlB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAEL,SAAS,EACT,sBAAsB,EAGtB,iBAAiB,EAGlB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAErE;;;;;;;;;;GAUG;AACH,8BAAsB,UAAU;IAC9B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC,UAA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