@sprucelabs/spruce-heartwood-utils 12.0.29 → 12.0.31
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,11 +1,11 @@
|
|
|
1
1
|
import { AbstractViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
3
|
-
import { EventContract,
|
|
3
|
+
import { EventContract, EventName, SkillEventContract, SpruceSchemas } from '@sprucelabs/mercury-types';
|
|
4
4
|
import { Schema, SchemaValues } from '@sprucelabs/schema';
|
|
5
5
|
import { VcFactoryForRemoteFactory } from './RemoteViewControllerFactory';
|
|
6
6
|
export default class CardRegistrar<Contract = SkillEventContract,
|
|
7
7
|
/** @ts-ignore */
|
|
8
|
-
Name extends
|
|
8
|
+
Name extends EventName<Contract> = EventName<Contract>> {
|
|
9
9
|
private client;
|
|
10
10
|
private eventName;
|
|
11
11
|
private vcIdsTransformer;
|
|
@@ -21,11 +21,11 @@ Name extends EventNames<Contract> = EventNames<Contract>> {
|
|
|
21
21
|
private ErrorCardVc;
|
|
22
22
|
}
|
|
23
23
|
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
24
|
-
declare type ResponsePayload<Contract extends EventContract, Name extends
|
|
25
|
-
declare type EmitPayload<Contract extends EventContract, Name extends
|
|
24
|
+
declare type ResponsePayload<Contract extends EventContract, Name extends EventName<Contract>> = Contract['eventSignatures'][Name]['responsePayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][Name]['responsePayloadSchema']> : never;
|
|
25
|
+
declare type EmitPayload<Contract extends EventContract, Name extends EventName<Contract>> = Contract['eventSignatures'][Name]['emitPayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][Name]['emitPayloadSchema']> : never;
|
|
26
26
|
export interface CardRegistrarOptions<Contract extends SkillEventContract,
|
|
27
27
|
/** @ts-ignore */
|
|
28
|
-
Name extends
|
|
28
|
+
Name extends EventName<Contract>> {
|
|
29
29
|
client: MercuryClient;
|
|
30
30
|
eventName: Name;
|
|
31
31
|
vcFactory: VcFactoryForRemoteFactory;
|
|
@@ -33,7 +33,7 @@ Name extends EventNames<Contract>> {
|
|
|
33
33
|
vcIdsTransformer: (payload: ResponsePayload<Contract, Name>) => string[];
|
|
34
34
|
}
|
|
35
35
|
export declare type EachCardHandler = (vcs: AbstractViewController<any>[]) => Promise<void> | void;
|
|
36
|
-
export declare type CardFetchOptions<Contract extends EventContract, Name extends
|
|
36
|
+
export declare type CardFetchOptions<Contract extends EventContract, Name extends EventName<Contract>> = {
|
|
37
37
|
each: EachCardHandler;
|
|
38
38
|
controllerOptionsHandler?: (vcId: string) => Record<string, any>;
|
|
39
39
|
} & EmitPayload<Contract, Name>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AbstractViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
3
|
-
import { EventContract,
|
|
3
|
+
import { EventContract, EventName, SkillEventContract, SpruceSchemas } from '@sprucelabs/mercury-types';
|
|
4
4
|
import { Schema, SchemaValues } from '@sprucelabs/schema';
|
|
5
5
|
import { VcFactoryForRemoteFactory } from './RemoteViewControllerFactory';
|
|
6
6
|
export default class CardRegistrar<Contract = SkillEventContract,
|
|
7
7
|
/** @ts-ignore */
|
|
8
|
-
Name extends
|
|
8
|
+
Name extends EventName<Contract> = EventName<Contract>> {
|
|
9
9
|
private client;
|
|
10
10
|
private eventName;
|
|
11
11
|
private vcIdsTransformer;
|
|
@@ -21,11 +21,11 @@ Name extends EventNames<Contract> = EventNames<Contract>> {
|
|
|
21
21
|
private ErrorCardVc;
|
|
22
22
|
}
|
|
23
23
|
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
24
|
-
declare type ResponsePayload<Contract extends EventContract, Name extends
|
|
25
|
-
declare type EmitPayload<Contract extends EventContract, Name extends
|
|
24
|
+
declare type ResponsePayload<Contract extends EventContract, Name extends EventName<Contract>> = Contract['eventSignatures'][Name]['responsePayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][Name]['responsePayloadSchema']> : never;
|
|
25
|
+
declare type EmitPayload<Contract extends EventContract, Name extends EventName<Contract>> = Contract['eventSignatures'][Name]['emitPayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][Name]['emitPayloadSchema']> : never;
|
|
26
26
|
export interface CardRegistrarOptions<Contract extends SkillEventContract,
|
|
27
27
|
/** @ts-ignore */
|
|
28
|
-
Name extends
|
|
28
|
+
Name extends EventName<Contract>> {
|
|
29
29
|
client: MercuryClient;
|
|
30
30
|
eventName: Name;
|
|
31
31
|
vcFactory: VcFactoryForRemoteFactory;
|
|
@@ -33,7 +33,7 @@ Name extends EventNames<Contract>> {
|
|
|
33
33
|
vcIdsTransformer: (payload: ResponsePayload<Contract, Name>) => string[];
|
|
34
34
|
}
|
|
35
35
|
export declare type EachCardHandler = (vcs: AbstractViewController<any>[]) => Promise<void> | void;
|
|
36
|
-
export declare type CardFetchOptions<Contract extends EventContract, Name extends
|
|
36
|
+
export declare type CardFetchOptions<Contract extends EventContract, Name extends EventName<Contract>> = {
|
|
37
37
|
each: EachCardHandler;
|
|
38
38
|
controllerOptionsHandler?: (vcId: string) => Record<string, any>;
|
|
39
39
|
} & EmitPayload<Contract, Name>;
|