93746b937d
germanium cutoff
280 lines
11 KiB
TypeScript
280 lines
11 KiB
TypeScript
import z from "zod";
|
|
export declare const AuthMessageSchema: z.ZodObject<{
|
|
type: z.ZodLiteral<"auth">;
|
|
secret: z.ZodString;
|
|
pid: z.ZodOptional<z.ZodNumber>;
|
|
}, z.z.core.$strip>;
|
|
export declare const AuthAckMessageSchema: z.ZodObject<{
|
|
type: z.ZodLiteral<"auth-ack">;
|
|
}, z.z.core.$strip>;
|
|
export declare const RpcMethodSchema: z.ZodEnum<{
|
|
stop: "stop";
|
|
call: "call";
|
|
boot: "boot";
|
|
"target-context-open": "target-context-open";
|
|
"runtime-error": "runtime-error";
|
|
"context-open": "context-open";
|
|
"context-close": "context-close";
|
|
"event-subscribe": "event-subscribe";
|
|
"subscription-ready": "subscription-ready";
|
|
"event-unsubscribe": "event-unsubscribe";
|
|
"value-get": "value-get";
|
|
"value-watch": "value-watch";
|
|
"value-unwatch": "value-unwatch";
|
|
"subscription-publish": "subscription-publish";
|
|
}>;
|
|
export declare const RequestMessageSchema: z.ZodObject<{
|
|
type: z.ZodLiteral<"request">;
|
|
requestId: z.ZodString;
|
|
method: z.ZodEnum<{
|
|
stop: "stop";
|
|
call: "call";
|
|
boot: "boot";
|
|
"target-context-open": "target-context-open";
|
|
"runtime-error": "runtime-error";
|
|
"context-open": "context-open";
|
|
"context-close": "context-close";
|
|
"event-subscribe": "event-subscribe";
|
|
"subscription-ready": "subscription-ready";
|
|
"event-unsubscribe": "event-unsubscribe";
|
|
"value-get": "value-get";
|
|
"value-watch": "value-watch";
|
|
"value-unwatch": "value-unwatch";
|
|
"subscription-publish": "subscription-publish";
|
|
}>;
|
|
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
}, z.z.core.$strip>;
|
|
export declare const CallRequestParamsSchema: z.ZodObject<{
|
|
functionName: z.ZodString;
|
|
params: z.ZodUnknown;
|
|
target: z.ZodOptional<z.ZodString>;
|
|
targetPackageName: z.ZodOptional<z.ZodString>;
|
|
callerStateContextId: z.ZodOptional<z.ZodString>;
|
|
stateContextId: z.ZodOptional<z.ZodString>;
|
|
contextNamespace: z.ZodOptional<z.ZodString>;
|
|
}, z.z.core.$strip>;
|
|
export declare const BootRequestParamsSchema: z.ZodObject<{
|
|
target: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const TargetContextOpenRequestParamsSchema: z.ZodObject<{
|
|
target: z.ZodString;
|
|
targetPackageName: z.ZodOptional<z.ZodString>;
|
|
callerStateContextId: z.ZodOptional<z.ZodString>;
|
|
stateContextId: z.ZodOptional<z.ZodString>;
|
|
contextNamespace: z.ZodOptional<z.ZodString>;
|
|
}, z.z.core.$strip>;
|
|
export declare const RuntimeErrorRequestParamsSchema: z.ZodObject<{
|
|
phase: z.ZodEnum<{
|
|
function: "function";
|
|
"event-subscribe": "event-subscribe";
|
|
"value-get": "value-get";
|
|
"value-watch": "value-watch";
|
|
"subscription-publish": "subscription-publish";
|
|
"on-create": "on-create";
|
|
"on-destroy": "on-destroy";
|
|
"on-context-open": "on-context-open";
|
|
"on-context-close": "on-context-close";
|
|
"browser-surface": "browser-surface";
|
|
"event-cleanup": "event-cleanup";
|
|
"value-cleanup": "value-cleanup";
|
|
internal: "internal";
|
|
}>;
|
|
stateContextId: z.ZodOptional<z.ZodString>;
|
|
functionName: z.ZodOptional<z.ZodString>;
|
|
resourceKind: z.ZodOptional<z.ZodEnum<{
|
|
value: "value";
|
|
event: "event";
|
|
}>>;
|
|
resourceName: z.ZodOptional<z.ZodString>;
|
|
surfaceId: z.ZodOptional<z.ZodString>;
|
|
hostSessionId: z.ZodOptional<z.ZodString>;
|
|
message: z.ZodString;
|
|
stack: z.ZodOptional<z.ZodString>;
|
|
}, z.z.core.$strip>;
|
|
export declare const ContextOpenRequestParamsSchema: z.ZodObject<{
|
|
stateContextId: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const ContextCloseRequestParamsSchema: z.ZodObject<{
|
|
stateContextId: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const EventSubscribeRequestParamsSchema: z.ZodObject<{
|
|
eventName: z.ZodString;
|
|
params: z.ZodOptional<z.ZodUnknown>;
|
|
subscriptionNamespace: z.ZodOptional<z.ZodString>;
|
|
target: z.ZodOptional<z.ZodString>;
|
|
targetPackageName: z.ZodOptional<z.ZodString>;
|
|
callerStateContextId: z.ZodOptional<z.ZodString>;
|
|
stateContextId: z.ZodOptional<z.ZodString>;
|
|
contextNamespace: z.ZodOptional<z.ZodString>;
|
|
}, z.z.core.$strip>;
|
|
export declare const EventUnsubscribeRequestParamsSchema: z.ZodObject<{
|
|
subscriptionId: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const SubscriptionReadyRequestParamsSchema: z.ZodObject<{
|
|
subscriptionId: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const ValueGetRequestParamsSchema: z.ZodObject<{
|
|
valueName: z.ZodString;
|
|
params: z.ZodOptional<z.ZodUnknown>;
|
|
target: z.ZodOptional<z.ZodString>;
|
|
targetPackageName: z.ZodOptional<z.ZodString>;
|
|
callerStateContextId: z.ZodOptional<z.ZodString>;
|
|
stateContextId: z.ZodOptional<z.ZodString>;
|
|
contextNamespace: z.ZodOptional<z.ZodString>;
|
|
}, z.z.core.$strip>;
|
|
export declare const ValueWatchRequestParamsSchema: z.ZodObject<{
|
|
valueName: z.ZodString;
|
|
params: z.ZodOptional<z.ZodUnknown>;
|
|
subscriptionNamespace: z.ZodOptional<z.ZodString>;
|
|
target: z.ZodOptional<z.ZodString>;
|
|
targetPackageName: z.ZodOptional<z.ZodString>;
|
|
callerStateContextId: z.ZodOptional<z.ZodString>;
|
|
stateContextId: z.ZodOptional<z.ZodString>;
|
|
contextNamespace: z.ZodOptional<z.ZodString>;
|
|
}, z.z.core.$strip>;
|
|
export declare const ValueUnwatchRequestParamsSchema: z.ZodObject<{
|
|
subscriptionId: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const SubscriptionPublishRequestParamsSchema: z.ZodObject<{
|
|
subscriptionId: z.ZodString;
|
|
data: z.ZodUnknown;
|
|
}, z.z.core.$strip>;
|
|
export declare const SubscriptionResponseSchema: z.ZodObject<{
|
|
subscriptionId: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const SubscriptionDataMessageSchema: z.ZodObject<{
|
|
type: z.ZodLiteral<"subscription-data">;
|
|
subscriptionId: z.ZodString;
|
|
data: z.ZodUnknown;
|
|
}, z.z.core.$strip>;
|
|
export declare const ResponseOkMessageSchema: z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<true>;
|
|
result: z.ZodOptional<z.ZodUnknown>;
|
|
}, z.z.core.$strip>;
|
|
export declare const ResponseErrorMessageSchema: z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<false>;
|
|
error: z.ZodString;
|
|
}, z.z.core.$strip>;
|
|
export declare const ResponseMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<true>;
|
|
result: z.ZodOptional<z.ZodUnknown>;
|
|
}, z.z.core.$strip>, z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<false>;
|
|
error: z.ZodString;
|
|
}, z.z.core.$strip>]>;
|
|
export declare const ServerMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
type: z.ZodLiteral<"auth-ack">;
|
|
}, z.z.core.$strip>, z.ZodObject<{
|
|
type: z.ZodLiteral<"request">;
|
|
requestId: z.ZodString;
|
|
method: z.ZodEnum<{
|
|
stop: "stop";
|
|
call: "call";
|
|
boot: "boot";
|
|
"target-context-open": "target-context-open";
|
|
"runtime-error": "runtime-error";
|
|
"context-open": "context-open";
|
|
"context-close": "context-close";
|
|
"event-subscribe": "event-subscribe";
|
|
"subscription-ready": "subscription-ready";
|
|
"event-unsubscribe": "event-unsubscribe";
|
|
"value-get": "value-get";
|
|
"value-watch": "value-watch";
|
|
"value-unwatch": "value-unwatch";
|
|
"subscription-publish": "subscription-publish";
|
|
}>;
|
|
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
}, z.z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<true>;
|
|
result: z.ZodOptional<z.ZodUnknown>;
|
|
}, z.z.core.$strip>, z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<false>;
|
|
error: z.ZodString;
|
|
}, z.z.core.$strip>]>, z.ZodObject<{
|
|
type: z.ZodLiteral<"subscription-data">;
|
|
subscriptionId: z.ZodString;
|
|
data: z.ZodUnknown;
|
|
}, z.z.core.$strip>]>;
|
|
export declare const ClientMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
type: z.ZodLiteral<"auth">;
|
|
secret: z.ZodString;
|
|
pid: z.ZodOptional<z.ZodNumber>;
|
|
}, z.z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<true>;
|
|
result: z.ZodOptional<z.ZodUnknown>;
|
|
}, z.z.core.$strip>, z.ZodObject<{
|
|
type: z.ZodLiteral<"response">;
|
|
requestId: z.ZodString;
|
|
ok: z.ZodLiteral<false>;
|
|
error: z.ZodString;
|
|
}, z.z.core.$strip>]>, z.ZodObject<{
|
|
type: z.ZodLiteral<"request">;
|
|
requestId: z.ZodString;
|
|
method: z.ZodEnum<{
|
|
stop: "stop";
|
|
call: "call";
|
|
boot: "boot";
|
|
"target-context-open": "target-context-open";
|
|
"runtime-error": "runtime-error";
|
|
"context-open": "context-open";
|
|
"context-close": "context-close";
|
|
"event-subscribe": "event-subscribe";
|
|
"subscription-ready": "subscription-ready";
|
|
"event-unsubscribe": "event-unsubscribe";
|
|
"value-get": "value-get";
|
|
"value-watch": "value-watch";
|
|
"value-unwatch": "value-unwatch";
|
|
"subscription-publish": "subscription-publish";
|
|
}>;
|
|
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
}, z.z.core.$strip>]>;
|
|
export type AuthMessage = z.infer<typeof AuthMessageSchema>;
|
|
export type AuthAckMessage = z.infer<typeof AuthAckMessageSchema>;
|
|
export type RequestMessage = z.infer<typeof RequestMessageSchema>;
|
|
export type CallRequestParams = z.infer<typeof CallRequestParamsSchema>;
|
|
export type BootRequestParams = z.infer<typeof BootRequestParamsSchema>;
|
|
export type TargetContextOpenRequestParams = z.infer<typeof TargetContextOpenRequestParamsSchema>;
|
|
export type RuntimeErrorRequestParams = z.infer<typeof RuntimeErrorRequestParamsSchema>;
|
|
export type ContextOpenRequestParams = z.infer<typeof ContextOpenRequestParamsSchema>;
|
|
export type ContextCloseRequestParams = z.infer<typeof ContextCloseRequestParamsSchema>;
|
|
export type EventSubscribeRequestParams = z.infer<typeof EventSubscribeRequestParamsSchema>;
|
|
export type EventUnsubscribeRequestParams = z.infer<typeof EventUnsubscribeRequestParamsSchema>;
|
|
export type SubscriptionReadyRequestParams = z.infer<typeof SubscriptionReadyRequestParamsSchema>;
|
|
export type ValueGetRequestParams = z.infer<typeof ValueGetRequestParamsSchema>;
|
|
export type ValueWatchRequestParams = z.infer<typeof ValueWatchRequestParamsSchema>;
|
|
export type ValueUnwatchRequestParams = z.infer<typeof ValueUnwatchRequestParamsSchema>;
|
|
export type SubscriptionPublishRequestParams = z.infer<typeof SubscriptionPublishRequestParamsSchema>;
|
|
export type SubscriptionResponse = z.infer<typeof SubscriptionResponseSchema>;
|
|
export type SubscriptionDataMessage = z.infer<typeof SubscriptionDataMessageSchema>;
|
|
export type ResponseMessage = z.infer<typeof ResponseMessageSchema>;
|
|
export type ClientMessage = z.infer<typeof ClientMessageSchema>;
|
|
export type ServerMessage = z.infer<typeof ServerMessageSchema>;
|
|
type SocketLike = {
|
|
send: (data: string) => void;
|
|
};
|
|
export declare const sendMessage: <Message extends ClientMessage | ServerMessage>(socket: SocketLike, message: Message) => void;
|
|
export declare const sendClientMessage: (socket: SocketLike, message: ClientMessage) => void;
|
|
export declare const sendServerMessage: (socket: SocketLike, message: ServerMessage) => void;
|
|
export declare const parseJson: (value: string) => {
|
|
ok: true;
|
|
value: any;
|
|
} | {
|
|
ok: false;
|
|
value?: undefined;
|
|
};
|
|
export {};
|
|
//# sourceMappingURL=rpc.d.ts.map
|