@clamator/over-memory 0.1.0
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 +79 -0
- package/dist/bus.d.ts +8 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/bus.js +15 -0
- package/dist/bus.js.map +1 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/dist/transport.d.ts +16 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +91 -0
- package/dist/transport.js.map +1 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @clamator/over-memory
|
|
2
|
+
|
|
3
|
+
In-process loopback transport for [clamator](https://www.npmjs.com/package/@clamator/protocol). The shared `MemoryBus` connects a `MemoryRpcServer` and `MemoryRpcClient` running in the same Node.js process.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @clamator/over-memory @clamator/protocol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quickstart
|
|
12
|
+
|
|
13
|
+
Define the contract:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// contracts/arith.ts
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { defineContract, defineMethod } from '@clamator/protocol';
|
|
19
|
+
|
|
20
|
+
export const arithContract = defineContract('arith', {
|
|
21
|
+
add: defineMethod({
|
|
22
|
+
params: z.object({ a: z.number(), b: z.number() }),
|
|
23
|
+
result: z.object({ sum: z.number() }),
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Generate the typed proxies:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx @clamator/codegen --src contracts --out-ts generated --ts-contract-import '../contracts/arith.js'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Wire server and client through a shared bus, talk via `ArithClient`:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// loopback.ts
|
|
38
|
+
import { MemoryBus, MemoryRpcServer, MemoryRpcClient } from '@clamator/over-memory';
|
|
39
|
+
import { arithContract } from './contracts/arith.js';
|
|
40
|
+
import { ArithClient, type ArithService } from './generated/arith.js';
|
|
41
|
+
|
|
42
|
+
const handlers: ArithService = {
|
|
43
|
+
add: async ({ a, b }) => ({ sum: a + b }),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const bus = new MemoryBus();
|
|
47
|
+
const server = new MemoryRpcServer({ bus });
|
|
48
|
+
server.registerService(arithContract, handlers);
|
|
49
|
+
await server.start();
|
|
50
|
+
|
|
51
|
+
const transport = new MemoryRpcClient({ bus });
|
|
52
|
+
await transport.start();
|
|
53
|
+
|
|
54
|
+
const arith = new ArithClient(transport);
|
|
55
|
+
console.log(await arith.add({ a: 2, b: 3 })); // { sum: 5 }
|
|
56
|
+
|
|
57
|
+
await transport.stop();
|
|
58
|
+
await server.stop();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`MemoryBus()` takes no arguments and is the only wiring needed. The loopback is synchronous within a single event loop turn — no timeouts, retries, or stream parameters.
|
|
62
|
+
|
|
63
|
+
## Key surface
|
|
64
|
+
|
|
65
|
+
- `MemoryBus` — constructor: `new MemoryBus()`. The connecting object passed to both server and client.
|
|
66
|
+
- `MemoryRpcServer({ bus })` — `registerService(contract, handlers)`, `start()`, `stop()`.
|
|
67
|
+
- `MemoryRpcClient({ bus })` — `start()`, `stop()`. Wrap with a generated `*Client` proxy for typed calls.
|
|
68
|
+
|
|
69
|
+
## When to reach for this vs. `@clamator/over-redis`
|
|
70
|
+
|
|
71
|
+
- `@clamator/over-memory` — tests, embedded scenarios, anything single-process.
|
|
72
|
+
- [`@clamator/over-redis`](https://www.npmjs.com/package/@clamator/over-redis) — cross-process, cross-host, durable streams, production.
|
|
73
|
+
|
|
74
|
+
## Links
|
|
75
|
+
|
|
76
|
+
- Sibling (Python): [`clamator-over-memory`](https://pypi.org/project/clamator-over-memory/)
|
|
77
|
+
- Codegen: [`@clamator/codegen`](https://www.npmjs.com/package/@clamator/codegen)
|
|
78
|
+
- Design spec: [`docs/2026-05-07-clamator-design.md`](../../../docs/2026-05-07-clamator-design.md)
|
|
79
|
+
- Agent rules: [`AGENTS.md`](./AGENTS.md)
|
package/dist/bus.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Dispatcher } from '@clamator/protocol';
|
|
2
|
+
export declare class MemoryBus {
|
|
3
|
+
private dispatchers;
|
|
4
|
+
register(service: string, dispatch: Dispatcher): void;
|
|
5
|
+
unregister(service: string): void;
|
|
6
|
+
lookup(service: string): Dispatcher | undefined;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=bus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bus.d.ts","sourceRoot":"","sources":["../src/bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,SAAS;IACpB,OAAO,CAAC,WAAW,CAAiC;IAEpD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI;IAMrD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;CAGhD"}
|
package/dist/bus.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class MemoryBus {
|
|
2
|
+
dispatchers = new Map();
|
|
3
|
+
register(service, dispatch) {
|
|
4
|
+
if (this.dispatchers.has(service))
|
|
5
|
+
throw new Error(`service "${service}" already registered on this bus`);
|
|
6
|
+
this.dispatchers.set(service, dispatch);
|
|
7
|
+
}
|
|
8
|
+
unregister(service) {
|
|
9
|
+
this.dispatchers.delete(service);
|
|
10
|
+
}
|
|
11
|
+
lookup(service) {
|
|
12
|
+
return this.dispatchers.get(service);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=bus.js.map
|
package/dist/bus.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bus.js","sourceRoot":"","sources":["../src/bus.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,SAAS;IACZ,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEpD,QAAQ,CAAC,OAAe,EAAE,QAAoB;QAC5C,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,kCAAkC,CAAC,CAAC;QACzE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,OAAe;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RpcClientCore } from '@clamator/protocol';
|
|
2
|
+
import type { MemoryBus } from './bus.js';
|
|
3
|
+
export interface MemoryRpcClientOptions {
|
|
4
|
+
bus: MemoryBus;
|
|
5
|
+
instanceId?: string;
|
|
6
|
+
defaultTimeoutMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class MemoryRpcClient extends RpcClientCore {
|
|
9
|
+
constructor(opts: MemoryRpcClientOptions);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,SAAS,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,IAAI,EAAE,sBAAsB;CAMzC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RpcClientCore } from '@clamator/protocol';
|
|
2
|
+
import { MemoryTransport } from './transport.js';
|
|
3
|
+
export class MemoryRpcClient extends RpcClientCore {
|
|
4
|
+
constructor(opts) {
|
|
5
|
+
super(new MemoryTransport(opts.bus, opts.instanceId ?? 'mem-client'), { defaultTimeoutMs: opts.defaultTimeoutMs ?? 30_000 });
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AASjD,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAChD,YAAY,IAA4B;QACtC,KAAK,CACH,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,IAAI,YAAY,CAAC,EAC9D,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,MAAM,EAAE,CACtD,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MemoryBus } from './bus.js';
|
|
2
|
+
export { MemoryTransport } from './transport.js';
|
|
3
|
+
export { MemoryRpcServer, type MemoryRpcServerOptions } from './server.js';
|
|
4
|
+
export { MemoryRpcClient, type MemoryRpcClientOptions } from './client.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAA+B,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,eAAe,EAA+B,MAAM,aAAa,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RpcServerCore } from '@clamator/protocol';
|
|
2
|
+
import type { MemoryBus } from './bus.js';
|
|
3
|
+
export interface MemoryRpcServerOptions {
|
|
4
|
+
bus: MemoryBus;
|
|
5
|
+
instanceId?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class MemoryRpcServer extends RpcServerCore {
|
|
8
|
+
constructor(opts: MemoryRpcServerOptions);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,SAAS,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,IAAI,EAAE,sBAAsB;CAGzC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RpcServerCore } from '@clamator/protocol';
|
|
2
|
+
import { MemoryTransport } from './transport.js';
|
|
3
|
+
export class MemoryRpcServer extends RpcServerCore {
|
|
4
|
+
constructor(opts) {
|
|
5
|
+
super(new MemoryTransport(opts.bus, opts.instanceId ?? 'mem-server'));
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQjD,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAChD,YAAY,IAA4B;QACtC,KAAK,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,IAAI,YAAY,CAAC,CAAC,CAAC;IACxE,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Transport, type Dispatcher, type SendOptions } from '@clamator/protocol';
|
|
2
|
+
import type { MemoryBus } from './bus.js';
|
|
3
|
+
export declare class MemoryTransport implements Transport {
|
|
4
|
+
private readonly bus;
|
|
5
|
+
private readonly _instanceId;
|
|
6
|
+
private state;
|
|
7
|
+
private pending;
|
|
8
|
+
private myServices;
|
|
9
|
+
constructor(bus: MemoryBus, _instanceId?: string);
|
|
10
|
+
registerService(name: string, dispatch: Dispatcher): Promise<void>;
|
|
11
|
+
send(env: Record<string, unknown>, opts: SendOptions): Promise<Record<string, unknown>>;
|
|
12
|
+
notify(env: Record<string, unknown>): Promise<void>;
|
|
13
|
+
start(): Promise<void>;
|
|
14
|
+
stop(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAClD,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQ1C,qBAAa,eAAgB,YAAW,SAAS;IAKnC,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAa,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJzE,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,UAAU,CAAqB;gBAEV,GAAG,EAAE,SAAS,EAAmB,WAAW,GAAE,MAAc;IAEnF,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlE,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA4CvF,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAU5B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { parseEnvelope, EnvelopeKind, ClamatorTransportError, } from '@clamator/protocol';
|
|
2
|
+
export class MemoryTransport {
|
|
3
|
+
bus;
|
|
4
|
+
_instanceId;
|
|
5
|
+
state = 'idle';
|
|
6
|
+
pending = new Map();
|
|
7
|
+
myServices = new Set();
|
|
8
|
+
constructor(bus, _instanceId = 'mem') {
|
|
9
|
+
this.bus = bus;
|
|
10
|
+
this._instanceId = _instanceId;
|
|
11
|
+
}
|
|
12
|
+
async registerService(name, dispatch) {
|
|
13
|
+
this.bus.register(name, dispatch);
|
|
14
|
+
this.myServices.add(name);
|
|
15
|
+
}
|
|
16
|
+
async send(env, opts) {
|
|
17
|
+
if (this.state !== 'started')
|
|
18
|
+
throw new ClamatorTransportError(`transport not started (state=${this.state})`);
|
|
19
|
+
const parsed = parseEnvelope(env);
|
|
20
|
+
if (parsed.kind !== EnvelopeKind.Request)
|
|
21
|
+
throw new ClamatorTransportError('send requires a request envelope');
|
|
22
|
+
const dispatcher = this.bus.lookup(parsed.service);
|
|
23
|
+
if (!dispatcher) {
|
|
24
|
+
// Simulate the same -32601 path as a real adapter after delivery + lookup-failure on server.
|
|
25
|
+
return {
|
|
26
|
+
jsonrpc: '2.0', id: parsed.id,
|
|
27
|
+
error: { code: -32601, message: 'Method not found', data: null },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return await new Promise((resolve, reject) => {
|
|
31
|
+
const timer = setTimeout(() => {
|
|
32
|
+
this.pending.delete(parsed.id);
|
|
33
|
+
reject(new ClamatorTransportError('call timeout'));
|
|
34
|
+
}, opts.timeoutMs);
|
|
35
|
+
this.pending.set(String(parsed.id), { resolve, reject, timer });
|
|
36
|
+
// Schedule async dispatch via microtask.
|
|
37
|
+
queueMicrotask(async () => {
|
|
38
|
+
try {
|
|
39
|
+
const reply = await dispatcher(parsed);
|
|
40
|
+
const p = this.pending.get(String(parsed.id));
|
|
41
|
+
if (!p)
|
|
42
|
+
return;
|
|
43
|
+
this.pending.delete(String(parsed.id));
|
|
44
|
+
clearTimeout(p.timer);
|
|
45
|
+
if (reply === null) {
|
|
46
|
+
p.reject(new ClamatorTransportError('dispatcher returned null for a request'));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
p.resolve(reply);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
const p = this.pending.get(String(parsed.id));
|
|
54
|
+
if (!p)
|
|
55
|
+
return;
|
|
56
|
+
this.pending.delete(String(parsed.id));
|
|
57
|
+
clearTimeout(p.timer);
|
|
58
|
+
p.reject(new ClamatorTransportError('dispatcher threw', e));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async notify(env) {
|
|
64
|
+
if (this.state !== 'started')
|
|
65
|
+
throw new ClamatorTransportError(`transport not started (state=${this.state})`);
|
|
66
|
+
const parsed = parseEnvelope(env);
|
|
67
|
+
if (parsed.kind !== EnvelopeKind.Notification)
|
|
68
|
+
throw new ClamatorTransportError('notify requires a notification envelope');
|
|
69
|
+
const dispatcher = this.bus.lookup(parsed.service);
|
|
70
|
+
if (!dispatcher)
|
|
71
|
+
return; // Silent drop, like a real fire-and-forget.
|
|
72
|
+
queueMicrotask(() => { void dispatcher(parsed); });
|
|
73
|
+
}
|
|
74
|
+
async start() {
|
|
75
|
+
if (this.state === 'stopped')
|
|
76
|
+
throw new ClamatorTransportError('transport has been stopped');
|
|
77
|
+
this.state = 'started';
|
|
78
|
+
}
|
|
79
|
+
async stop() {
|
|
80
|
+
this.state = 'stopped';
|
|
81
|
+
for (const [id, p] of this.pending.entries()) {
|
|
82
|
+
clearTimeout(p.timer);
|
|
83
|
+
p.reject(new ClamatorTransportError('transport stopped'));
|
|
84
|
+
this.pending.delete(id);
|
|
85
|
+
}
|
|
86
|
+
for (const name of this.myServices)
|
|
87
|
+
this.bus.unregister(name);
|
|
88
|
+
this.myServices.clear();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAAE,YAAY,EAAE,sBAAsB,GAEpD,MAAM,oBAAoB,CAAC;AAS5B,MAAM,OAAO,eAAe;IAKG;IAAiC;IAJtD,KAAK,GAAmC,MAAM,CAAC;IAC/C,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IACrC,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAEvC,YAA6B,GAAc,EAAmB,cAAsB,KAAK;QAA5D,QAAG,GAAH,GAAG,CAAW;QAAmB,gBAAW,GAAX,WAAW,CAAgB;IAAG,CAAC;IAE7F,KAAK,CAAC,eAAe,CAAC,IAAY,EAAE,QAAoB;QACtD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAA4B,EAAE,IAAiB;QACxD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;YAC1B,MAAM,IAAI,sBAAsB,CAAC,gCAAgC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC,OAAO;YACtC,MAAM,IAAI,sBAAsB,CAAC,kCAAkC,CAAC,CAAC;QACvE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,C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B,CAAC,4BAA4B,CAAC,CAAC;QAC7F,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC,CAAC,MAAM,CAAC,IAAI,sBAAsB,CAAC,mBAAmB,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU;YAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9D,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clamator/over-memory",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "In-process loopback transport for clamator (pre-1.0).",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@clamator/protocol": "0.1.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.6.0",
|
|
28
|
+
"vitest": "^2.1.0",
|
|
29
|
+
"zod": "^3.23.0"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.json",
|
|
33
|
+
"clean": "rm -rf dist .tsbuildinfo",
|
|
34
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
35
|
+
"test": "vitest run"
|
|
36
|
+
}
|
|
37
|
+
}
|