@fairfox/polly 0.12.0 → 0.12.1

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.
@@ -1,5 +1,85 @@
1
+ import type { Signal } from "@preact/signals-core";
2
+ import { Elysia } from "elysia";
1
3
  import type { PollyConfig } from "./types";
4
+ /**
5
+ * Broadcast message sent to connected clients
6
+ */
7
+ interface BroadcastMessage {
8
+ type: "effect";
9
+ path: string;
10
+ method: string;
11
+ result: unknown;
12
+ clock: {
13
+ tick: number;
14
+ contextId: string;
15
+ };
16
+ }
17
+ /**
18
+ * Minimal WebSocket interface for broadcasting
19
+ */
20
+ interface MinimalWebSocket {
21
+ readyState: number;
22
+ send(data: string): void;
23
+ }
24
+ /**
25
+ * WebSocket broadcast manager
26
+ */
27
+ declare class BroadcastManager {
28
+ private connections;
29
+ register(clientId: string, ws: MinimalWebSocket): void;
30
+ unregister(clientId: string): void;
31
+ broadcast(message: BroadcastMessage, filter?: (clientId: string) => boolean): void;
32
+ }
2
33
  /**
3
34
  * Main Polly Elysia plugin
4
35
  */
5
- export declare function polly(config?: PollyConfig): any;
36
+ export declare function polly(config?: PollyConfig): Elysia<"", {
37
+ decorator: {
38
+ pollyState: {
39
+ client: Record<string, Signal<unknown>>;
40
+ server: Record<string, Signal<unknown>>;
41
+ };
42
+ } & {
43
+ pollyClock: import("../core/clock").LamportClockOps;
44
+ } & {
45
+ pollyBroadcast: BroadcastManager;
46
+ };
47
+ store: {};
48
+ derive: {};
49
+ resolve: {};
50
+ }, {
51
+ typebox: {};
52
+ error: {};
53
+ }, {
54
+ schema: {};
55
+ standaloneSchema: {};
56
+ macro: {};
57
+ macroFn: {};
58
+ parser: {};
59
+ response: {};
60
+ }, {
61
+ [x: string]: {
62
+ subscribe: {
63
+ body: unknown;
64
+ params: {};
65
+ query: unknown;
66
+ headers: unknown;
67
+ response: {};
68
+ };
69
+ };
70
+ }, {
71
+ derive: {};
72
+ resolve: {};
73
+ schema: {};
74
+ standaloneSchema: {};
75
+ response: {};
76
+ }, {
77
+ derive: {};
78
+ resolve: {};
79
+ schema: {};
80
+ standaloneSchema: {};
81
+ response: {
82
+ 200: Response;
83
+ };
84
+ }>;
85
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairfox/polly",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Multi-execution-context framework with reactive state and cross-context messaging for Chrome extensions, PWAs, and worker-based applications",
@@ -117,12 +117,16 @@
117
117
  "serialize-javascript": "^6.0.2",
118
118
  "ts-morph": "^21.0.1"
119
119
  },
120
+ "optionalDependencies": {
121
+ "elysia": "^1.4.0",
122
+ "@elysiajs/eden": "^1.2.0"
123
+ },
120
124
  "peerDependencies": {
121
125
  "typescript": "^5.9.3",
122
126
  "preact": "^10.28.1",
123
127
  "@preact/signals": "^2.5.1",
124
- "elysia": "",
125
- "@elysiajs/eden": ""
128
+ "elysia": ">= 1.4.0",
129
+ "@elysiajs/eden": ">= 1.2.0"
126
130
  },
127
131
  "peerDependenciesMeta": {
128
132
  "elysia": {