@livequery/rpc 2.0.134 → 2.0.135
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 +108 -331
- package/dist/ExtensionChannel.js +2 -2
- package/dist/ExtensionChannel.js.map +1 -1
- package/dist/LimitConcurrency.d.ts +1 -1
- package/dist/LimitConcurrency.d.ts.map +1 -1
- package/dist/LimitConcurrency.js +4 -4
- package/dist/LimitConcurrency.js.map +1 -1
- package/dist/RxjsQueue.d.ts.map +1 -1
- package/dist/RxjsQueue.js +2 -2
- package/dist/RxjsQueue.js.map +1 -1
- package/dist/ServiceLinker.d.ts.map +1 -1
- package/dist/ServiceLinker.js +6 -5
- package/dist/ServiceLinker.js.map +1 -1
- package/dist/SharedWorkerChannel.js +1 -1
- package/dist/SharedWorkerChannel.js.map +1 -1
- package/dist/StorageBehaviorSubject.js +1 -1
- package/dist/WorkerManager.d.ts.map +1 -1
- package/dist/WorkerManager.js +2 -0
- package/dist/WorkerManager.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,102 +1,38 @@
|
|
|
1
1
|
# @livequery/rpc
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Small TypeScript utilities for RPC-style communication between a main thread and a `SharedWorker` or Chrome extension runtime. It uses RxJS for request streams, cancellation, and observable state.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use it when you want a service-style API across a worker boundary instead of manually passing `postMessage` objects around.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This package is built for a simple model:
|
|
10
|
-
|
|
11
|
-
- Expose plain classes as worker services.
|
|
12
|
-
- Call worker methods from the UI as `await`-able functions.
|
|
13
|
-
- Stream worker `Observable`s back to the client.
|
|
14
|
-
- Mirror `BehaviorSubject`-style state across the boundary.
|
|
15
|
-
- Cancel long-running streams when the client unsubscribes.
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @livequery/rpc rxjs
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Or with Bun:
|
|
7
|
+
## Install
|
|
24
8
|
|
|
25
9
|
```bash
|
|
26
10
|
bun add @livequery/rpc rxjs
|
|
27
11
|
```
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
export * from "./ExtensionChannel"
|
|
33
|
-
export * from "./RpcChannel"
|
|
34
|
-
export * from "./SharedWorkerChannel"
|
|
35
|
-
export * from "./ServiceLinker"
|
|
36
|
-
export * from "./WorkerService"
|
|
37
|
-
export * from "./WorkerManager"
|
|
38
|
-
export * from "./LimitConcurrency"
|
|
39
|
-
export * from "./StorageBehaviorSubject"
|
|
40
|
-
export * from "./RxjsQueue"
|
|
13
|
+
```bash
|
|
14
|
+
npm install @livequery/rpc rxjs
|
|
41
15
|
```
|
|
42
16
|
|
|
43
|
-
##
|
|
17
|
+
## Core Idea
|
|
44
18
|
|
|
45
19
|
```text
|
|
46
|
-
Main
|
|
47
|
-
-----------
|
|
48
|
-
ServiceLinker --
|
|
49
|
-
^
|
|
50
|
-
|
|
20
|
+
Main thread Worker or extension runtime
|
|
21
|
+
----------- ---------------------------
|
|
22
|
+
ServiceLinker -- RpcMessage -------> WorkerManager -> service instance
|
|
23
|
+
^ |
|
|
24
|
+
|----------- response stream ----------|
|
|
51
25
|
```
|
|
52
26
|
|
|
53
|
-
|
|
27
|
+
- `ServiceLinker` creates a typed client proxy.
|
|
28
|
+
- `WorkerManager` exposes service instances and dispatches incoming calls.
|
|
29
|
+
- `SharedWorkerChannel` transports messages over `SharedWorker`.
|
|
30
|
+
- `ExtensionChannel` transports messages over `chrome.runtime`.
|
|
31
|
+
- `WorkerService<T>` maps a worker-side service type into the client-side type.
|
|
54
32
|
|
|
55
|
-
##
|
|
33
|
+
## SharedWorker Example
|
|
56
34
|
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
import { ExtensionChannel, WorkerManager } from "@livequery/rpc"
|
|
61
|
-
import { CounterService } from "./CounterService"
|
|
62
|
-
|
|
63
|
-
const channel = new ExtensionChannel()
|
|
64
|
-
const manager = new WorkerManager(channel)
|
|
65
|
-
|
|
66
|
-
manager.exposeService("counter", new CounterService())
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Popup, options page, or content script
|
|
70
|
-
|
|
71
|
-
```ts
|
|
72
|
-
import { ExtensionChannel, ServiceLinker, type WorkerService } from "@livequery/rpc"
|
|
73
|
-
import type { CounterService } from "./CounterService"
|
|
74
|
-
|
|
75
|
-
const channel = new ExtensionChannel()
|
|
76
|
-
const linker = new ServiceLinker(channel)
|
|
77
|
-
|
|
78
|
-
const counter = linker.linkService<WorkerService<CounterService>>("counter")
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
`ExtensionChannel` auto-detects its context at construction time:
|
|
82
|
-
|
|
83
|
-
- **Background service worker** (`typeof window === 'undefined'`): listens on `chrome.runtime.onMessage` and routes responses back to the originating tab via `chrome.tabs.sendMessage`, or falls back to `chrome.runtime.sendMessage` when the message did not originate from a tab.
|
|
84
|
-
- **Foreground context** (popup, options page, content script): listens on `chrome.runtime.onMessage` for responses arriving from the background and sends requests with `chrome.runtime.sendMessage`.
|
|
85
|
-
|
|
86
|
-
If `chrome` is not available (e.g. during SSR), all operations silently no-op.
|
|
87
|
-
|
|
88
|
-
## When To Use This Package
|
|
89
|
-
|
|
90
|
-
Use it when you want to:
|
|
91
|
-
|
|
92
|
-
- move logic or shared state into a `SharedWorker`
|
|
93
|
-
- keep a typed service-style API instead of manually handling `postMessage`
|
|
94
|
-
- return one-shot values, promises, or `Observable`s from worker methods
|
|
95
|
-
- expose `BehaviorSubject` properties as client-consumable reactive state
|
|
96
|
-
|
|
97
|
-
## End-To-End Example
|
|
98
|
-
|
|
99
|
-
### 1. Define a worker service
|
|
35
|
+
### 1. Define a service
|
|
100
36
|
|
|
101
37
|
```ts
|
|
102
38
|
import { BehaviorSubject, interval, map } from "rxjs"
|
|
@@ -110,17 +46,17 @@ export class CounterService {
|
|
|
110
46
|
return nextValue
|
|
111
47
|
}
|
|
112
48
|
|
|
113
|
-
|
|
114
|
-
return
|
|
49
|
+
ticker() {
|
|
50
|
+
return interval(1000).pipe(map(index => `tick-${index}`))
|
|
115
51
|
}
|
|
116
52
|
|
|
117
|
-
|
|
118
|
-
|
|
53
|
+
profile = {
|
|
54
|
+
getName: () => "Ada",
|
|
119
55
|
}
|
|
120
56
|
}
|
|
121
57
|
```
|
|
122
58
|
|
|
123
|
-
### 2. Expose it
|
|
59
|
+
### 2. Expose it in the worker
|
|
124
60
|
|
|
125
61
|
```ts
|
|
126
62
|
import { SharedWorkerChannel, WorkerManager } from "@livequery/rpc"
|
|
@@ -145,337 +81,178 @@ const linker = new ServiceLinker(channel)
|
|
|
145
81
|
const counter = linker.linkService<WorkerService<CounterService>>("counter")
|
|
146
82
|
```
|
|
147
83
|
|
|
148
|
-
### 4. Call methods
|
|
84
|
+
### 4. Call methods
|
|
85
|
+
|
|
86
|
+
Use `await` for one-shot values:
|
|
149
87
|
|
|
150
88
|
```ts
|
|
151
89
|
const nextValue = await counter.increment(2)
|
|
152
|
-
const currentValue = await counter.getCurrent()
|
|
153
|
-
|
|
154
|
-
console.log({ nextValue, currentValue })
|
|
155
90
|
```
|
|
156
91
|
|
|
157
|
-
|
|
92
|
+
Use `subscribe()` for streamed values:
|
|
158
93
|
|
|
159
94
|
```ts
|
|
160
|
-
const
|
|
161
|
-
console.log(
|
|
95
|
+
const subscription = counter.ticker().subscribe(value => {
|
|
96
|
+
console.log(value)
|
|
162
97
|
})
|
|
163
98
|
|
|
164
|
-
|
|
165
|
-
tickerSubscription.unsubscribe()
|
|
166
|
-
}, 5000)
|
|
99
|
+
subscription.unsubscribe()
|
|
167
100
|
```
|
|
168
101
|
|
|
169
|
-
|
|
102
|
+
Nested methods work through normal property access:
|
|
170
103
|
|
|
171
104
|
```ts
|
|
172
|
-
const
|
|
173
|
-
console.log("counter value", value)
|
|
174
|
-
})
|
|
105
|
+
const name = await counter.profile.getName()
|
|
175
106
|
```
|
|
176
107
|
|
|
177
|
-
##
|
|
178
|
-
|
|
179
|
-
Every service method call is exposed on the client as an `Observable` that is also `PromiseLike`.
|
|
180
|
-
|
|
181
|
-
That means you can do either of these:
|
|
108
|
+
## Remote State
|
|
182
109
|
|
|
183
|
-
|
|
184
|
-
const result = await service.someMethod()
|
|
185
|
-
```
|
|
110
|
+
Expose a `BehaviorSubject` property on the worker service when the client should observe shared state:
|
|
186
111
|
|
|
187
112
|
```ts
|
|
188
|
-
|
|
189
|
-
console.log(value)
|
|
113
|
+
const subscription = counter.value.subscribe(value => {
|
|
114
|
+
console.log("counter value", value)
|
|
190
115
|
})
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
In practice:
|
|
194
|
-
|
|
195
|
-
- use `await` for one-shot values or promise-returning methods
|
|
196
|
-
- use `subscribe()` for streaming results returned from worker `Observable`s
|
|
197
116
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
If your service exposes a `BehaviorSubject` property, the client can treat it like remote reactive state.
|
|
201
|
-
|
|
202
|
-
This is what allows a worker-side `BehaviorSubject` to feel usable on the client:
|
|
203
|
-
|
|
204
|
-
```ts
|
|
205
|
-
class SettingsService {
|
|
206
|
-
theme = new BehaviorSubject("light")
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
-
const settings = linker.linkService<WorkerService<SettingsService>>("settings")
|
|
212
|
-
|
|
213
|
-
settings.theme.subscribe((theme) => {
|
|
214
|
-
console.log(theme)
|
|
215
|
-
})
|
|
117
|
+
const current = counter.value.getValue()
|
|
216
118
|
```
|
|
217
119
|
|
|
218
120
|
Notes:
|
|
219
121
|
|
|
220
|
-
- `
|
|
221
|
-
-
|
|
222
|
-
- `getValue()` reads the
|
|
223
|
-
- this pattern is designed around `BehaviorSubject`-like objects
|
|
224
|
-
|
|
225
|
-
There is currently no built-in readiness helper in `ServiceLinker`.
|
|
122
|
+
- `subscribe`, `pipe`, and `getValue` are special-cased for remote observable-like properties.
|
|
123
|
+
- The first subscription creates and caches the local shared observable for that property path.
|
|
124
|
+
- `getValue()` reads the local cache. Subscribe first if you need the current worker value to be populated.
|
|
226
125
|
|
|
227
|
-
##
|
|
126
|
+
## Chrome Extension Runtime
|
|
228
127
|
|
|
229
|
-
|
|
128
|
+
Use `ExtensionChannel` inside Chrome extension contexts where `chrome.runtime` is available.
|
|
230
129
|
|
|
231
|
-
|
|
130
|
+
Background service worker:
|
|
232
131
|
|
|
233
132
|
```ts
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
getName: () => "Ada",
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
can be consumed like this:
|
|
242
|
-
|
|
243
|
-
```ts
|
|
244
|
-
const user = linker.linkService<WorkerService<UserService>>("user")
|
|
245
|
-
const name = await user.profile.getName()
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Cancellation Model
|
|
133
|
+
import { ExtensionChannel, WorkerManager } from "@livequery/rpc"
|
|
134
|
+
import { CounterService } from "./CounterService"
|
|
249
135
|
|
|
250
|
-
|
|
136
|
+
const channel = new ExtensionChannel()
|
|
137
|
+
const manager = new WorkerManager(channel)
|
|
251
138
|
|
|
252
|
-
|
|
253
|
-
{ id: 0, cancel: { id: requestId } }
|
|
139
|
+
manager.exposeService("counter", new CounterService())
|
|
254
140
|
```
|
|
255
141
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
This mainly matters for:
|
|
259
|
-
|
|
260
|
-
- infinite or long-lived `Observable`s
|
|
261
|
-
- expensive operations you no longer need
|
|
262
|
-
- UI screens that mount and unmount frequently
|
|
263
|
-
|
|
264
|
-
## API Reference
|
|
265
|
-
|
|
266
|
-
### `RpcMessage`
|
|
142
|
+
Popup, options page, or content script:
|
|
267
143
|
|
|
268
144
|
```ts
|
|
269
|
-
type
|
|
270
|
-
|
|
271
|
-
request?: {
|
|
272
|
-
service: string
|
|
273
|
-
method: string[]
|
|
274
|
-
args: any[]
|
|
275
|
-
}
|
|
276
|
-
cancel?: { id: number }
|
|
277
|
-
response?: Partial<{
|
|
278
|
-
data: any
|
|
279
|
-
error: string
|
|
280
|
-
completed: boolean
|
|
281
|
-
}>
|
|
282
|
-
}
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### `RpcChannel`
|
|
145
|
+
import { ExtensionChannel, ServiceLinker, type WorkerService } from "@livequery/rpc"
|
|
146
|
+
import type { CounterService } from "./CounterService"
|
|
286
147
|
|
|
287
|
-
|
|
148
|
+
const channel = new ExtensionChannel()
|
|
149
|
+
const linker = new ServiceLinker(channel)
|
|
288
150
|
|
|
289
|
-
|
|
290
|
-
abstract class RpcChannel extends Subject<
|
|
291
|
-
RpcMessage & { respond: (msg: RpcMessage["response"]) => void }
|
|
292
|
-
> {
|
|
293
|
-
abstract send(message: RpcMessage): void
|
|
294
|
-
}
|
|
151
|
+
const counter = linker.linkService<WorkerService<CounterService>>("counter")
|
|
295
152
|
```
|
|
296
153
|
|
|
297
|
-
|
|
154
|
+
`ExtensionChannel` auto-detects foreground versus background context. If `chrome` is unavailable, operations silently no-op.
|
|
298
155
|
|
|
299
|
-
|
|
156
|
+
## Call Behavior
|
|
300
157
|
|
|
301
|
-
|
|
158
|
+
Every remote method call returns an `Observable` with a custom `then()` implementation. That means the same call can often be used as either:
|
|
302
159
|
|
|
303
160
|
```ts
|
|
304
|
-
const
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
Main thread side:
|
|
308
|
-
|
|
309
|
-
```ts
|
|
310
|
-
const worker = new SharedWorker(new URL("./worker.ts", import.meta.url), { type: "module" })
|
|
311
|
-
const channel = new SharedWorkerChannel(worker)
|
|
161
|
+
const result = await service.someMethod()
|
|
312
162
|
```
|
|
313
163
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
Concrete `RpcChannel` implementation for Chrome extension Manifest V3 messaging.
|
|
317
|
-
|
|
318
|
-
Auto-detects its context at construction time — no argument is required.
|
|
164
|
+
or:
|
|
319
165
|
|
|
320
166
|
```ts
|
|
321
|
-
const
|
|
167
|
+
const subscription = service.someMethod().subscribe(value => {
|
|
168
|
+
console.log(value)
|
|
169
|
+
})
|
|
322
170
|
```
|
|
323
171
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
- listens on `chrome.runtime.onMessage`
|
|
327
|
-
- responds to tab-originated messages via `chrome.tabs.sendMessage(tabId, …)`
|
|
328
|
-
- responds to non-tab messages via `chrome.runtime.sendMessage(…)`
|
|
172
|
+
For clarity, prefer:
|
|
329
173
|
|
|
330
|
-
|
|
174
|
+
- `await` for plain values and promises
|
|
175
|
+
- `subscribe()` for observable streams
|
|
331
176
|
|
|
332
|
-
|
|
333
|
-
- sends requests with `chrome.runtime.sendMessage`
|
|
177
|
+
If a client unsubscribes before a request completes, a cancellation message is sent to the worker and `WorkerManager` unsubscribes from the worker-side stream.
|
|
334
178
|
|
|
335
|
-
|
|
179
|
+
## Utility Helpers
|
|
336
180
|
|
|
337
|
-
### `
|
|
181
|
+
### `LimitConcurrency`
|
|
338
182
|
|
|
339
|
-
|
|
183
|
+
Decorator for limiting concurrent method execution:
|
|
340
184
|
|
|
341
185
|
```ts
|
|
342
|
-
|
|
343
|
-
constructor(channel: RpcChannel)
|
|
344
|
-
exposeService(name: string, service: any): void
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
Behavior:
|
|
349
|
-
|
|
350
|
-
- resolves nested property or method paths
|
|
351
|
-
- invokes functions with arguments
|
|
352
|
-
- returns plain values for property access
|
|
353
|
-
- streams observable-like results until completion
|
|
354
|
-
- unsubscribes worker-side streams when cancellation arrives
|
|
355
|
-
|
|
356
|
-
### `ServiceLinker`
|
|
357
|
-
|
|
358
|
-
Creates and caches client-side proxies.
|
|
186
|
+
import { LimitConcurrency } from "@livequery/rpc"
|
|
359
187
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
188
|
+
class ApiService {
|
|
189
|
+
@LimitConcurrency(2)
|
|
190
|
+
async fetchItem(id: string) {
|
|
191
|
+
return { id }
|
|
192
|
+
}
|
|
364
193
|
}
|
|
365
194
|
```
|
|
366
195
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
- caches proxies by service name
|
|
370
|
-
- assigns incrementing request ids
|
|
371
|
-
- returns an `Observable` that is also `PromiseLike`
|
|
372
|
-
- sends cancellation when a request is unsubscribed early
|
|
373
|
-
- special-cases `subscribe`, `pipe`, and `getValue` for remote observable-like properties
|
|
374
|
-
|
|
375
|
-
### `WorkerService<T>`
|
|
376
|
-
|
|
377
|
-
Type helper that converts a worker-side contract into a client-side contract.
|
|
378
|
-
|
|
379
|
-
Rules:
|
|
380
|
-
|
|
381
|
-
- `BehaviorSubject<T>` stays `BehaviorSubject<T>`
|
|
382
|
-
- `Observable<T>` stays `Observable<T>`
|
|
383
|
-
- methods become async call signatures unless their awaited return type is already an `Observable`
|
|
196
|
+
### `RxjsQueue`
|
|
384
197
|
|
|
385
|
-
|
|
198
|
+
Small concurrency-limited async queue:
|
|
386
199
|
|
|
387
200
|
```ts
|
|
388
|
-
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
## Utility Helpers
|
|
392
|
-
|
|
393
|
-
### `StorageBehaviorSubject<T>`
|
|
201
|
+
import { RxjsQueue } from "@livequery/rpc"
|
|
394
202
|
|
|
395
|
-
|
|
203
|
+
const queue = new RxjsQueue(2)
|
|
204
|
+
const result = await queue.run(() => fetchSomething())
|
|
205
|
+
```
|
|
396
206
|
|
|
397
|
-
|
|
398
|
-
type IStorage = {
|
|
399
|
-
getItem: <T>(key: string) => Promise<T | undefined> | T | undefined
|
|
400
|
-
setItem: <T>(key: string, value: T) => void
|
|
401
|
-
}
|
|
207
|
+
The default concurrency is `1`.
|
|
402
208
|
|
|
403
|
-
|
|
404
|
-
constructor(storage: IStorage, key: string, defaultValue: T)
|
|
405
|
-
next(value: T): void
|
|
406
|
-
}
|
|
407
|
-
```
|
|
209
|
+
### `StorageBehaviorSubject`
|
|
408
210
|
|
|
409
|
-
|
|
211
|
+
`BehaviorSubject` that initializes from storage and persists every `next()`:
|
|
410
212
|
|
|
411
213
|
```ts
|
|
412
|
-
|
|
413
|
-
getItem: <T>(key: string) => JSON.parse(localStorage.getItem(key) || "null") as T | undefined,
|
|
414
|
-
setItem: <T>(key: string, value: T) => {
|
|
415
|
-
localStorage.setItem(key, JSON.stringify(value))
|
|
416
|
-
},
|
|
417
|
-
}
|
|
214
|
+
import { StorageBehaviorSubject } from "@livequery/rpc"
|
|
418
215
|
|
|
419
216
|
const theme$ = new StorageBehaviorSubject(storage, "theme", "light")
|
|
420
217
|
theme$.next("dark")
|
|
421
218
|
```
|
|
422
219
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
Decorator factory that queues method calls and executes them with a concurrency cap.
|
|
220
|
+
The storage adapter shape is:
|
|
426
221
|
|
|
427
222
|
```ts
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return { id }
|
|
432
|
-
}
|
|
223
|
+
type IStorage = {
|
|
224
|
+
getItem: <T>(key: string) => Promise<T | undefined> | T | undefined
|
|
225
|
+
setItem: <T>(key: string, value: T) => void
|
|
433
226
|
}
|
|
434
227
|
```
|
|
435
228
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
- limit concurrent async work
|
|
439
|
-
- preserve a simple call API
|
|
440
|
-
- still return something `await`-able or subscribable
|
|
441
|
-
|
|
442
|
-
### `RxjsQueue`
|
|
443
|
-
|
|
444
|
-
Simple promise queue built on RxJS operators.
|
|
229
|
+
## Exports
|
|
445
230
|
|
|
446
231
|
```ts
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
232
|
+
export * from "./RpcChannel.js"
|
|
233
|
+
export * from "./ExtensionChannel.js"
|
|
234
|
+
export * from "./SharedWorkerChannel.js"
|
|
235
|
+
export * from "./ServiceLinker.js"
|
|
236
|
+
export * from "./WorkerService.js"
|
|
237
|
+
export * from "./WorkerManager.js"
|
|
238
|
+
export * from "./LimitConcurrency.js"
|
|
239
|
+
export * from "./StorageBehaviorSubject.js"
|
|
240
|
+
export * from "./RxjsQueue.js"
|
|
452
241
|
```
|
|
453
242
|
|
|
454
|
-
|
|
243
|
+
## Constraints
|
|
455
244
|
|
|
456
|
-
|
|
245
|
+
- Service paths beginning with `#` are invalid.
|
|
246
|
+
- Worker streams are detected by checking for a `pipe()` method.
|
|
247
|
+
- Falsy values such as `0`, `false`, `""`, and `null` are valid RPC payloads.
|
|
248
|
+
- Errors are propagated to the client as `Error(message)`.
|
|
249
|
+
- There is no built-in readiness API in `ServiceLinker`.
|
|
457
250
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
- transport is specifically designed around `SharedWorker`
|
|
461
|
-
- service member paths beginning with `#` are treated as invalid
|
|
462
|
-
- missing services return an RPC error response
|
|
463
|
-
- errors are propagated back as `Error(message)` on the client
|
|
464
|
-
- worker-to-client state mirroring is optimized for `BehaviorSubject`-style fields
|
|
465
|
-
|
|
466
|
-
## Build
|
|
251
|
+
## Development
|
|
467
252
|
|
|
468
253
|
```bash
|
|
254
|
+
bun run test
|
|
469
255
|
bun run build
|
|
470
256
|
```
|
|
471
257
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
- `bun run clean`
|
|
475
|
-
- `bun run build:watch`
|
|
476
|
-
|
|
477
|
-
## Package Output
|
|
478
|
-
|
|
479
|
-
- ESM entry: `dist/index.js`
|
|
480
|
-
- type declarations: `dist/index.d.ts`
|
|
481
|
-
- package name: `@livequery/rpc`
|
|
258
|
+
Build output is written to `dist/`.
|
package/dist/ExtensionChannel.js
CHANGED
|
@@ -17,7 +17,7 @@ export class ExtensionChannel extends RpcChannel {
|
|
|
17
17
|
if (!chrome)
|
|
18
18
|
return;
|
|
19
19
|
const runtime = chrome.runtime;
|
|
20
|
-
runtime?.onMessage.addListener((message
|
|
20
|
+
runtime?.onMessage.addListener((message) => {
|
|
21
21
|
if (!isRpcMessage(message))
|
|
22
22
|
return;
|
|
23
23
|
const respond = (response) => {
|
|
@@ -32,7 +32,7 @@ export class ExtensionChannel extends RpcChannel {
|
|
|
32
32
|
#initBackground() {
|
|
33
33
|
if (!chrome)
|
|
34
34
|
return;
|
|
35
|
-
chrome.runtime.onMessage.addListener((message, sender
|
|
35
|
+
chrome.runtime.onMessage.addListener((message, sender) => {
|
|
36
36
|
if (!isRpcMessage(message))
|
|
37
37
|
return;
|
|
38
38
|
const tabId = sender.tab?.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionChannel.js","sourceRoot":"","sources":["../src/ExtensionChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAA;AAY7D,MAAM,MAAM,GAAI,UAOd,CAAC,MAAM,CAAA;AAET,SAAS,YAAY,CAAC,KAAc;IAChC,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAA;AAChE,CAAC;AAED,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAI5C;QACI,KAAK,EAAE,CAAA;QACP,IAAI,OAAO,MAAM,IAAI,WAAW,EAAE,CAAC;YAC/B,IAAI,CAAC,eAAe,EAAE,CAAA;QAC1B,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,cAAc,EAAE,CAAA;QACzB,CAAC;IACL,CAAC;IAED,cAAc;QACV,IAAI,CAAC,MAAM;YAAE,OAAM;QACnB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC9B,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ExtensionChannel.js","sourceRoot":"","sources":["../src/ExtensionChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EA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AAE,EAAE;gBACjD,IAAI,KAAK,EAAE,CAAC;oBACR,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE;wBAC3B,EAAE,EAAE,OAAO,CAAC,EAAE;wBACd,QAAQ;qBACU,CAAC,CAAA;gBAC3B,CAAC;qBAAM,CAAC;oBACJ,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;wBACvB,EAAE,EAAE,OAAO,CAAC,EAAE;wBACd,QAAQ;qBACU,CAAC,CAAA;gBAC3B,CAAC;YACL,CAAC,CAAA;YACD,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;QACtC,CAAC,CAAC,CAAC;IACP,CAAC;IAGD,IAAI,CAAC,OAAmB;QACpB,IAAI,CAAC,MAAM;YAAE,OAAM;QACnB,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;CACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LimitConcurrency: <T extends ((...args: any) => Promise<any>)>(limit?: number) => (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) =>
|
|
1
|
+
export declare const LimitConcurrency: <T extends ((...args: any) => Promise<any>)>(limit?: number) => (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
2
2
|
//# sourceMappingURL=LimitConcurrency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LimitConcurrency.d.ts","sourceRoot":"","sources":["../src/LimitConcurrency.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAO,MAAU,MAAM,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,uBAAuB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"LimitConcurrency.d.ts","sourceRoot":"","sources":["../src/LimitConcurrency.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAO,MAAU,MAAM,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,uBAAuB,CAAC,CAAC,CAAC,+BAuC3K,CAAA"}
|
package/dist/LimitConcurrency.js
CHANGED
|
@@ -2,7 +2,7 @@ import { catchError, EMPTY, finalize, from, lastValueFrom, mergeMap, Observable,
|
|
|
2
2
|
export const LimitConcurrency = (limit = 1) => (target, propertyKey, descriptor) => {
|
|
3
3
|
const originalMethod = descriptor.value;
|
|
4
4
|
const sj = new Subject();
|
|
5
|
-
sj.pipe(mergeMap(async ({ args, o }) => {
|
|
5
|
+
sj.pipe(mergeMap(async ({ target, args, o }) => {
|
|
6
6
|
try {
|
|
7
7
|
const result = await originalMethod.apply(target, args);
|
|
8
8
|
const observable = result instanceof Promise ? from(result) : (result instanceof Observable ? result : of(result));
|
|
@@ -15,9 +15,9 @@ export const LimitConcurrency = (limit = 1) => (target, propertyKey, descriptor)
|
|
|
15
15
|
o.error(e);
|
|
16
16
|
}
|
|
17
17
|
}, limit)).subscribe();
|
|
18
|
-
|
|
18
|
+
descriptor.value = function (...args) {
|
|
19
19
|
const o = new Observable(o => {
|
|
20
|
-
sj.next({ args, o });
|
|
20
|
+
sj.next({ target: this, args, o });
|
|
21
21
|
});
|
|
22
22
|
return Object.assign(o, {
|
|
23
23
|
async then(resolve, reject) {
|
|
@@ -31,6 +31,6 @@ export const LimitConcurrency = (limit = 1) => (target, propertyKey, descriptor)
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
return
|
|
34
|
+
return descriptor;
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=LimitConcurrency.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LimitConcurrency.js","sourceRoot":"","sources":["../src/LimitConcurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAI3H,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAA6C,QAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,WAAmB,EAAE,UAAsC,EAAE,EAAE;IAC5K,MAAM,cAAc,GAAG,UAAU,CAAC,KAAU,CAAA;IAC5C,MAAM,EAAE,GAAG,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"LimitConcurrency.js","sourceRoot":"","sources":["../src/LimitConcurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAI3H,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAA6C,QAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,WAAmB,EAAE,UAAsC,EAAE,EAAE;IAC5K,MAAM,cAAc,GAAG,UAAU,CAAC,KAAU,CAAA;IAC5C,MAAM,EAAE,GAAG,IAAI,OAAO,EAAkD,CAAA;IACxE,EAAE,CAAC,IAAI,CACH,QAAQ,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE;QACnC,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACvD,MAAM,UAAU,GAAG,MAAM,YAAY,OAAO,CAAC,CAAC,CAA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AAC,CAAA;gBACb,CAAC;YACL,CAAC;SACJ,CAAC,CAAA;IACN,CAAiB,CAAA;IAEjB,OAAO,UAAU,CAAA;AACrB,CAAC,CAAA"}
|
package/dist/RxjsQueue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxjsQueue.d.ts","sourceRoot":"","sources":["../src/RxjsQueue.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;;gBASN,KAAK,
|
|
1
|
+
{"version":3,"file":"RxjsQueue.d.ts","sourceRoot":"","sources":["../src/RxjsQueue.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;;gBASN,KAAK,GAAE,MAAU;IAkB7B,WAAW,CAAC,KAAK,EAAE,MAAM;IAIzB,GAAG,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC;CAS7B"}
|
package/dist/RxjsQueue.js
CHANGED
|
@@ -2,7 +2,7 @@ import { mergeMap, Subject, switchMap } from "rxjs";
|
|
|
2
2
|
export class RxjsQueue {
|
|
3
3
|
#limit$ = new Subject();
|
|
4
4
|
#task = new Subject();
|
|
5
|
-
constructor(limit) {
|
|
5
|
+
constructor(limit = 1) {
|
|
6
6
|
this.#limit$.pipe(switchMap(limit => (this.#task.pipe(mergeMap(async ({ fn, s, r }) => {
|
|
7
7
|
try {
|
|
8
8
|
const data = await fn();
|
|
@@ -12,7 +12,7 @@ export class RxjsQueue {
|
|
|
12
12
|
r(e);
|
|
13
13
|
}
|
|
14
14
|
}, limit))))).subscribe();
|
|
15
|
-
|
|
15
|
+
this.#limit$.next(Math.max(1, limit));
|
|
16
16
|
}
|
|
17
17
|
updateLimit(limit) {
|
|
18
18
|
this.#limit$.next(limit);
|
package/dist/RxjsQueue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxjsQueue.js","sourceRoot":"","sources":["../src/RxjsQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EA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KAAK,CAAC,IAAI,CAAC;gBACZ,EAAE;gBACF,CAAC;gBACD,CAAC;aACJ,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceLinker.d.ts","sourceRoot":"","sources":["../src/ServiceLinker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD,qBAAa,aAAa;;IAUV,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"ServiceLinker.d.ts","sourceRoot":"","sources":["../src/ServiceLinker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD,qBAAa,aAAa;;IAUV,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,UAAU;IAgBvC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC;CAiFjD"}
|
package/dist/ServiceLinker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BehaviorSubject,
|
|
1
|
+
import { BehaviorSubject, finalize, firstValueFrom, Observable, share, Subject, tap } from "rxjs";
|
|
2
2
|
export class ServiceLinker {
|
|
3
3
|
channel;
|
|
4
4
|
#request_id = 1;
|
|
@@ -6,7 +6,7 @@ export class ServiceLinker {
|
|
|
6
6
|
#requests = new Map;
|
|
7
7
|
constructor(channel) {
|
|
8
8
|
this.channel = channel;
|
|
9
|
-
|
|
9
|
+
this.channel.pipe(tap(e => {
|
|
10
10
|
if (!e.response)
|
|
11
11
|
return;
|
|
12
12
|
const request = this.#requests.get(e.id);
|
|
@@ -15,10 +15,11 @@ export class ServiceLinker {
|
|
|
15
15
|
const { completed, data, error } = e.response;
|
|
16
16
|
if (completed || error)
|
|
17
17
|
request.completed = true;
|
|
18
|
-
data
|
|
19
|
-
|
|
18
|
+
if ("data" in e.response)
|
|
19
|
+
request.o.next(data);
|
|
20
20
|
error && request.o.error(new Error(error));
|
|
21
|
-
|
|
21
|
+
completed && !error && request.o.complete();
|
|
22
|
+
})).subscribe();
|
|
22
23
|
}
|
|
23
24
|
linkService(name) {
|
|
24
25
|
const cache = this.#services.get(name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceLinker.js","sourceRoot":"","sources":["../src/ServiceLinker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"ServiceLinker.js","sourceRoot":"","sources":["../src/ServiceLinker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAOlG,MAAM,OAAO,aAAa;IAUF;IARpB,WAAW,GAAG,CAAC,CAAA;IACf,SAAS,GAAG,IAAI,GAAG,EAAe,CAAA;IAClC,SAAS,GAAG,IAAI,GAGd,CAAA;IAGF,YAAoB,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CACb,GAAG,CAAC,CAAC,CAAC,EAAE;YACJ,IAAI,CAAC,CAAC,CAAC,QAAQ;gBAAE,OAAM;YACvB,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;YACxC,IAAI,CAAC,OAAO;gBAAE,OAAM;YACpB,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAA;YAC7C,IAAI,SAAS,IAAI,KAAK;gBAAE,OAAO,CAAC,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C,CAAA;QACjC,OAAO,OAAO,CAAA;IAClB,CAAC;CAEJ"}
|
|
@@ -45,7 +45,7 @@ export class SharedWorkerChannel extends RpcChannel {
|
|
|
45
45
|
worker.port.postMessage(msg);
|
|
46
46
|
};
|
|
47
47
|
this.next({ ...e.data, respond });
|
|
48
|
-
}), finalize(() => worker.port.close()), catchError(
|
|
48
|
+
}), finalize(() => worker.port.close()), catchError(() => {
|
|
49
49
|
return EMPTY;
|
|
50
50
|
})).subscribe();
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedWorkerChannel.js","sourceRoot":"","sources":["../src/SharedWorkerChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACvF,OAAO,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AAI9D,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IAE3B;IAApB,YAAoB,MAAqB;QACrC,KAAK,EAAE,CAAC;QADQ,WAAM,GAAN,MAAM,CAAe;QAErC,IAAI,OAAO,MAAM,IAAI,WAAW,EAAE,CAAC;YAC/B,IAAI,CAAC,eAAe,EAAE,CAAA;QAC1B,CAAC;aAAM,CAAC;YACJ,IAAI,MAAM,EAAE,CAAC;gBACT,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;IAGD,eAAe;QACX,MAAM,EAAE,GAAG,UAA4C,CAAA;QACvD,SAAS,CAAe,EAAE,EAAE,SAAS,CAAC,CAAC,IAAI,CACvC,QAAQ,CAAC,CAAC,CAAC,EAAE;YACT,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACvB,IAAI,CAAC,IAAI;gBAAE,OAAO,KAAK,CAAA;YACvB,IAAI,CAAC,KAAK,EAAE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OAAO,CAAC,CAAA;IACzC,CAAC;CACJ"}
|
|
@@ -4,7 +4,7 @@ export class StorageBehaviorSubject extends BehaviorSubject {
|
|
|
4
4
|
key;
|
|
5
5
|
constructor(storage, key, defaultValue) {
|
|
6
6
|
const value = storage.getItem(key);
|
|
7
|
-
super(value instanceof Promise ? defaultValue : value
|
|
7
|
+
super(value instanceof Promise ? defaultValue : value ?? defaultValue);
|
|
8
8
|
this.storage = storage;
|
|
9
9
|
this.key = key;
|
|
10
10
|
if (value instanceof Promise) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerManager.d.ts","sourceRoot":"","sources":["../src/WorkerManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMlD,qBAAa,aAAa;;
|
|
1
|
+
{"version":3,"file":"WorkerManager.d.ts","sourceRoot":"","sources":["../src/WorkerManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMlD,qBAAa,aAAa;;IAqBV,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,UAAU;IAoDvC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;CAQ3C"}
|
package/dist/WorkerManager.js
CHANGED
|
@@ -9,6 +9,8 @@ export class WorkerManager {
|
|
|
9
9
|
const [first, ...rest] = paths;
|
|
10
10
|
if (!first || first == '#')
|
|
11
11
|
throw new Error(`Invalid method path: ${paths.join('.')}`);
|
|
12
|
+
if (target == null)
|
|
13
|
+
throw new Error(`Invalid method path: ${paths.join('.')}`);
|
|
12
14
|
if (rest.length == 0) {
|
|
13
15
|
const prop = target[first];
|
|
14
16
|
if (typeof prop == 'function') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerManager.js","sourceRoot":"","sources":["../src/WorkerManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,M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AA;gBACtC,CAAC;YACL,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAChB,OAAO,CAAC;oBACJ,KAAK,EAAE,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC;oBAClC,SAAS,EAAE,IAAI;iBAClB,CAAC,CAAA;YACN,CAAC;QACL,CAAC,CAAC,CACL,CAAC,SAAS,EAAE,CAAA;IACjB,CAAC;IAED,aAAa,CAAC,IAAY,EAAE,OAAY;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAA;QAC1C,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QAC1C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;CAIJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livequery/rpc",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.135",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"clean": "rm -rf dist",
|
|
14
14
|
"build": "bun run clean && bunx tsc -p tsconfig.build.json",
|
|
15
15
|
"build:watch": "bunx tsc -p tsconfig.build.json --watch",
|
|
16
|
+
"test": "bun test tests/",
|
|
16
17
|
"prepublishOnly": "bun run build"
|
|
17
18
|
},
|
|
18
19
|
"exports": {
|