@gd-kirie/ipc-eventa 0.6.1 → 0.6.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/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createEventaContext"],"sources":["../src/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":["createEventaContext"],"sources":["../src/index.ts"],"sourcesContent":["import type { Eventa, EventContext, EventTag } from \"@moeru/eventa\";\nimport { onTextReceived, sendText } from \"@gd-kirie/ipc\";\nimport {\n and,\n createContext as createEventaContext,\n defineInboundEventa,\n defineOutboundEventa,\n EventaFlowDirection,\n matchBy,\n nanoid,\n} from \"@moeru/eventa\";\n\nexport interface KirieEventaMessage {\n id: string;\n type: EventTag<unknown, unknown>;\n payload: Eventa<unknown>;\n}\n\ninterface KirieEventaRawMessage {\n raw: {\n message: string;\n };\n}\n\ntype KirieDirectionalEvent = Eventa<unknown> & {\n _flowDirection?: EventaFlowDirection;\n};\n\nexport type KirieEventaContext = EventContext<unknown, KirieEventaRawMessage>;\n\nexport interface KirieEventaContextHandle {\n context: KirieEventaContext;\n dispose: () => void;\n}\n\nfunction createMessage(event: Eventa<unknown>): KirieEventaMessage {\n return {\n id: nanoid(),\n payload: {\n ...defineOutboundEventa(event.type),\n ...event,\n },\n type: event.id,\n };\n}\n\nexport function createContext(): KirieEventaContextHandle {\n const context = createEventaContext<unknown, KirieEventaRawMessage>();\n const offOutbound = context.on(\n and(\n matchBy((event: KirieDirectionalEvent) => {\n return event._flowDirection === EventaFlowDirection.Outbound || !event._flowDirection;\n }),\n matchBy(\"*\"),\n ),\n (event) => {\n sendText(JSON.stringify(createMessage(event)));\n },\n );\n\n const offInbound = onTextReceived((message) => {\n try {\n const parsed = JSON.parse(message) as KirieEventaMessage;\n context.emit(defineInboundEventa(parsed.type), parsed.payload.body, {\n raw: {\n message,\n },\n });\n } catch (error) {\n console.error(\"Failed to parse Kirie Eventa message:\", error);\n }\n });\n\n return {\n context,\n dispose: () => {\n offOutbound();\n offInbound();\n },\n };\n}\n"],"mappings":";;;AAmCA,SAAS,cAAc,OAA4C;CACjE,OAAO;EACL,IAAI,OAAO;EACX,SAAS;GACP,GAAG,qBAAqB,MAAM,IAAI;GAClC,GAAG;EACL;EACA,MAAM,MAAM;CACd;AACF;AAEA,SAAgB,gBAA0C;CACxD,MAAM,UAAUA,gBAAoD;CACpE,MAAM,cAAc,QAAQ,GAC1B,IACE,SAAS,UAAiC;EACxC,OAAO,MAAM,mBAAmB,oBAAoB,YAAY,CAAC,MAAM;CACzE,CAAC,GACD,QAAQ,GAAG,CACb,IACC,UAAU;EACT,SAAS,KAAK,UAAU,cAAc,KAAK,CAAC,CAAC;CAC/C,CACF;CAEA,MAAM,aAAa,gBAAgB,YAAY;EAC7C,IAAI;GACF,MAAM,SAAS,KAAK,MAAM,OAAO;GACjC,QAAQ,KAAK,oBAAoB,OAAO,IAAI,GAAG,OAAO,QAAQ,MAAM,EAClE,KAAK,EACH,QACF,EACF,CAAC;EACH,SAAS,OAAO;GACd,QAAQ,MAAM,yCAAyC,KAAK;EAC9D;CACF,CAAC;CAED,OAAO;EACL;EACA,eAAe;GACb,YAAY;GACZ,WAAW;EACb;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gd-kirie/ipc-eventa",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@gd-kirie/ipc": "0.6.
|
|
22
|
+
"@gd-kirie/ipc": "0.6.3",
|
|
23
23
|
"@moeru/eventa": "^1.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|