@sprucelabs/mercury-types 37.2.2 → 37.2.4
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.
|
@@ -21,7 +21,6 @@ export interface MercurySingleResponse<Payload> {
|
|
|
21
21
|
payload?: Payload;
|
|
22
22
|
}
|
|
23
23
|
export type KeyOf<O> = Extract<keyof O, string>;
|
|
24
|
-
export declare type EventNames<Contract extends EventContract> = KeyOf<Contract['eventSignatures']>;
|
|
25
24
|
export type EventContractEmitPayloads<Contract extends EventContract> = {
|
|
26
25
|
[N in EventNames<Contract>]: Contract['eventSignatures'][N]['emitPayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][N]['emitPayloadSchema']> : never;
|
|
27
26
|
};
|
|
@@ -37,14 +36,20 @@ export default interface MercuryEventEmitter<Contract extends EventContract> {
|
|
|
37
36
|
emitAndFlattenResponses<EventName extends KeyOf<Contract['eventSignatures']> = KeyOf<Contract['eventSignatures']>, IEventSignature extends EventSignature = Contract['eventSignatures'][EventName], ResponseSchema extends Schema = IEventSignature['responsePayloadSchema'] extends Schema ? IEventSignature['responsePayloadSchema'] : never>(eventName: EventName, cb?: EmitCallback<Contract, EventName>): Promise<SchemaValues<ResponseSchema>[]>;
|
|
38
37
|
off(eventName: EventNames<Contract>, cb?: any): Promise<number>;
|
|
39
38
|
}
|
|
40
|
-
export interface SkillEventSignatures {
|
|
39
|
+
export interface SkillEventSignatures extends EventSignaturesByName {
|
|
41
40
|
}
|
|
42
|
-
/** @ts-ignore */
|
|
43
41
|
export interface SkillEventContract extends EventContract {
|
|
44
|
-
eventSignatures: SkillEventSignatures
|
|
42
|
+
eventSignatures: RemoveStringKeys<SkillEventSignatures>;
|
|
45
43
|
}
|
|
46
|
-
|
|
44
|
+
interface PCM {
|
|
45
|
+
[contractId: string]: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface PermissionContractMap extends PCM {
|
|
47
48
|
}
|
|
48
49
|
export type PermissionContractId = Extract<keyof PermissionContractMap, string>;
|
|
49
50
|
export type PermissionId<ContractId extends PermissionContractId> = PermissionContractMap[ContractId][number];
|
|
51
|
+
type RemoveStringKeys<T> = {
|
|
52
|
+
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
|
|
53
|
+
};
|
|
54
|
+
export type EventNames<Contract extends EventContract = SkillEventContract> = KeyOf<Contract['eventSignatures']>;
|
|
50
55
|
export {};
|
|
@@ -21,7 +21,6 @@ export interface MercurySingleResponse<Payload> {
|
|
|
21
21
|
payload?: Payload;
|
|
22
22
|
}
|
|
23
23
|
export type KeyOf<O> = Extract<keyof O, string>;
|
|
24
|
-
export declare type EventNames<Contract extends EventContract> = KeyOf<Contract['eventSignatures']>;
|
|
25
24
|
export type EventContractEmitPayloads<Contract extends EventContract> = {
|
|
26
25
|
[N in EventNames<Contract>]: Contract['eventSignatures'][N]['emitPayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][N]['emitPayloadSchema']> : never;
|
|
27
26
|
};
|
|
@@ -37,14 +36,20 @@ export default interface MercuryEventEmitter<Contract extends EventContract> {
|
|
|
37
36
|
emitAndFlattenResponses<EventName extends KeyOf<Contract['eventSignatures']> = KeyOf<Contract['eventSignatures']>, IEventSignature extends EventSignature = Contract['eventSignatures'][EventName], ResponseSchema extends Schema = IEventSignature['responsePayloadSchema'] extends Schema ? IEventSignature['responsePayloadSchema'] : never>(eventName: EventName, cb?: EmitCallback<Contract, EventName>): Promise<SchemaValues<ResponseSchema>[]>;
|
|
38
37
|
off(eventName: EventNames<Contract>, cb?: any): Promise<number>;
|
|
39
38
|
}
|
|
40
|
-
export interface SkillEventSignatures {
|
|
39
|
+
export interface SkillEventSignatures extends EventSignaturesByName {
|
|
41
40
|
}
|
|
42
|
-
/** @ts-ignore */
|
|
43
41
|
export interface SkillEventContract extends EventContract {
|
|
44
|
-
eventSignatures: SkillEventSignatures
|
|
42
|
+
eventSignatures: RemoveStringKeys<SkillEventSignatures>;
|
|
45
43
|
}
|
|
46
|
-
|
|
44
|
+
interface PCM {
|
|
45
|
+
[contractId: string]: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface PermissionContractMap extends PCM {
|
|
47
48
|
}
|
|
48
49
|
export type PermissionContractId = Extract<keyof PermissionContractMap, string>;
|
|
49
50
|
export type PermissionId<ContractId extends PermissionContractId> = PermissionContractMap[ContractId][number];
|
|
51
|
+
type RemoveStringKeys<T> = {
|
|
52
|
+
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
|
|
53
|
+
};
|
|
54
|
+
export type EventNames<Contract extends EventContract = SkillEventContract> = KeyOf<Contract['eventSignatures']>;
|
|
50
55
|
export {};
|