@moeru/eventa 1.0.0-beta.1 → 1.0.0-beta.3
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.
- package/README.md +11 -0
- package/dist/adapters/broadcast-channel/index.d.mts +4 -2
- package/dist/adapters/broadcast-channel/index.mjs +2 -2
- package/dist/adapters/electron/main.d.mts +2 -2
- package/dist/adapters/electron/main.mjs +3 -3
- package/dist/adapters/electron/renderer.d.mts +2 -2
- package/dist/adapters/electron/renderer.mjs +3 -3
- package/dist/adapters/event-emitter/index.d.mts +4 -2
- package/dist/adapters/event-emitter/index.mjs +2 -2
- package/dist/adapters/event-target/index.d.mts +4 -2
- package/dist/adapters/event-target/index.mjs +2 -2
- package/dist/adapters/websocket/h3/index.d.mts +8 -8
- package/dist/adapters/websocket/h3/index.mjs +2 -2
- package/dist/adapters/websocket/index.d.mts +1 -1
- package/dist/adapters/websocket/native/index.d.mts +5 -5
- package/dist/adapters/websocket/native/index.mjs +2 -2
- package/dist/adapters/webworkers/index.d.mts +2 -2
- package/dist/adapters/webworkers/index.mjs +3 -3
- package/dist/adapters/webworkers/worker/index.d.mts +1 -1
- package/dist/adapters/webworkers/worker/index.mjs +3 -3
- package/dist/adapters/worker-threads/index.d.mts +2 -2
- package/dist/adapters/worker-threads/index.mjs +3 -3
- package/dist/adapters/worker-threads/worker/index.d.mts +1 -1
- package/dist/adapters/worker-threads/worker/index.mjs +3 -3
- package/dist/{context-ZVv99bcM.d.mts → context-BNM9nsGp.d.mts} +2 -2
- package/dist/{context-ex8urwfs.mjs → context-c10xPp3f.mjs} +11 -6
- package/dist/context-c10xPp3f.mjs.map +1 -0
- package/dist/eventa-M1FMVrH1.d.mts +106 -0
- package/dist/{index-CI_gUGXg.d.mts → index-giKJThn3.d.mts} +73 -61
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/{internal-De3z6hO5.mjs → internal-C-4X8bpL.mjs} +2 -2
- package/dist/{internal-De3z6hO5.mjs.map → internal-C-4X8bpL.mjs.map} +1 -1
- package/dist/{shared-DgX1R_nY.d.mts → shared-BcRXZZxh.d.mts} +4 -4
- package/dist/{shared-BZOulnwC.mjs → shared-DeDRsHPI.mjs} +2 -2
- package/dist/{shared-BZOulnwC.mjs.map → shared-DeDRsHPI.mjs.map} +1 -1
- package/dist/{shared-Cd4CLAdD.d.mts → shared-NFMSqOPw.d.mts} +4 -2
- package/dist/{shared-BdqIf6iZ.mjs → shared-eQ-hnVHv.mjs} +3 -3
- package/dist/{shared-BdqIf6iZ.mjs.map → shared-eQ-hnVHv.mjs.map} +1 -1
- package/dist/{src-DZ7si0kE.mjs → src-CTkYOGiO.mjs} +137 -114
- package/dist/src-CTkYOGiO.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/context-ex8urwfs.mjs.map +0 -1
- package/dist/eventa-AJyw28P8.d.mts +0 -52
- package/dist/src-DZ7si0kE.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as EventTag, r as Eventa } from "./eventa-
|
|
2
|
-
import { t as EventContext } from "./context-
|
|
1
|
+
import { n as EventTag, r as Eventa } from "./eventa-M1FMVrH1.mjs";
|
|
2
|
+
import { t as EventContext } from "./context-BNM9nsGp.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/invoke-shared.d.ts
|
|
5
5
|
declare enum InvokeEventType {
|
|
@@ -11,100 +11,112 @@ declare enum InvokeEventType {
|
|
|
11
11
|
ReceiveEventError = 5,
|
|
12
12
|
ReceiveEventStreamEnd = 6,
|
|
13
13
|
}
|
|
14
|
-
interface SendEvent<Res$1, Req$1 = undefined, _ = undefined, __ = undefined> extends Eventa<{
|
|
14
|
+
interface SendEvent<Res$1, Req$1 = undefined, _ = undefined, __ = undefined, M$1 = undefined, IM$1 = undefined> extends Eventa<{
|
|
15
15
|
invokeId: string;
|
|
16
16
|
content: Req$1;
|
|
17
17
|
isReqStream?: boolean;
|
|
18
|
-
}> {
|
|
18
|
+
}, M$1, IM$1> {
|
|
19
19
|
id: EventTag<Res$1, Req$1>;
|
|
20
20
|
invokeType: InvokeEventType.SendEvent;
|
|
21
21
|
}
|
|
22
|
-
interface SendEventError<Res$1, Req$1 = undefined, _ = undefined, ReqErr$1 = Error> extends Eventa<{
|
|
22
|
+
interface SendEventError<Res$1, Req$1 = undefined, _ = undefined, ReqErr$1 = Error, M$1 = undefined, IM$1 = undefined> extends Eventa<{
|
|
23
23
|
invokeId: string;
|
|
24
24
|
content: ReqErr$1;
|
|
25
|
-
}> {
|
|
25
|
+
}, M$1, IM$1> {
|
|
26
26
|
id: EventTag<Res$1, Req$1>;
|
|
27
27
|
invokeType: InvokeEventType.SendEventError;
|
|
28
28
|
}
|
|
29
|
-
interface SendEventStreamEnd<Res$1, Req$1 = undefined, _ = undefined, __ = undefined> extends Eventa<{
|
|
29
|
+
interface SendEventStreamEnd<Res$1, Req$1 = undefined, _ = undefined, __ = undefined, M$1 = undefined, IM$1 = undefined> extends Eventa<{
|
|
30
30
|
invokeId: string;
|
|
31
31
|
content: undefined;
|
|
32
|
-
}> {
|
|
32
|
+
}, M$1, IM$1> {
|
|
33
33
|
id: EventTag<Res$1, Req$1>;
|
|
34
34
|
invokeType: InvokeEventType.SendEventStreamEnd;
|
|
35
35
|
}
|
|
36
|
-
interface SendEventAbort<Res$1, Req$1 = undefined, _ = undefined, __ = undefined> extends Eventa<{
|
|
36
|
+
interface SendEventAbort<Res$1, Req$1 = undefined, _ = undefined, __ = undefined, M$1 = undefined, IM$1 = undefined> extends Eventa<{
|
|
37
37
|
invokeId: string;
|
|
38
38
|
content?: unknown;
|
|
39
|
-
}> {
|
|
39
|
+
}, M$1, IM$1> {
|
|
40
40
|
id: EventTag<Res$1, Req$1>;
|
|
41
41
|
invokeType: InvokeEventType.SendEventAbort;
|
|
42
42
|
}
|
|
43
|
-
interface ReceiveEvent<Res$1, Req$1 = undefined, _ = undefined, __ = undefined> extends Eventa<{
|
|
43
|
+
interface ReceiveEvent<Res$1, Req$1 = undefined, _ = undefined, __ = undefined, M$1 = undefined, IM$1 = undefined> extends Eventa<{
|
|
44
44
|
invokeId: string;
|
|
45
45
|
content: Res$1;
|
|
46
|
-
}> {
|
|
46
|
+
}, M$1, IM$1> {
|
|
47
47
|
id: EventTag<Res$1, Req$1>;
|
|
48
48
|
invokeType: InvokeEventType.ReceiveEvent;
|
|
49
49
|
}
|
|
50
|
-
interface ReceiveEventError<Res$1, Req$1 = undefined, ResErr$1 = undefined, _ = undefined> extends Eventa<{
|
|
50
|
+
interface ReceiveEventError<Res$1, Req$1 = undefined, ResErr$1 = undefined, _ = undefined, M$1 = undefined, IM$1 = undefined> extends Eventa<{
|
|
51
51
|
invokeId: string;
|
|
52
52
|
content: {
|
|
53
53
|
error: ResErr$1;
|
|
54
54
|
};
|
|
55
|
-
}> {
|
|
55
|
+
}, M$1, IM$1> {
|
|
56
56
|
id: EventTag<Res$1, Req$1>;
|
|
57
57
|
invokeType: InvokeEventType.ReceiveEventError;
|
|
58
58
|
}
|
|
59
|
-
interface ReceiveEventStreamEnd<Res$1, Req$1 = undefined, _ = undefined, __ = undefined> extends Eventa<{
|
|
59
|
+
interface ReceiveEventStreamEnd<Res$1, Req$1 = undefined, _ = undefined, __ = undefined, M$1 = undefined, IM$1 = undefined> extends Eventa<{
|
|
60
60
|
invokeId: string;
|
|
61
61
|
content: undefined;
|
|
62
|
-
}> {
|
|
62
|
+
}, M$1, IM$1> {
|
|
63
63
|
id: EventTag<Res$1, Req$1>;
|
|
64
64
|
invokeType: InvokeEventType.ReceiveEventStreamEnd;
|
|
65
65
|
}
|
|
66
|
-
interface InvokeEventa<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error> {
|
|
67
|
-
sendEvent: SendEvent<Res$1, Req$1, ResErr$1, ReqErr$1>;
|
|
68
|
-
sendEventError: SendEventError<Res$1, Req$1, ResErr$1, ReqErr$1>;
|
|
69
|
-
sendEventStreamEnd: SendEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1>;
|
|
70
|
-
sendEventAbort: SendEventAbort<Res$1, Req$1, ResErr$1, ReqErr$1>;
|
|
71
|
-
receiveEvent: ReceiveEvent<Res$1, Req$1, ResErr$1, ReqErr$1>;
|
|
72
|
-
receiveEventError: ReceiveEventError<Res$1, Req$1, ResErr$1, ReqErr$1>;
|
|
73
|
-
receiveEventStreamEnd: ReceiveEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1>;
|
|
66
|
+
interface InvokeEventa<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error, M$1 = undefined, IM$1 = undefined> {
|
|
67
|
+
sendEvent: SendEvent<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
68
|
+
sendEventError: SendEventError<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
69
|
+
sendEventStreamEnd: SendEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
70
|
+
sendEventAbort: SendEventAbort<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
71
|
+
receiveEvent: ReceiveEvent<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
72
|
+
receiveEventError: ReceiveEventError<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
73
|
+
receiveEventStreamEnd: ReceiveEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
74
|
+
}
|
|
75
|
+
interface InvokeHandlerEventa<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error, M$1 = undefined, _IM = undefined> extends InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined> {
|
|
76
|
+
sendEvent: SendEvent<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined>;
|
|
77
|
+
sendEventError: SendEventError<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined>;
|
|
78
|
+
sendEventStreamEnd: SendEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined>;
|
|
79
|
+
sendEventAbort: SendEventAbort<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined>;
|
|
80
|
+
receiveEvent: ReceiveEvent<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined>;
|
|
81
|
+
receiveEventError: ReceiveEventError<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined>;
|
|
82
|
+
receiveEventStreamEnd: ReceiveEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, undefined>;
|
|
74
83
|
}
|
|
75
84
|
type InferSendEvent<T> = T extends {
|
|
76
|
-
sendEvent: SendEvent<infer Res, infer Req, infer ResErr, infer ReqErr>;
|
|
77
|
-
} ? SendEvent<Res, Req, ResErr, ReqErr> : never;
|
|
85
|
+
sendEvent: SendEvent<infer Res, infer Req, infer ResErr, infer ReqErr, infer M, infer IM>;
|
|
86
|
+
} ? SendEvent<Res, Req, ResErr, ReqErr, M, IM> : never;
|
|
78
87
|
type InferSendEventError<T> = T extends {
|
|
79
|
-
sendEventError: SendEventError<infer Res, infer Req, infer ResErr, infer ReqErr>;
|
|
80
|
-
} ? SendEventError<Res, Req, ResErr, ReqErr> : never;
|
|
88
|
+
sendEventError: SendEventError<infer Res, infer Req, infer ResErr, infer ReqErr, infer M, infer IM>;
|
|
89
|
+
} ? SendEventError<Res, Req, ResErr, ReqErr, M, IM> : never;
|
|
81
90
|
type InferSendEventStreamEnd<T> = T extends {
|
|
82
|
-
sendEventStreamEnd: SendEventStreamEnd<infer Res, infer Req, infer ResErr, infer ReqErr>;
|
|
83
|
-
} ? SendEventStreamEnd<Res, Req, ResErr, ReqErr> : never;
|
|
91
|
+
sendEventStreamEnd: SendEventStreamEnd<infer Res, infer Req, infer ResErr, infer ReqErr, infer M, infer IM>;
|
|
92
|
+
} ? SendEventStreamEnd<Res, Req, ResErr, ReqErr, M, IM> : never;
|
|
84
93
|
type InferSendEventAbort<T> = T extends {
|
|
85
|
-
sendEventAbort: SendEventAbort<infer Res, infer Req, infer ResErr, infer ReqErr>;
|
|
86
|
-
} ? SendEventAbort<Res, Req, ResErr, ReqErr> : never;
|
|
94
|
+
sendEventAbort: SendEventAbort<infer Res, infer Req, infer ResErr, infer ReqErr, infer M, infer IM>;
|
|
95
|
+
} ? SendEventAbort<Res, Req, ResErr, ReqErr, M, IM> : never;
|
|
87
96
|
type InferReceiveEvent<T> = T extends {
|
|
88
|
-
receiveEvent: ReceiveEvent<infer Res, infer Req, infer ResErr, infer ReqErr>;
|
|
89
|
-
} ? ReceiveEvent<Res, Req, ResErr, ReqErr> : never;
|
|
97
|
+
receiveEvent: ReceiveEvent<infer Res, infer Req, infer ResErr, infer ReqErr, infer M, infer IM>;
|
|
98
|
+
} ? ReceiveEvent<Res, Req, ResErr, ReqErr, M, IM> : never;
|
|
90
99
|
type InferReceiveEventError<T> = T extends {
|
|
91
|
-
receiveEventError: ReceiveEventError<infer Res, infer Req, infer ResErr, infer ReqErr>;
|
|
92
|
-
} ? ReceiveEventError<Res, Req, ResErr, ReqErr> : never;
|
|
100
|
+
receiveEventError: ReceiveEventError<infer Res, infer Req, infer ResErr, infer ReqErr, infer M, infer IM>;
|
|
101
|
+
} ? ReceiveEventError<Res, Req, ResErr, ReqErr, M, IM> : never;
|
|
93
102
|
type InferReceiveEventStreamEnd<T> = T extends {
|
|
94
|
-
receiveEventStreamEnd: ReceiveEventStreamEnd<infer Res, infer Req, infer ResErr, infer ReqErr>;
|
|
95
|
-
} ? ReceiveEventStreamEnd<Res, Req, ResErr, ReqErr> : never;
|
|
96
|
-
declare function defineInvokeEventa<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error>(tag?: string
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
receiveEventStreamEnd: ReceiveEventStreamEnd<infer Res, infer Req, infer ResErr, infer ReqErr, infer M, infer IM>;
|
|
104
|
+
} ? ReceiveEventStreamEnd<Res, Req, ResErr, ReqErr, M, IM> : never;
|
|
105
|
+
declare function defineInvokeEventa<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error, M$1 = undefined, IM$1 = undefined>(tag?: string, options?: {
|
|
106
|
+
metadata?: M$1;
|
|
107
|
+
invokeMetadata?: IM$1;
|
|
108
|
+
}): {
|
|
109
|
+
sendEvent: SendEvent<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
110
|
+
sendEventError: SendEventError<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
111
|
+
sendEventStreamEnd: SendEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
112
|
+
sendEventAbort: SendEventAbort<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
113
|
+
receiveEvent: ReceiveEvent<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
114
|
+
receiveEventError: ReceiveEventError<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
115
|
+
receiveEventStreamEnd: ReceiveEventStreamEnd<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>;
|
|
104
116
|
};
|
|
105
|
-
declare function isInvokeEventa(event: Eventa<any>): event is SendEvent<any, any, any, any> | SendEventError<any, any, any, any> | SendEventStreamEnd<any, any, any, any> | ReceiveEvent<any, any, any, any> | ReceiveEventError<any, any, any, any> | ReceiveEventStreamEnd<any, any, any, any> | SendEventAbort<any, any, any, any>;
|
|
106
|
-
declare function isSendEvent(event: Eventa<any>): event is SendEvent<any, any, any, any> | SendEventError<any, any, any, any> | SendEventStreamEnd<any, any, any, any> | SendEventAbort<any, any, any, any>;
|
|
107
|
-
declare function isReceiveEvent(event: Eventa<any>): event is ReceiveEvent<any, any, any, any> | ReceiveEventError<any, any, any, any> | ReceiveEventStreamEnd<any, any, any, any>;
|
|
117
|
+
declare function isInvokeEventa(event: Eventa<any>): event is SendEvent<any, any, any, any, any, any> | SendEventError<any, any, any, any, any, any> | SendEventStreamEnd<any, any, any, any, any, any> | ReceiveEvent<any, any, any, any, any, any> | ReceiveEventError<any, any, any, any, any, any> | ReceiveEventStreamEnd<any, any, any, any, any, any> | SendEventAbort<any, any, any, any, any, any>;
|
|
118
|
+
declare function isSendEvent(event: Eventa<any>): event is SendEvent<any, any, any, any, any, any> | SendEventError<any, any, any, any, any, any> | SendEventStreamEnd<any, any, any, any, any, any> | SendEventAbort<any, any, any, any, any, any>;
|
|
119
|
+
declare function isReceiveEvent(event: Eventa<any>): event is ReceiveEvent<any, any, any, any, any, any> | ReceiveEventError<any, any, any, any, any, any> | ReceiveEventStreamEnd<any, any, any, any, any, any>;
|
|
108
120
|
//#endregion
|
|
109
121
|
//#region src/invoke.d.ts
|
|
110
122
|
type IsInvokeRequestOptional<EC extends EventContext<any, any>> = EC extends EventContext<infer E, any> ? E extends {
|
|
@@ -149,14 +161,14 @@ declare function isExtendableInvokeResponseLike<Res$1, EC extends EventContext<a
|
|
|
149
161
|
type Handler<Res$1, Req$1 = any, EC extends EventContext<any, any> = EventContext<any, any>, RawEventOptions = unknown> = (payload: Req$1, options?: {
|
|
150
162
|
abortController?: AbortController;
|
|
151
163
|
} & RawEventOptions) => ExtendableInvokeResponse<Res$1, EC>;
|
|
152
|
-
interface InternalInvokeHandler<Res$1, Req$1 = any, ResErr$1 = Error, ReqErr$1 = Error, EO = any> {
|
|
153
|
-
onSend: (params: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1>['sendEvent'], eventOptions?: EO) => void;
|
|
154
|
-
onSendStreamEnd: (params: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1>['sendEventStreamEnd'], eventOptions?: EO) => void;
|
|
155
|
-
onSendAbort: (params: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1>['sendEventAbort'], eventOptions?: EO) => void;
|
|
164
|
+
interface InternalInvokeHandler<Res$1, Req$1 = any, ResErr$1 = Error, ReqErr$1 = Error, EO = any, M$1 = undefined, IM$1 = undefined> {
|
|
165
|
+
onSend: (params: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>['sendEvent'], eventOptions?: EO) => void;
|
|
166
|
+
onSendStreamEnd: (params: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>['sendEventStreamEnd'], eventOptions?: EO) => void;
|
|
167
|
+
onSendAbort: (params: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>['sendEventAbort'], eventOptions?: EO) => void;
|
|
156
168
|
}
|
|
157
|
-
type HandlerMap<EventMap extends Record<string, InvokeEventa<any, any, any, any>>, EO = any, EC extends EventContext<any, any> = EventContext<any, any>> = { [K in keyof EventMap]: EventMap[K] extends InvokeEventa<infer Res, infer Req, any, any> ? Handler<Res, Req, EC, EO> : never };
|
|
169
|
+
type HandlerMap<EventMap extends Record<string, InvokeEventa<any, any, any, any, any, any>>, EO = any, EC extends EventContext<any, any> = EventContext<any, any>> = { [K in keyof EventMap]: EventMap[K] extends InvokeEventa<infer Res, infer Req, any, any, any, any> ? Handler<Res, Req, EC, EO> : never };
|
|
158
170
|
interface InvocableEventContext<E$1, EO> extends EventContext<E$1, EO> {
|
|
159
|
-
invokeHandlers?: Map<string, Map<Handler<any>, InternalInvokeHandler<any>>>;
|
|
171
|
+
invokeHandlers?: Map<string, Map<Handler<any>, InternalInvokeHandler<any, any, any, any, any, any, any>>>;
|
|
160
172
|
}
|
|
161
173
|
/**
|
|
162
174
|
* Create a unary invoke function (client side).
|
|
@@ -208,7 +220,7 @@ interface InvocableEventContext<E$1, EO> extends EventContext<E$1, EO> {
|
|
|
208
220
|
* @param ctx Event context on the caller/client side.
|
|
209
221
|
* @param event Invoke event definition created by `defineInvokeEventa`.
|
|
210
222
|
*/
|
|
211
|
-
declare function defineInvoke<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error, CtxExt = any, EOpts = any, ECtx extends EventContext<CtxExt, EOpts> = EventContext<CtxExt, EOpts>>(ctx: ECtx | (() => ECtx | Promise<ECtx>), event: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1>): InvokeFunction<Res$1, Req$1, ECtx>;
|
|
223
|
+
declare function defineInvoke<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error, M$1 = undefined, IM$1 = undefined, CtxExt = any, EOpts = any, ECtx extends EventContext<CtxExt, EOpts> = EventContext<CtxExt, EOpts>>(ctx: ECtx | (() => ECtx | Promise<ECtx>), event: InvokeEventa<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>): InvokeFunction<Res$1, Req$1, ECtx>;
|
|
212
224
|
/**
|
|
213
225
|
* Create a map of invoke functions from a map of invoke events (client side).
|
|
214
226
|
*
|
|
@@ -226,7 +238,7 @@ declare function defineInvoke<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr
|
|
|
226
238
|
* @param ctx Event context on the caller/client side.
|
|
227
239
|
* @param events Map of invoke events created by `defineInvokeEventa`.
|
|
228
240
|
*/
|
|
229
|
-
declare function defineInvokes<EK extends string, EventMap extends Record<EK, InvokeEventa<any, any, any, any>>, CtxExt = any, EOpts = any, ECtx extends EventContext<CtxExt, EOpts> = EventContext<CtxExt, EOpts>>(ctx: ECtx | (() => ECtx | Promise<ECtx>), events: EventMap): InvokeFunctionMap<EventMap, ECtx>;
|
|
241
|
+
declare function defineInvokes<EK extends string, EventMap extends Record<EK, InvokeEventa<any, any, any, any, any, any>>, CtxExt = any, EOpts = any, ECtx extends EventContext<CtxExt, EOpts> = EventContext<CtxExt, EOpts>>(ctx: ECtx | (() => ECtx | Promise<ECtx>), events: EventMap): InvokeFunctionMap<EventMap, ECtx>;
|
|
230
242
|
/**
|
|
231
243
|
* Define a unary invoke handler (server side).
|
|
232
244
|
*
|
|
@@ -246,9 +258,9 @@ declare function defineInvokes<EK extends string, EventMap extends Record<EK, In
|
|
|
246
258
|
* @param event Invoke event definition created by `defineInvokeEventa`.
|
|
247
259
|
* @param handler Handler that returns a response (or response + metadata).
|
|
248
260
|
*/
|
|
249
|
-
declare function defineInvokeHandler<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error, CtxExt = any, EOpts extends {
|
|
261
|
+
declare function defineInvokeHandler<Res$1, Req$1 = undefined, ResErr$1 = Error, ReqErr$1 = Error, M$1 = undefined, IM$1 = undefined, CtxExt = any, EOpts extends {
|
|
250
262
|
raw?: any;
|
|
251
|
-
} = any>(ctx: InvocableEventContext<CtxExt, EOpts>, event:
|
|
263
|
+
} = any>(ctx: InvocableEventContext<CtxExt, EOpts>, event: InvokeHandlerEventa<Res$1, Req$1, ResErr$1, ReqErr$1, M$1, IM$1>, handler: Handler<Res$1, Req$1, InvocableEventContext<CtxExt, EOpts>, EOpts>): () => void;
|
|
252
264
|
/**
|
|
253
265
|
* Define multiple invoke handlers in batch (server side).
|
|
254
266
|
*
|
|
@@ -518,5 +530,5 @@ declare function createUntil<T>(options?: {
|
|
|
518
530
|
handler: (value: T) => void;
|
|
519
531
|
};
|
|
520
532
|
//#endregion
|
|
521
|
-
export {
|
|
522
|
-
//# sourceMappingURL=index-
|
|
533
|
+
export { isReceiveEvent as $, defineInvokeHandlers as A, InferSendEventStreamEnd as B, Handler as C, InvokeFunctionMap as D, InvokeFunction as E, InferReceiveEventError as F, ReceiveEventError as G, InvokeEventa as H, InferReceiveEventStreamEnd as I, SendEventAbort as J, ReceiveEventStreamEnd as K, InferSendEvent as L, isExtendableInvokeResponseLike as M, undefineInvokeHandler as N, defineInvoke as O, InferReceiveEvent as P, isInvokeEventa as Q, InferSendEventAbort as R, ExtractInvokeResponseOptions as S, InvocableEventContext as T, InvokeHandlerEventa as U, InvokeEventType as V, ReceiveEvent as W, SendEventStreamEnd as X, SendEventError as Y, defineInvokeEventa as Z, withRemoteMethods as _, isAbortError as a, ExtendableInvokeResponse as b, randomBetween as c, toStreamHandler as d, isSendEvent as et, InvokeFunctionStubOptions as f, createRemoteMethodTagPrefix as g, RemoteInvokeResult as h, createUntilTriggeredOnce as i, defineInvokes as j, defineInvokeHandler as k, defineStreamInvoke as l, RemoteInvokeOptions as m, createUntil as n, isAsyncIterable as o, RemoteInvokeFunction as p, SendEvent as q, createUntilTriggered as r, isReadableStream as s, createAbortError as t, defineStreamInvokeHandler as u, WithTransfer as v, HandlerMap as w, ExtractInvokeRequestOptions as x, withTransfer as y, InferSendEventError as z };
|
|
534
|
+
//# sourceMappingURL=index-giKJThn3.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as nanoid, a as EventaLike, c as InboundEventa, d as OutboundEventa, f as and, g as matchBy, h as defineOutboundEventa, i as EventaFlowDirection, l as InferEventaPayload, m as defineInboundEventa, n as EventTag, o as EventaMatchExpression, p as defineEventa, r as Eventa, s as EventaType, t as DirectionalEventa, u as InvokeEventConstraint, v as or } from "./eventa-
|
|
2
|
-
import { n as EventContextEmitFn, r as createContext, t as EventContext } from "./context-
|
|
3
|
-
import { $ as
|
|
4
|
-
export { DirectionalEventa, EventContext, EventContextEmitFn, EventTag, Eventa, EventaFlowDirection, EventaLike, EventaMatchExpression, EventaType, ExtendableInvokeResponse, ExtractInvokeRequestOptions, ExtractInvokeResponseOptions, Handler, HandlerMap, InboundEventa, InferEventaPayload, InferReceiveEvent, InferReceiveEventError, InferReceiveEventStreamEnd, InferSendEvent, InferSendEventAbort, InferSendEventError, InferSendEventStreamEnd, InvocableEventContext, InvokeEventConstraint, InvokeEventType, InvokeEventa, InvokeFunction, InvokeFunctionMap, InvokeFunctionStubOptions, OutboundEventa, ReceiveEvent, ReceiveEventError, ReceiveEventStreamEnd, RemoteInvokeFunction, RemoteInvokeOptions, RemoteInvokeResult, SendEvent, SendEventAbort, SendEventError, SendEventStreamEnd, WithTransfer, and, createAbortError, createContext, createRemoteMethodTagPrefix, createUntil, createUntilTriggered, createUntilTriggeredOnce, defineEventa, defineInboundEventa, defineInvoke, defineInvokeEventa, defineInvokeHandler, defineInvokeHandlers, defineInvokes, defineOutboundEventa, defineStreamInvoke, defineStreamInvokeHandler, isAbortError, isAsyncIterable, isExtendableInvokeResponseLike, isInvokeEventa, isReadableStream, isReceiveEvent, isSendEvent, matchBy, nanoid, or, randomBetween, toStreamHandler, undefineInvokeHandler, withRemoteMethods, withTransfer };
|
|
1
|
+
import { _ as nanoid, a as EventaLike, c as InboundEventa, d as OutboundEventa, f as and, g as matchBy, h as defineOutboundEventa, i as EventaFlowDirection, l as InferEventaPayload, m as defineInboundEventa, n as EventTag, o as EventaMatchExpression, p as defineEventa, r as Eventa, s as EventaType, t as DirectionalEventa, u as InvokeEventConstraint, v as or } from "./eventa-M1FMVrH1.mjs";
|
|
2
|
+
import { n as EventContextEmitFn, r as createContext, t as EventContext } from "./context-BNM9nsGp.mjs";
|
|
3
|
+
import { $ as isReceiveEvent, A as defineInvokeHandlers, B as InferSendEventStreamEnd, C as Handler, D as InvokeFunctionMap, E as InvokeFunction, F as InferReceiveEventError, G as ReceiveEventError, H as InvokeEventa, I as InferReceiveEventStreamEnd, J as SendEventAbort, K as ReceiveEventStreamEnd, L as InferSendEvent, M as isExtendableInvokeResponseLike, N as undefineInvokeHandler, O as defineInvoke, P as InferReceiveEvent, Q as isInvokeEventa, R as InferSendEventAbort, S as ExtractInvokeResponseOptions, T as InvocableEventContext, U as InvokeHandlerEventa, V as InvokeEventType, W as ReceiveEvent, X as SendEventStreamEnd, Y as SendEventError, Z as defineInvokeEventa, _ as withRemoteMethods, a as isAbortError, b as ExtendableInvokeResponse, c as randomBetween, d as toStreamHandler, et as isSendEvent, f as InvokeFunctionStubOptions, g as createRemoteMethodTagPrefix, h as RemoteInvokeResult, i as createUntilTriggeredOnce, j as defineInvokes, k as defineInvokeHandler, l as defineStreamInvoke, m as RemoteInvokeOptions, n as createUntil, o as isAsyncIterable, p as RemoteInvokeFunction, q as SendEvent, r as createUntilTriggered, s as isReadableStream, t as createAbortError, u as defineStreamInvokeHandler, v as WithTransfer, w as HandlerMap, x as ExtractInvokeRequestOptions, y as withTransfer, z as InferSendEventError } from "./index-giKJThn3.mjs";
|
|
4
|
+
export { DirectionalEventa, EventContext, EventContextEmitFn, EventTag, Eventa, EventaFlowDirection, EventaLike, EventaMatchExpression, EventaType, ExtendableInvokeResponse, ExtractInvokeRequestOptions, ExtractInvokeResponseOptions, Handler, HandlerMap, InboundEventa, InferEventaPayload, InferReceiveEvent, InferReceiveEventError, InferReceiveEventStreamEnd, InferSendEvent, InferSendEventAbort, InferSendEventError, InferSendEventStreamEnd, InvocableEventContext, InvokeEventConstraint, InvokeEventType, InvokeEventa, InvokeFunction, InvokeFunctionMap, InvokeFunctionStubOptions, InvokeHandlerEventa, OutboundEventa, ReceiveEvent, ReceiveEventError, ReceiveEventStreamEnd, RemoteInvokeFunction, RemoteInvokeOptions, RemoteInvokeResult, SendEvent, SendEventAbort, SendEventError, SendEventStreamEnd, WithTransfer, and, createAbortError, createContext, createRemoteMethodTagPrefix, createUntil, createUntilTriggered, createUntilTriggeredOnce, defineEventa, defineInboundEventa, defineInvoke, defineInvokeEventa, defineInvokeHandler, defineInvokeHandlers, defineInvokes, defineOutboundEventa, defineStreamInvoke, defineStreamInvokeHandler, isAbortError, isAsyncIterable, isExtendableInvokeResponseLike, isInvokeEventa, isReadableStream, isReceiveEvent, isSendEvent, matchBy, nanoid, or, randomBetween, toStreamHandler, undefineInvokeHandler, withRemoteMethods, withTransfer };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineEventa, c as matchBy, i as and, l as nanoid, n as EventaFlowDirection, o as defineInboundEventa, r as EventaType, s as defineOutboundEventa, t as createContext, u as or } from "./context-
|
|
2
|
-
import { C as isInvokeEventa, S as defineInvokeEventa, T as isSendEvent, _ as isAbortError, a as withRemoteMethods, b as randomBetween, c as defineInvokeHandler, d as isExtendableInvokeResponseLike, f as undefineInvokeHandler, g as createUntilTriggeredOnce, h as createUntilTriggered, i as createRemoteMethodTagPrefix, l as defineInvokeHandlers, m as createUntil, n as defineStreamInvokeHandler, o as withTransfer, p as createAbortError, r as toStreamHandler, s as defineInvoke, t as defineStreamInvoke, u as defineInvokes, v as isAsyncIterable, w as isReceiveEvent, x as InvokeEventType, y as isReadableStream } from "./src-
|
|
1
|
+
import { a as defineEventa, c as matchBy, i as and, l as nanoid, n as EventaFlowDirection, o as defineInboundEventa, r as EventaType, s as defineOutboundEventa, t as createContext, u as or } from "./context-c10xPp3f.mjs";
|
|
2
|
+
import { C as isInvokeEventa, S as defineInvokeEventa, T as isSendEvent, _ as isAbortError, a as withRemoteMethods, b as randomBetween, c as defineInvokeHandler, d as isExtendableInvokeResponseLike, f as undefineInvokeHandler, g as createUntilTriggeredOnce, h as createUntilTriggered, i as createRemoteMethodTagPrefix, l as defineInvokeHandlers, m as createUntil, n as defineStreamInvokeHandler, o as withTransfer, p as createAbortError, r as toStreamHandler, s as defineInvoke, t as defineStreamInvoke, u as defineInvokes, v as isAsyncIterable, w as isReceiveEvent, x as InvokeEventType, y as isReadableStream } from "./src-CTkYOGiO.mjs";
|
|
3
3
|
|
|
4
4
|
export { EventaFlowDirection, EventaType, InvokeEventType, and, createAbortError, createContext, createRemoteMethodTagPrefix, createUntil, createUntilTriggered, createUntilTriggeredOnce, defineEventa, defineInboundEventa, defineInvoke, defineInvokeEventa, defineInvokeHandler, defineInvokeHandlers, defineInvokes, defineOutboundEventa, defineStreamInvoke, defineStreamInvokeHandler, isAbortError, isAsyncIterable, isExtendableInvokeResponseLike, isInvokeEventa, isReadableStream, isReceiveEvent, isSendEvent, matchBy, nanoid, or, randomBetween, toStreamHandler, undefineInvokeHandler, withRemoteMethods, withTransfer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as nanoid } from "./context-
|
|
1
|
+
import { l as nanoid } from "./context-c10xPp3f.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/websocket/internal.ts
|
|
4
4
|
function generateWebsocketPayload(type, payload) {
|
|
@@ -15,4 +15,4 @@ function parseWebsocketPayload(data) {
|
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
export { parseWebsocketPayload as n, generateWebsocketPayload as t };
|
|
18
|
-
//# sourceMappingURL=internal-
|
|
18
|
+
//# sourceMappingURL=internal-C-4X8bpL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-
|
|
1
|
+
{"version":3,"file":"internal-C-4X8bpL.mjs","names":[],"sources":["../src/adapters/websocket/internal.ts"],"sourcesContent":["import type { EventTag } from '../../eventa'\nimport type { WebsocketPayload } from './shared'\n\nimport { nanoid } from '../../eventa'\n\nexport function generateWebsocketPayload<T>(type: EventTag<any, any>, payload: T): WebsocketPayload<T> {\n return {\n id: nanoid(),\n type,\n payload,\n timestamp: Date.now(),\n }\n}\n\nexport function parseWebsocketPayload<T>(data: string): WebsocketPayload<T> {\n return JSON.parse(data) as WebsocketPayload<T>\n}\n"],"mappings":";;;AAKA,SAAgB,yBAA4B,MAA0B,SAAiC;AACrG,QAAO;EACL,IAAI,QAAQ;EACZ;EACA;EACA,WAAW,KAAK,KAAK;EACtB;;AAGH,SAAgB,sBAAyB,MAAmC;AAC1E,QAAO,KAAK,MAAM,KAAK"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as EventTag, r as Eventa } from "./eventa-
|
|
1
|
+
import { n as EventTag, r as Eventa } from "./eventa-M1FMVrH1.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/webworkers/shared.d.ts
|
|
4
4
|
interface WorkerPayload<T> {
|
|
@@ -18,11 +18,11 @@ declare function defineOutboundWorkerEventa<T>(id?: string): WorkerEventa<T>;
|
|
|
18
18
|
declare function isWorkerEventa(event: Eventa<any>): event is WorkerEventa<any>;
|
|
19
19
|
declare const workerErrorEvent: Eventa<{
|
|
20
20
|
error: unknown;
|
|
21
|
-
}>;
|
|
21
|
+
}, undefined, undefined>;
|
|
22
22
|
declare const workerMessageErrorEvent: Eventa<{
|
|
23
23
|
error: unknown;
|
|
24
24
|
message: any;
|
|
25
|
-
}>;
|
|
25
|
+
}, undefined, undefined>;
|
|
26
26
|
declare function normalizeOnListenerParameters(event: Eventa<any>, options?: {
|
|
27
27
|
transfer?: Transferable[];
|
|
28
28
|
} | unknown): {
|
|
@@ -31,4 +31,4 @@ declare function normalizeOnListenerParameters(event: Eventa<any>, options?: {
|
|
|
31
31
|
};
|
|
32
32
|
//#endregion
|
|
33
33
|
export { isWorkerEventa as a, workerMessageErrorEvent as c, defineWorkerEventa as i, WorkerPayload as n, normalizeOnListenerParameters as o, defineOutboundWorkerEventa as r, workerErrorEvent as s, WorkerEventa as t };
|
|
34
|
-
//# sourceMappingURL=shared-
|
|
34
|
+
//# sourceMappingURL=shared-BcRXZZxh.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineEventa, l as nanoid } from "./context-
|
|
1
|
+
import { a as defineEventa, l as nanoid } from "./context-c10xPp3f.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/electron/internal.ts
|
|
4
4
|
function generatePayload(type, payload) {
|
|
@@ -18,4 +18,4 @@ const errorEvent = { ...defineEventa() };
|
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
export { generatePayload as n, parsePayload as r, errorEvent as t };
|
|
21
|
-
//# sourceMappingURL=shared-
|
|
21
|
+
//# sourceMappingURL=shared-DeDRsHPI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-
|
|
1
|
+
{"version":3,"file":"shared-DeDRsHPI.mjs","names":[],"sources":["../src/adapters/electron/internal.ts","../src/adapters/electron/shared.ts"],"sourcesContent":["import type { EventTag } from '../..'\nimport type { Payload as CustomEventDetailDetail } from './shared'\n\nimport { nanoid } from '../..'\n\nexport function generatePayload<T>(type: EventTag<any, any>, payload: T): CustomEventDetailDetail<T> {\n return {\n id: nanoid(),\n type,\n payload,\n }\n}\n\nexport function parsePayload<T>(data: unknown): CustomEventDetailDetail<T> {\n return data as CustomEventDetailDetail<T>\n}\n","import type { EventTag } from '../../eventa'\n\nimport { defineEventa } from '../../eventa'\n\nexport interface Payload<T> {\n id: string\n type: EventTag<any, any>\n payload: T\n}\n\nexport const errorEvent = { ...defineEventa<{ error: unknown }>() }\n"],"mappings":";;;AAKA,SAAgB,gBAAmB,MAA0B,SAAwC;AACnG,QAAO;EACL,IAAI,QAAQ;EACZ;EACA;EACD;;AAGH,SAAgB,aAAgB,MAA2C;AACzE,QAAO;;;;;ACJT,MAAa,aAAa,EAAE,GAAG,cAAkC,EAAE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as EventTag, s as EventaType } from "./eventa-
|
|
1
|
+
import { n as EventTag, s as EventaType } from "./eventa-M1FMVrH1.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/electron/shared.d.ts
|
|
4
4
|
interface Payload<T> {
|
|
@@ -10,9 +10,11 @@ declare const errorEvent: {
|
|
|
10
10
|
body?: {
|
|
11
11
|
error: unknown;
|
|
12
12
|
} | undefined;
|
|
13
|
+
metadata?: undefined;
|
|
14
|
+
invokeMetadata?: undefined;
|
|
13
15
|
id: string;
|
|
14
16
|
type?: EventaType.Event | undefined;
|
|
15
17
|
};
|
|
16
18
|
//#endregion
|
|
17
19
|
export { errorEvent as n, Payload as t };
|
|
18
|
-
//# sourceMappingURL=shared-
|
|
20
|
+
//# sourceMappingURL=shared-NFMSqOPw.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as defineEventa, l as nanoid, s as defineOutboundEventa } from "./context-
|
|
2
|
-
import { d as isExtendableInvokeResponseLike } from "./src-
|
|
1
|
+
import { a as defineEventa, l as nanoid, s as defineOutboundEventa } from "./context-c10xPp3f.mjs";
|
|
2
|
+
import { d as isExtendableInvokeResponseLike } from "./src-CTkYOGiO.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/webworkers/internal.ts
|
|
5
5
|
function generateWorkerPayload(type, payload) {
|
|
@@ -62,4 +62,4 @@ function normalizeOnListenerParameters(event, options) {
|
|
|
62
62
|
|
|
63
63
|
//#endregion
|
|
64
64
|
export { workerErrorEvent as a, normalizeOnListenerParameters as i, defineWorkerEventa as n, generateWorkerPayload as o, isWorkerEventa as r, parseWorkerPayload as s, defineOutboundWorkerEventa as t };
|
|
65
|
-
//# sourceMappingURL=shared-
|
|
65
|
+
//# sourceMappingURL=shared-eQ-hnVHv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-
|
|
1
|
+
{"version":3,"file":"shared-eQ-hnVHv.mjs","names":["eventPayload: any","transfer: Transferable[] | undefined"],"sources":["../src/adapters/webworkers/internal.ts","../src/adapters/webworkers/shared.ts"],"sourcesContent":["import type { EventTag } from '../..'\nimport type { WorkerPayload } from './shared'\n\nimport { nanoid } from '../..'\n\nexport function generateWorkerPayload<T>(type: EventTag<any, any>, payload: T): WorkerPayload<T> {\n return {\n id: nanoid(),\n type,\n payload,\n }\n}\n\nexport function parseWorkerPayload<T>(data: unknown): WorkerPayload<T> {\n return data as WorkerPayload<T>\n}\n","import type { EventContext } from '../../context'\nimport type { Eventa, EventTag } from '../../eventa'\n\nimport { defineEventa, defineOutboundEventa } from '../../eventa'\nimport { isExtendableInvokeResponseLike } from '../../invoke'\n\nexport interface WorkerPayload<T> {\n id: string\n type: EventTag<any, any>\n payload: T\n transfer?: Transferable[]\n}\n\nexport interface WorkerEventa<T> extends Eventa<{ message: T, transfer?: Transferable[] }> {\n _workerTransfer: true\n}\n\nexport function defineWorkerEventa<T>(id?: string): WorkerEventa<T> {\n return {\n ...defineEventa<{ message: T, transfer?: Transferable[] }>(id),\n _workerTransfer: true,\n }\n}\n\nexport function defineOutboundWorkerEventa<T>(id?: string): WorkerEventa<T> {\n return {\n ...defineOutboundEventa<{ message: T, transfer?: Transferable[] }>(id),\n _workerTransfer: true,\n }\n}\n\nexport function isWorkerEventa(event: Eventa<any>): event is WorkerEventa<any> {\n return typeof event === 'object'\n && '_workerTransfer' in event\n && typeof event._workerTransfer === 'boolean'\n && event._workerTransfer === true\n}\n\nexport const workerErrorEvent = defineEventa<{ error: unknown }>()\nexport const workerMessageErrorEvent = defineEventa<{ error: unknown, message: any }>()\n\nexport function normalizeOnListenerParameters(event: Eventa<any>, options?: { transfer?: Transferable[] } | unknown) {\n let eventPayload: any = event.body\n let transfer: Transferable[] | undefined\n\n if (isExtendableInvokeResponseLike<unknown, EventContext<{ invokeResponse?: { transfer?: Transferable[] } }>>(event)) {\n if (event.body!.content.invokeResponse?.transfer != null) {\n transfer = event.body!.content.invokeResponse!.transfer\n delete event.body!.content.invokeResponse\n }\n\n eventPayload = { ...event.body, content: event.body!.content.response }\n delete eventPayload.content.response\n }\n else if (isWorkerEventa(event)) {\n transfer = event.body?.transfer\n delete event.body?.transfer\n\n eventPayload = event.body?.message\n delete event.body?.message\n }\n\n // Override from options\n if (typeof options !== 'undefined' && options != null && typeof options === 'object' && 'transfer' in options) {\n if (Array.isArray(options.transfer)) {\n transfer = options.transfer\n }\n }\n\n return {\n body: eventPayload,\n transfer,\n }\n}\n"],"mappings":";;;;AAKA,SAAgB,sBAAyB,MAA0B,SAA8B;AAC/F,QAAO;EACL,IAAI,QAAQ;EACZ;EACA;EACD;;AAGH,SAAgB,mBAAsB,MAAiC;AACrE,QAAO;;;;;ACGT,SAAgB,mBAAsB,IAA8B;AAClE,QAAO;EACL,GAAG,aAAwD,GAAG;EAC9D,iBAAiB;EAClB;;AAGH,SAAgB,2BAA8B,IAA8B;AAC1E,QAAO;EACL,GAAG,qBAAgE,GAAG;EACtE,iBAAiB;EAClB;;AAGH,SAAgB,eAAe,OAAgD;AAC7E,QAAO,OAAO,UAAU,YACnB,qBAAqB,SACrB,OAAO,MAAM,oBAAoB,aACjC,MAAM,oBAAoB;;AAGjC,MAAa,mBAAmB,cAAkC;AAClE,MAAa,0BAA0B,cAAgD;AAEvF,SAAgB,8BAA8B,OAAoB,SAAmD;CACnH,IAAIA,eAAoB,MAAM;CAC9B,IAAIC;AAEJ,KAAI,+BAA0G,MAAM,EAAE;AACpH,MAAI,MAAM,KAAM,QAAQ,gBAAgB,YAAY,MAAM;AACxD,cAAW,MAAM,KAAM,QAAQ,eAAgB;AAC/C,UAAO,MAAM,KAAM,QAAQ;;AAG7B,iBAAe;GAAE,GAAG,MAAM;GAAM,SAAS,MAAM,KAAM,QAAQ;GAAU;AACvE,SAAO,aAAa,QAAQ;YAErB,eAAe,MAAM,EAAE;AAC9B,aAAW,MAAM,MAAM;AACvB,SAAO,MAAM,MAAM;AAEnB,iBAAe,MAAM,MAAM;AAC3B,SAAO,MAAM,MAAM;;AAIrB,KAAI,OAAO,YAAY,eAAe,WAAW,QAAQ,OAAO,YAAY,YAAY,cAAc,SACpG;MAAI,MAAM,QAAQ,QAAQ,SAAS,CACjC,YAAW,QAAQ;;AAIvB,QAAO;EACL,MAAM;EACN;EACD"}
|