arvo-core 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/types.d.ts +10 -2
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
@@ -62,13 +62,21 @@ type InferZodSchema<T> = T extends z.ZodTypeAny ? z.infer<T> : never;
|
|
62
62
|
* // MyContractType will have properties uri, accepts, and emits
|
63
63
|
*/
|
64
64
|
export type InferArvoContract<T extends ArvoContract<string, string, z.ZodTypeAny, Record<string, z.ZodTypeAny>>> = T extends ArvoContract<infer TUri, infer TType, infer TAcceptSchema, infer TEmits> ? {
|
65
|
+
/** The URI of the contract */
|
65
66
|
uri: TUri;
|
67
|
+
/** The event type that this contract accepts */
|
66
68
|
accepts: InferArvoEvent<ArvoEvent<InferZodSchema<TAcceptSchema>, {}, TType>>;
|
69
|
+
/** The event types that this contract can emit */
|
67
70
|
emits: {
|
68
71
|
[K in keyof TEmits]: InferArvoEvent<ArvoEvent<InferZodSchema<TEmits[K]>, {}, K & string>>;
|
69
|
-
} & {
|
70
|
-
[K in `sys.${TType}.error`]: InferArvoEvent<ArvoEvent<InferZodSchema<T['systemError']['schema']>, {}, T['systemError']['type']>>;
|
71
72
|
};
|
73
|
+
/** The system error event type for this contract */
|
72
74
|
systemError: InferArvoEvent<ArvoEvent<InferZodSchema<T['systemError']['schema']>, {}, T['systemError']['type']>>;
|
75
|
+
/** Union type of all emittable events, including regular events and system error */
|
76
|
+
emittableEvents: ({
|
77
|
+
[K in keyof TEmits]: InferArvoEvent<ArvoEvent<InferZodSchema<TEmits[K]>, {}, K & string>>;
|
78
|
+
} & {
|
79
|
+
[K in `sys.${TType}.error`]: InferArvoEvent<ArvoEvent<InferZodSchema<T['systemError']['schema']>, {}, T['systemError']['type']>>;
|
80
|
+
})[keyof TEmits | `sys.${TType}.error`];
|
73
81
|
} : never;
|
74
82
|
export {};
|