@sprucelabs/spruce-test-fixtures 52.2.8 → 52.2.10
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { SkillEventContract } from '@sprucelabs/mercury-types';
|
|
1
|
+
import { EventNames, EventSignature, SkillEventContract } from '@sprucelabs/mercury-types';
|
|
2
2
|
import { SchemaValues, Schema } from '@sprucelabs/schema';
|
|
3
|
-
type Fqen =
|
|
3
|
+
type Fqen = EventNames;
|
|
4
4
|
type EmitPayloadSchema<E extends Fqen> = SkillEventContract['eventSignatures'][E]['emitPayloadSchema'];
|
|
5
|
+
type ResponsePayloadSchema<E extends Fqen> = SkillEventContract['eventSignatures'][E] extends EventSignature ? SkillEventContract['eventSignatures'][E]['responsePayloadSchema'] : never;
|
|
5
6
|
type TargetAndPayload<E extends Fqen, S extends Schema | never = EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never> = SchemaValues<S>;
|
|
6
|
-
type ResponsePayloadSchema<E extends Fqen> = SkillEventContract['eventSignatures'][E]['responsePayloadSchema'];
|
|
7
7
|
type Response<E extends Fqen> = ResponsePayloadSchema<E> extends Schema ? SchemaValues<ResponsePayloadSchema<E>> : void;
|
|
8
8
|
declare const eventFaker: {
|
|
9
9
|
makeEventThrow(fqen: Fqen, error?: any): Promise<void>;
|
|
10
10
|
handleReactiveEvent(fqen: Fqen): Promise<void>;
|
|
11
|
-
on<E extends
|
|
11
|
+
on<E extends Fqen>(fqen: E, cb: (targetAndPayload: SchemaValues<EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never, false>) => Response<E> | Promise<Response<E>>): Promise<void>;
|
|
12
12
|
};
|
|
13
13
|
export default eventFaker;
|